[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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
like:

<xsl:choose>
<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>
</xsl:choose>

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:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread