[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: "Corey Snow" <Corey.Snow@xxxxxxxxxxxxxx>
Date: Tue, 7 Jan 2003 11:25:36 -0600
RE:  Number of times apply-templates gets executed.

> -----Original Message-----
> From: Patel, Viral [mailto:viral.patel@xxxxxxxxxxxxxxxxxxxx] 
> Sent: Tuesday, January 07, 2003 7:55 AM
> To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Subject:  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?

Yes, this is true- within the scope of the variable. Every time an
<xsl:template/> that contains an <xsl:variable/> element is executed,
that <xsl:variable/> element will be reinitialized. However, XSLT can
never change the value of the variable once it is created; it can only
let it go out of scope and restart.

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

Not in the sense of incrementing a variable or passing a parameter back
to the caller; these things would introduce side effects, which is not
allowed in XSL. You could output a node for every time the template is
executed, but that may not be what you're looking for.

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

I can't think of any convenient ways, except to point out that the
boolean() function and the idea of boolean values already exists in XSL.
So does the concept of a counter; see the position() and number()
functions. But if you're trying to keep a running total and use that in
other areas like a traditional variable in a functional language, I'm
not sure how you'd do it. Possibly someone who knows more than I do can
help there.

Regards,

Corey M. Snow, Delivery Consultant
Logical- http://www.us.logical.com
Phone: (360) 491-7774
Cell: (360) 481-2563
"We are the music makers, and we are the dreamers of dreams."

 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.