recursion problem

B

Ben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top