xsl-list
[Top] [All Lists]

RE: Number of times apply-templates gets executed.

2003-01-07 09:29:05
1. That is correct. With this proviso: A variable can be re-defined in a 
different context. For example, a variable template inside an <xsl:for-each> 
element will be re-defined with each iteration.

2. This is more difficult to answer. You could, for instance create a variable 
which hold the value of a count() or last() function whose argument is an XPath 
expression which is the same as the value of the "select" attribute of your 
template. If you call the same template in a variety of contexts, you would 
have to create a variable for each context with differing XPath expressions for 
each context and then add them.

3. Counters (if you mean something that increments during the transformation) 
are not possible. See answer to question 1.

Booleans are the result of an equality comparison and the results of the 
comparison can easily be assigned to a variable.
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     "Patel, Viral" <viral(_dot_)patel(_at_)countryfinancial(_dot_)com>
Sent:     Tue, 7 Jan 2003 09:54:52 -0600
To:       "'XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com'" 
<XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  [xsl] Number of times apply-templates gets executed.

Hi,

I am new to XSL and I have several questions - some of them might be really
easy ones but I just want to confirm.
1. I believe its not possible to change the value of <xsl:variable> once its
set - correct?

2. Is there a way to figure out how many times a template was applied when
using <xsl:apply-templates>?

3. Is there an easy to implement a counter or a boolean in xsl? If yes then
how? Implementing either one would be fine.

Thanks
V. Patel.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list