Subject: Re: [xsl] Is there any benefit to creating a variable and specifying as="xs:string"? From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 17 Jun 2024 01:41:04 -0000 |
> >> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Is there any benefit to c, Michael Kay michaelk | Thread | Re: [xsl] Is there any benefit to c, Michael Kay michaelk |
Re: [xsl] Need help with grouping, Martin Honnen martin | Date | Re: [xsl] Is there any benefit to c, Michael Kay michaelk |
Month |