[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Number of times apply-templates gets executed.

Subject: RE: Number of times apply-templates gets executed.
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 7 Jan 2003 11:20:47 -0500
implement counter in xslt
[ Patel, Viral]

> 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?
> 
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.
> 

It will be better if you talk about what you want to accomplish rather
than procedural steps that you imagine you might want to use.  For
example, literally there are boolean values in xslt, but it sounds like
you might want to set a flag and carry it along.  This is not a matter
have whether you can "have a boolean".  You can do this kind of thing by
passing parameters to templates, but it is likely that some other
approach will be easier and more understandable.

As for counters, in xslt you generally select sets of nodes and then
operate on them.  If you leave them in document order (as is usually the
case), then the position of the current node in that node set (given by
the position() function) may do the job you wre thinking that a counter
would.  It all depends on what you want to do.

Cheers,

Tom P

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.