recursion problem

Discussion in 'XML' started by Ben, Aug 29, 2007.

  1. Ben

    Ben Guest

    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
    Ben, Aug 29, 2007
    #1
    1. Advertising

  2. Joseph Kesselman, Aug 29, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kelvSYC

    Recursion-related problem

    kelvSYC, Nov 18, 2003, in forum: Java
    Replies:
    2
    Views:
    315
    Eric Sosman
    Nov 18, 2003
  2. Anakin
    Replies:
    14
    Views:
    745
    Thomas G. Marshall
    Apr 13, 2005
  3. JimC
    Replies:
    3
    Views:
    518
  4. Allan W
    Replies:
    4
    Views:
    524
    Jos A. Horsmeier
    Jan 22, 2004
  5. Replies:
    8
    Views:
    733
    John Reye
    Apr 26, 2012
Loading...

Share This Page