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

Re: xslt 3.0, and use of 'as' attribute with xsl:varia

Subject: Re: xslt 3.0, and use of 'as' attribute with xsl:variable
From: "Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Aug 2023 15:23:07 -0000
Re:  xslt 3.0
Hi Mike,

On Thu, Aug 31, 2023 at 7:27b/PM Michael Kay mike@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Firstly, everything you talk about here was defined in XSLT 2.0, and was
> unchanged in 3.0.
> You've left out a crucial phrase from your quotation, which is present in
> both 2.0 and 3.0:
> *If the as attribute is specified, then the supplied value of the variable
> is converted to the required type, using the function conversion rules.*

Thanks for the explanation. I'll surely be trying to read about XSLT
3.0/XPath 3.x function conversion rules in detail.

Following are my other related doubts, about XPath 3.1 'cast' expression,
which the XPath 3.1 spec introduces as follows,

"Occasionally it is necessary to convert a value to a specific datatype.
For this purpose, XPath 3.1 provides a cast expression that creates a new
value of a specific type based on an existing value."

I've tried following XSLT 3.0 code fragment with Saxon HE 12.2,

<xsl:value-of select="'4' cast as xs:integer"/>

and this produces the result, 4.

And the XPath 3.1 expression ('4' cast as xs:integer) + 3  produces result

I think, the XSLT 3.0 variable declaration, <xsl:variable name="var1"
select="'4'" as="xs:integer"/> should work similarly (I think, it should
succeed, and the specific XPath 3.1 function conversion rule seems to me is
wrong if it, disallows this. Apologies to be saying like this, and
disagreeing to the XPath 3.1 spec wrt this point) to what "cast as"
expressions as cited above are able to do.

Any thoughts please?

Mukul Gandhi

Current Thread


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.
First Name
Last Name
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.