[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Is there any benefit to creating a variable and s

Subject: Re: 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
Re:  Is there any benefit to creating a variable and  s
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.