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

RE: Looping in XSLT(old question, but maybe new proble

Subject: RE: Looping in XSLT(old question, but maybe new problem)
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Tue, 24 Jun 2003 20:49:10 -0400
xsl entering a linefeed
Hey Liu,

You last responded with:
>>... if foo-bar-temp is a global variable, is the nodeset initialized
>>only once or is it generated every time foo-bar-temp is called?

I'm not quite sure I understand your question, but I'll give it a whirl...

Globally scoped variable elements are intialized only once, when the
transform begins ... or, in essence when the stylesheet is "compiled" and
intially loaded with the source xml document.  

I don't know off-hand what all the exact sequence rules are for processing
child elements of the stylesheet element, but I'm sure you could find that
at the w3c.

However, my example solution doesn't have the foo-bar-xxx (et.al) variables
defined at global scope, they were defined within the local scope of the
root matching template.

You could move them to that level of visibility ... here are some things to
consider before doing that:
   1.  Other templates could use the node lists ... which can be a great
thing, sharing objects/state can be nice.
   2.  They are defined only once, upon beginning the transform ... which
can be a nice optimization--if consideration #1 is a factor--but, if you
need to re-define them upon entering a given template, your out of luck.
   3.  I would only do this if there are only a few templates within the
stylesheet, otherwise what if--for a given transform--depending on your use
case, your xslt execution path/thread may never accesses/uses those
variables? ... then you've spent needless overhead in "compiling" the
stylesheet due to having to construct those globally visible variables.

Also, please keep in mind this was only an example--one example--of how to
accomplish your solution.

Thanks,
Jeff

 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.