[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Number of times apply-templates gets executed.
At 2003-01-07 09:54 -0600, Patel, Viral wrote:
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? Yes. Values are bound to variables and once bound cannot be changed within the scope of the variable. 2. Is there a way to figure out how many times a template was applied when using <xsl:apply-templates>? By counting how many nodes in your selection are going to be triggering the use of the template. For example, if you had: <xsl:template match="para">... ... and you were in a chapter with para children and you planned in your chapter to do: <xsl:apply-templates/> Then the number of times the template would be called is: <xsl:value-of select="count(para)"/> 3. Is there an easy to implement a counter or a boolean in xsl? No ... thinking of counters is a programmer's approach to the problem. XSLT is functional and side effect free, so instead of the stylesheet implementing counters, the stylesheet asks the processor to do the counting. If you cannot easily address the items being counted by an XPath expression to the count() function, then consider the use of <xsl:number> to identify and count nodes based on your identification criteria. I hope this helps. ........................ Ken
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-10-1 Practical Formatting Using XSL-FO Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc 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
|