[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Dump name and value of all input parameters to an output file

Subject: Re: [xsl] Dump name and value of all input parameters to an output file
From: "Jorge . chocolate.camera@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Sep 2015 10:59:45 -0000

That solution is fine and actually very handy for not having to
declare each param at the start of the stylesheet. But I was actually
not minding doing so (although I might rewrite my stylesheet with that
idea). I was asking for a way to not having to to call them by name,
again, one by one, in the template that generates the file.

On Thu, Sep 10, 2015 at 12:26 PM, David Carlisle
d.p.carlisle@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
> On 10 September 2015 at 10:48, Jorge . chocolate.camera@xxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>> Is there a way to get the names and values of all parameters passed to
>> an XSLT transformation? I would like to be able to dump all of them to
>> a file during the transformation itself without having to hardcode
>> their names in the XSL fragment that outputs the file.
>> I am using Saxon-HE and XSLT 2.0. I refer specifically to
>> custom parameters passed to the stylesheet from the command-line like
>> "FOO=bar" in:
>> java -jar saxon9he.jar -xsl:transform.xsl -it:main 'FOO=bar'
> xslt scoping rules mean that all parameters that you access as $FOO
> must be declared in the stylesheet.
> However you can change your syntax a bit and have a list of values in
> a single paramter
> java -jar saxon9he.jar -xsl:transform.xsl -it:main 'params=FOO:bar,
> ZZZ:baz, GRRR:www'
> then you just have a singe parameter $params to declare and a bit of
> string processing with
> tokenize($params,',\s*') will split up the list for you to handle in
> the template where needed.
> David

Current Thread