|
[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
> >> 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?
Thanks,
Dimitre
On Sun, Jun 9, 2024 at 11:16b/PM Michael Kay michaelkay90@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.
>
> >>
> >> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








