Subject: Re: [xsl] Is there any benefit to creating a variable and specifying as="xs:string"? From: "Pieter Masereeuw pieter@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 17 Jun 2024 06:20:36 -0000 |
I have often been saved by an error if an XPath expression returned a sequence of more than one items, while the as= clause declared the parameter or the value to allow just one. So it is not only the datatype that matters, but also the number of items. Pieter Masereeuw On 6/17/24 08:07, Michael Kay michaelkay90@xxxxxxxxx wrote: > > >> On 17 Jun 2024, at 02:41, Dimitre Novatchev dnovatchev@xxxxxxxxx >> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: >> >> >B B >> >> >B B >> That "as" clause says the ICAO param is a string value. Well, >> everything is a string. >> > >> >B B 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: >> >> >B B B B B B B B B B B <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 > > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3208261> > (by email <>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Is there any benefit to c, Michael Kay michaelk | Thread | [xsl] Need help with grouping, Charlie 0 charlieo0@ |
Re: [xsl] Is there any benefit to c, Michael Kay michaelk | Date | [xsl] [ANN] Balisage 2024 Program A, Tommie Usdin btusdin |
Month |