better way maybe with recursive use of XSL

Discussion in 'XML' started by Oliver Schalch, Oct 21, 2005.

  1. Hi List,

    I've made somelike as you see below, but that is not a really nice way,
    since depth can be from 1-x. And in my case you have to add tons of
    test=depth="...". What would be a nice way to make my code more flexible?

    <xsl:template match="wiki:NList">
    <ol>
    <xsl:for-each select="wiki:NListItem">
    <xsl:if test="@depth=1">
    <li><xsl:apply-templates/></li>
    </xsl:if>

    <xsl:if test="@depth=2">
    <ol><li><xsl:apply-templates/></li></ol>
    </xsl:if>

    <xsl:if test="@depth=3">
    <ol><ol><li><xsl:apply-templates/></li></ol></ol>
    </xsl:if>

    </xsl:for-each>
    </ol>
    </xsl:template>

    --
    oli
     
    Oliver Schalch, Oct 21, 2005
    #1
    1. Advertisements

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. Ray Tayek
    Replies:
    3
    Views:
    769
    Ray Tayek
    Nov 30, 2003
  2. MC
    Replies:
    1
    Views:
    7,581
    David Carlisle
    Mar 24, 2005
  3. Replies:
    1
    Views:
    3,928
    A. Bolmarcich
    May 27, 2005
  4. Replies:
    0
    Views:
    723
  5. Guest
    Replies:
    5
    Views:
    841
  6. Ville Vainio
    Replies:
    11
    Views:
    869
    Hamish Lawson
    Aug 10, 2004
  7. Replies:
    6
    Views:
    300
  8. Replies:
    2
    Views:
    199
    Mark H Harris
    May 13, 2014
Loading...