Re: [xsl] xslt 3.0, and use of 'as' attribute with xsl:variable

Subject: Re: [xsl] xslt 3.0, and use of 'as' attribute with xsl:variable
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 1 Sep 2023 08:52:13 -0000
On Fri, 1 Sept 2023 at 09:13, Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Wendell,
>
> On Thu, Aug 31, 2023 at 7:24b/PM Piez, Wendell A. (Fed)
> wendell.piez@xxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
>> My thought is, why not
>>
>>
>>
>> <xsl:variable name="var1" select="4"/>
>>
>>
>>
>
> I'm currently not writing an XSLT stylesheet for a particular business
> application, i.e, my goal as per this mail thread is, not to have
> <xsl:variable name="var1" .. and a corresponding <xsl:value-of
> select="$var1 + 3"/> to work somehow.
>
> I'm trying to understand, how an XSLT 3.0/XPath 3.1 implementation should
> function when an XSLT 3.0 instruction xsl:variable has an "as" attribute
> (that refers to a sequence type, for e.g xs:integer).
>
> As per XSLT 3.0 spec referring about xsl:variable instruction, which says
> "If the as attribute is specified, then the supplied value of the variable
> is converted to the required type, using the function conversion rules.".
>
> As I've mentioned within another mail on this thread, I think XPath 3.1
> function conversion rules prohibiting a string value '4' to be cast to an
> xs:integer type is not very much right. These XPath 3.1 function conversion
> rules should be consistent with the result of following XPath expression,
>
> '4' cast as xs:integer.
>
> Or vice-versa, if these XPath 3.1 function conversion rules are correct,
> then the XPath 3.1 expression '4' cast as xs:integer should raise an
> error.
>
>
>
The rules are a bit arbitrary, but you are calling them xpath 3.1 rules as
if they are new(ish) but this all comes from xpath/xslt 2, and changing the
way type conversion works after decades of use would be problematic.

David


> --
> Regards,
> Mukul Gandhi
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread