Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > recursion problem

Reply
Thread Tools

recursion problem

 
 
Ben
Guest
Posts: n/a
 
      08-29-2007
Hi!
im trying to get my head around xslt and xml but my brain is simple
and nt let me do much >.<
im trying to create a stylesheet for this xml

<UsersPermissions>

<userPermissions>
<user>dala2</user>
<rights>Read</rights>
<location>C:\Test</location>
</userPermissions>

<userPermissions>
<user>senk2</user>
<rights>Read</rights>
<location>C:\Test</location>
</userPermissions>

<userPermissions>
<user>senk1</user>
<rights>Read</rights>
<parent>C:\Test</parent>
<location>C:\Test\New Folder</location>
</userPermissions>

</UsersPermissions>

what im tyring to do is display it in a heirarchy format based on
location
such as:
-C:\Test
------------New Folder

so items are displayed in their folder structure with New Folder being
a subfolder
i came on to the idea of attempting to group them under the parent tag
but then i just confused myself >.<

this is the xsl i have so far
-------------
<xsl:for-each select="UsersPermissions">
<xsl:for-each select="userPermissions">
<li><xsl:value-of select="location"/></li>
<xsl:choose>
<xsl:variable name="KK"><xsl:value-ofselect="parent"/></
xsl:variable>
<xsl:when test="location = $kk">
<ul><li><xsl:value-ofselect="location"/>
</li></ul>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
--------------

but it doesnt work, becuase im an idiot >.<

Does anyone have any idea's on how i can accomplish this?

Thanks!

Ben

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      08-29-2007
You might want to start by looking at the sorting and grouping sections
of the XSLT FAQ website.

http://www.dpawson.co.uk/xsl/sect2/sect21.html


--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
va_arg... recursion: changing arguments and the using recursion jononanon@googlemail.com C Programming 8 04-26-2012 08:37 PM
Simple recursion problem. Need help. Anakin Java 14 04-13-2005 03:10 AM
Re: Recursion problem - Graph theory - Algorithm needed Allan W C++ 4 01-22-2004 02:42 PM
Recursion problem - Graph theory - Algorithm needed JimC C++ 3 01-17-2004 12:43 PM
Recursion-related problem kelvSYC Java 2 11-18-2003 03:32 PM



Advertisments