Subject: Re: [xsl] rephrased: passing parameters to generic templates From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 13 Apr 2006 12:19:31 +0100 |
Michael Using a global variable is straightforward, but it does have one disadvantage: if you decide you need to modify the stylesheet to process N input documents rather than only one, then it won't work, because a global variable can only have one value. Yes this is one place where I've found tunnel params to be very useful. With a largish 1.0 stylesheet designed to transform one document to one document I wanted to change it to 2.0 and use the collection() function and xsl:result-document so that it would do a group of documents in one go. It required no changes at all except for the addition of a new initial template that iterated over the collection, except that the stylesheet had some "global" variables which in the new setup needed to be calculated on a per-document basis. Changing the code (several thousand lines of it) to explictly pass parameters, or to explictly use Xpaths to obtain the data didn't seem very attractive, but changing the global parameters to tunnel parameters required virtually no change to the rest of the stylesheet and worked out very well. Any time costs of using tunnel parameters was dwarfed by the time saving of iterating the files within the same JVM and compiled stylesheet rather than just looping over the files in a shell command line loop. (Yes I know in theory I could in XSL 1.0 have looped over the files using some Java rather that a command line loop, but in practice this is inconvenient, the people using the stylesheet know even less java than me, and probably only have a runtime system and not a JDK) David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] rephrased: passing parame, Wendell Piez | Thread | [xsl] Is Saxon the *only* XSLT 2.0 , Weston, Toby |
RE: [xsl] Determining the context n, Michael Kay | Date | RE: [xsl] pdf, cknell |
Month |