This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28350 - [XSLT30] (possibly editorial) static variables declaration order, unfinished sentence in spec
Summary: [XSLT30] (possibly editorial) static variables declaration order, unfinished ...
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Member-only Editors Drafts
Hardware: PC Windows NT
: P2 trivial
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-26 22:19 UTC by Abel Braaksma
Modified: 2015-10-29 09:50 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2015-03-26 22:19:42 UTC
The spec, under 9.7 Static Expressions says:

<quote>
If two static variables satisfying this rule have the same name and are both in scope, the one that appears most recently in stylesheet tree order; as a consequence of rules defined elsewhere this will always be consistent with the declaration having highest import precedence.
</quote>

I think the first sentence is meant to mean something like: "If two static [...], then the static variable that appears most recently in stylesheet tree order is in scope." (I am missing a verb and a (prepositional) object in the sentence, I think).

I'm not 100% sure, but I think it means (among others) that the following is legal:

<xsl:variable static="yes" name="first" select="'hello'" />
<xsl:variable static="yes" name="first" select="$first || ' world'" />

Because the one most recently declared in tree-order is valid, and the variable is not in scope of itself, so $first in the expression refers to the previous declaration, and is legal.

The variable would now hold string "hello world".
Comment 1 Abel Braaksma 2015-03-26 22:44:23 UTC
> I'm not 100% sure, but I think it means (among others) that the following 
> is legal:

> <xsl:variable static="yes" name="first" select="'hello'" />
> <xsl:variable static="yes" name="first" select="$first || ' world'" />

Correcting myself, rules just prior to this section ensure that both variables must be consistent (i.e. have the same value), which clearly is not the case here. It should throw XTSE3450 (meaning the values are inconsistent).

If the second variable would occur in an imported stylesheet and be imported after the first declaration, overriding the value is allowed, but you would not be able to access the value of the original variable.

Leaving the bug open because of the typo in the quote in the comment#0 above.
Comment 2 Michael Kay 2015-03-27 17:25:27 UTC
I've (silently) fixed the typo, the sentence now reads:

If two static variables satisfying this rule have the same name and are both in scope,
 the one that appears most recently in stylesheet tree order is used.