|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Number of times apply-templates gets executed.
1. I believe its not possible to change the value of <xsl:variable> once its set - correct? that's correct, although if the variable is declared with xsl:param then you can of course call it with different values if the template is re-executed. 2. Is there a way to figure out how many times a template was applied when using <xsl:apply-templates>? Depending on what you mean the answer may be "no", or "its always 1" I suspect the answer is "no". In simple cases, you can use count. For example if you have a template that matches foo and no other template matches that element then apply-templates will activate the template <xsl:value-of select="count(foo)"/> times but if you mean can you query which templates match according to the priority and import precedence rules the answer is no, but why do you want this? 3. Is there an easy to implement a counter or a boolean in xsl? If yes then how? Implementing either one would be fine. It depends what you mean by a counter, xsl:number does many of the jobs that involve counting. Or you can have a recursive template that iterates over some set of nodes, incrementing a parameter each time. Boolean is a primitive data type in Xpath so yes you can have booleans, <xsl:variable name="x" select="1 > abc"/> is a boolean valued variable with value true or false depending on the numeric value of the <abc> element child of the current node. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








