Subject: Re: [xsl] Number of times apply-templates gets executed. From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 7 Jan 2003 16:32:34 GMT |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Number of times apply-templat, Patel, Viral | Thread | Re: [xsl] Number of times apply-tem, G. Ken Holman |
RE: [xsl] disable-output-escaping=", Andrew Milkowski | Date | RE: [xsl] Number of times apply-tem, Martinez, Brian |
Month |