[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: initial template parameters
On 18 March 2010 14:21, David Carlisle <davidc@xxxxxxxxx> wrote: > On 18/03/2010 14:13, Max Toro wrote: >> >> The only solution I can think of is using extension methods to pull >> the parameters from the environment, something like this: >> >> <xsl:param name="color" value="(ext:get-parameter('color'), 'red')[1]" >> as="xs:string"/> > > more portable you can have a simple stylesheet with just a named template > that initialises its parameters from global parameters and then xsl:imports > the original stylesheet. this means you need a wrapper stylesheet for any > top level named template that you want to use, but most stylesheets don't > have _so_ many choices for initial named template. Yes, or a hack that uses a single global parameter to pass in a string containing the list of params that gets tokenised to extract the different values for each entry point, eg: <xsl:param name="str" select="'foo=bar;baz=bop;'"/> <xsl:template name="entrypoint1"> <xsl:param name="foo" select="f:getParam('foo')"/> <xsl:template name="entrypoint2"> <xsl:param name="baz" select="f:getParam('baz')"/> etc. So for -it=entrypoint1 you can pass in $str = 'foo=bar', and for -it=entrypoint2 you pass in $str = 'baz=bop' -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
|
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
|