[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: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Jun 2024 06:16:44 -0000
Re:  Is there any benefit to creating a variable and  s
>> 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.

>>
>> Bonus question: The value to populate the ICAO param should be a 4-letter,
uppercase value, such as KBOS. Is there anyway to express that
requirement/constraint in the "as" clause?
>

If you have a schema-aware processor, you can define a subtype of xs:string
with the restriction facet <pattern value="[A-Z]{4}"/>, and you can name that
subtype in your `as` clause.

The downside of this is that (in XSLT 3.0) the caller must explicitly cast the
supplied parameter value to this subtype. In the proposed 4.0 specification,
this casting happens implicitly.

Michael Kay
Saxonica

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.