better way maybe with recursive use of XSL

O

Oliver Schalch

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>
 

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

Forum statistics

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

Latest Threads

Top