xsl-list
[Top] [All Lists]

Re: [xsl] Recursively looping through a template only X number of times?

2006-11-28 10:23:11


<xsl:variable name="TOCTemplateLoopCount" select="0" />

If you do that you have defined TOCTemplateLoopCount to globally have
value 0 and it will always have this value. (It is possible to have
local variables or parameters with teh same name which will "shadow"
this variable making it inaccessible within the scope of the local
variable, but you can never change its value).


You don't need a variable at all (other than your global parameter where
you want to set the limit.

Just have

<xsl:variable name="tocdepth" select="2"/>

then 

wrap your code in

<xsl:if test="count(ancestor::ruleItem)&lt;=$tocdepth">
.. make a toc entry...
</xsl:if>

David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--