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. 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. Replies:
    1
    Views:
    3,686
    A. Bolmarcich
    May 27, 2005
  2. Guest
    Replies:
    5
    Views:
    639
  3. Ville Vainio
    Replies:
    11
    Views:
    635
    Hamish Lawson
    Aug 10, 2004
  4. Replies:
    6
    Views:
    184
  5. Replies:
    2
    Views:
    67
    Mark H Harris
    May 13, 2014
Loading...

Share This Page