RE: Recursive substitution

Subject: RE: Recursive substitution
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 11 Mar 1999 19:17:37 -0000
> Can anyone suggest a way to re-code the following horrible stylesheet
> fragment:
Another way which is perhaps marginally less horrible is to do something

<xsl:when test="/*">$</xsl:when>
<xsl:when test="/*/*">$$</xsl:when>
<xsl:when test="/*/*/*">$$$</xsl:when>
<xsl:when test="/*/*/*/*">$$$$</xsl:when>
<xsl:when test="/*/*/*/*/*">$$$$$</xsl:when>
<xsl:otherwise>Nesting too deep</xsl:otherwise>

Haven't tried it though.

It might also be worth trying the much cleaner:

<xsl:for-each select="ancestor(*)">$</xsl:for-each>

But my reading of the spec doesn't convince me that's supposed to work.

Mike Kay

 XSL-List info and archive:

Current Thread