Re: [xsl] Saxon command-line: How to assign a sequence of multiple strings to a global param

Subject: Re: [xsl] Saxon command-line: How to assign a sequence of multiple strings to a global param
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 5 Nov 2018 17:56:32 -0000
In recent releases you can do

"?MY_ARRAY=('one', 'two', 'three')"

but note that the exact rules for use of double-quotes around a string
containing special characters depend on which command line processor (shell)
you use.

I don't know if this syntax was available in 9.2, you will have to check. The
question-mark signals that what follows the parameter name is an XPath
expression rather than a simple string literal.

Note that the normal syntax name=value interprets value as xs:untypedAtomic,
which is therefore cast to the required/declared type of the xsl:param. This
will work for parameters declared as integer, boolean or string, but not for a
sequence.

Michael Kay
Saxonica

> On 5 Nov 2018, at 17:38, Jorge . chocolate.camera@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Running Saxon from the command line (testing with Saxon-HE 9.2.1.2Jbyes,
old as heckbon Bash 3.2.57(1)), is there a way to set the value of a global
parameter of an XSLT2 stylesheet to a sequence of strings?
>
>     <xsl:param name="MY_ARRAY" as="xs:string*"/>
>
> When attempting to do it like this:
>
>     java  -jar saxon9he.jar [options] 'MY_ARRAY="one" "two" "three"'
>     java  -jar saxon9he.jar [options] MY_ARRAY='"one" "two" "three"'
>
> Saxon seemingly interprets spaces as literal, and the value of the parameter
becomes one single string
>
>     <xsl:message select="count($MY_ARRAY)"/>
> b 1
>
> instead of interpreting them as separators so that the value of the
parameter contains those three.
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by
email <>)

Current Thread