Re: [xsl] Is there any benefit to creating a variable and specifying as="xs:string"?

Subject: Re: [xsl] Is there any benefit to creating a variable and specifying as="xs:string"?
From: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jun 2024 06:06:36 -0000
> On 17 Jun 2024, at 02:41, Dimitre Novatchev dnovatchev@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >   >>
> >   >> That "as" clause says the ICAO param is a string value. Well,
everything is a string.
> >
> >   Nonsense. Saying as="xs:string" stops the caller from supplying (say) a
boolean, a number, or a map.
>
> I was under the impression that the quoted global parameter declaration was
for a value supplied on the command-line that invoked the XSLT processor:
>
> >            <xsl:param name="ICAO" as="xs:string"/>
>
> In this case Roger would be right that specifying the type as xs:string
would not be too-useful, or is this not so?
>

Yes, if it's only ever called from the Saxon command line, then specifying
as="xs:string" achieves very little. It does however prevent someone
supplying, say, an integer using the command line syntax ?ICAO=42, or a date
using ?ICAO=current-date(). It also has documentary value, and it will come
into its own if someone in the fullness of time attempts to invoke the
stylesheet using a different processor or a different API.

Michael Kay
Saxonica

Current Thread