[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
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
|
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
|