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 2946 - [XSLT] remove stability constraint in use-when
Summary: [XSLT] remove stability constraint in use-when
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
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: 2006-02-27 21:54 UTC by Joanne Tong
Modified: 2006-05-04 21:19 UTC (History)
0 users

See Also:


Attachments

Description Joanne Tong 2006-02-27 21:54:36 UTC
According to the second table in section 3.12 (Conditional Element Inclusion), 
current datetime information and implicit timezone are available when 
evaluating a use-when expression.  Section 5.4.3 (Initializing the Dynamic 
Context) states that these two components must be stable.  To satisfy this 
stability constraint and to generate a current datetime value that is expected 
by the user, our implementation of the compiled processor cannot fully 
evaluate the use-when expression statically before byte-code generation.   We 
would like to avoid this because evaluating use-when during run-time adds 
complexity to our implementation.  An alternative without the added complexity 
and still satisfy the stability constraint is to fix the current datetime 
value to compile time, and other expressions accessing current datetime 
information would also return this value during run-time.  Unfortunately, our 
users would then always get a current-datetime value from the past.   In order 
to avoid the added complexity to our implementation and still provide the user 
with accurate datetime information in most cases,  I request for lifting the 
stability constraint for these two components only when used in a use-when 
expression.
Comment 1 Michael Kay 2006-02-27 23:12:43 UTC
Good point. I think the answer to this is that the values should be stable
during an "episode", and use-when evaluation is a different episode from
actually running the transformation.

Michael Kay (personal response)
Comment 2 Michael Kay 2006-03-10 21:41:58 UTC
On 9 March the WG accepted in principle the suggestion that evaluation of use-when should be a separate episode with no requirement to share the same context as the run-time transformation. I was asked to propose detailed wording.

I propose also, to retain implementation flexibility, that evaluation of each use-when expression should be a separate episode in the above sense.

Proposed wording:

1. In 3.12, after the table of dynamic context components, add the paragraph:

Each XPath expression contained in an [xsl:]use-when attribute is evaluated in a separate [execution scope[FO]]. This means that there is no requirement for functions such as [current-date] to return the same result when called in different [xsl:]use-when expressions, or to return the same result as a call on the same function executed during the transformation proper.

2. In 5.4.3, after the second paragraph, add:

XPath expressions contained in [xsl:]use-when attributes (see 3.12 Conditional Element Inclusion) are not considered to be evaluated "during the transformation" as defined above. The evaluation of each such expression constitutes a separate [execution scope[FO]].
Comment 3 Michael Kay 2006-04-27 20:17:22 UTC
There was some concern expressed that the results of different use-when expressions might be inconsistent with each other, for example if two conditions were written to be mutually exclusive then either or both might be true. On the other hand, it is desirable to retain the flexibility to preprocess different modules at different times (separate compilation). The suggestion was therefore made that the evaluation context for all use-when expressions within a given stylesheet module should be the same.

Revised proposal:

1. In 3.12, after the table of dynamic context components, add the paragraph:

Within a [stylesheet module], all expressions contained in [xsl:]use-when attributes are evaluated in a single [execution scope[FO]]. This need not be the same execution scope as that used for [xsl]:use-when expressions in other stylesheet modules, or as that used when evaluating XPath expressions appearing elsewhere in the stylesheet module. This means that a function such as [current-date] will return the same result when called in different [xsl:]use-when expressions within the same stylesheet module, but will not necessarily return the same result as the same call in an [xsl:]use-when expression within a different stylesheet module, or as a call on
the same function executed during the transformation proper.

2. In 5.4.3, after the second paragraph, add:

XPath expressions contained in [xsl:]use-when attributes (see 3.12 Conditional
Element Inclusion) are not considered to be evaluated "during the
transformation" as defined above. For details see [3.12].
Comment 4 Michael Kay 2006-05-04 21:17:40 UTC
As agreed by the WG, this change has now been applied to the text.