This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
See Section 5.4.3 where it says: "XPath requires that certain aspects of the dynamic context are stable during the evaluation of an expression. For example, the current date and time, the implicit timezone, the document order of nodes, and the set of available documents (representing the results of the document and docFO functions) are not allowed to change while an expression is being evaluated. In XSLT, these values are required to be stable throughout the entire transformation." My remarks on this paragraph: 1. The use of "for example" in normative text is problematic. Using "for example" suggests that there might be additional items not in the list, to be found elsewhere in the specification. It is preferable to have the complete list in one place with no "for example" clouding it. 2. Searching the specification for "stable" does not turn up any additional items (all other uses of "stable" refer to a characteristic of a sort). So either this paragraph is all there is to say on the subject, or the reader is left to guess what else must be stable. 3. Assuming that this is the definitive statement, how does one interpret it? The problem is the antecedent of the last sentence ("these values"). Does "these values" refer back to the first sentence ("certain aspects of the dynamic context are stable during the evaluation of an expression") or does it refer to the second sentence ("For example, ..."). If "these values" refers to the first sentence, then one can conclude that anything that is stable in the XQuery dynamic must also be stable in XSLT. On the other hand, perhaps "these values" only refers to the items in the "for example" list of the second sentence (ie, the paragraph as a whole says that XPath has a particular stability requirement, and XSLT's is a proper subset of XPath's). 4. If the referent of "these values" is the first sentence, then the reader is charged with figuring out which parts of the XPath dynamic context are required to be stable. XPath itself does not provide such a list. It should not be the reader's task to engage in interpreting the XPath spec like this. 5. So I looked at the XPath dynamic context to try to figure out what XSLT meant. Here is my analysis: context item, position, size: change dynamically during XPath evaluation, and cannot be expected to be stable during an XSLT evaluation. variable values: constant during their life. Note that two variables with the same name in different scopes are different variables. I assume that XSLT has the same model. function implementations: Your "for example" list mentions document order (op:node-before and op:node-after), and available documents (fn:doc) explicitly. I assume you would also list op:is-same-node, fn:doc-available and fn:collection as being stable during an XSLT evaluation. It is not clear whether XSLT thinks that all of XQuery F&O should be stable during an XSLT evaluation. Of course, most of F&O has a deterministic specification and would have to be stable anyway. I have not examined the entire list of F&O functions to see if there are any still in doubt. current dateTime and implicit timezone: you list these explicitly. 6. Finally, I offer a proposed resolution. Reword the paragraph as follows: "XPath requires that certain aspects of the dynamic context are stable during the evaluation of an expression, namely, variable values, function implementations, and current dateTime and implicit timezone. In XSLT, these values are required to be stable throughout the entire transformation. This implies that the document order of nodes, and the set of available documents (representing the results of the document and docFO functions) are not allowed to change while an expression is being evaluated."
I think the reason the text is worded as it is is to avoid having two normative statements, one in XSLT and one in XPath, that could conflict if the specs get out of sync. By saying: XPath requires that certain aspects of the dynamic context are stable during the evaluation of an expression. For example, the current date and time, ... we are saying: go and read the XPath spec if you want the definitive list of things that are defined to be stable; but if you're in a hurry, these are the sort of things we're talking about. Regarding your point 4, I think it's very important that we *do* send readers to the place where something is defined normatively, rather than having normative statements in several specs that could potentially conflict. The antecedent of "these values" is "the aspects of the dynamic context that XPath requires to be stable". I would have thought that the use of "For example" at the start of the second sentence made this fairly clear. The real meat of your comment, I think, is that XPath does not in fact contain the definition we are referring to. It doesn't say that current-date-and-time is stable, or that available documents is stable. I thought it did, and I'm surprised by the omission. In fact, it seems in most cases to be F+O that says these things are stable (by virtue of the fact that the functions providing access to these parts of the dynamic context give stable results). It's a bit convoluted for us to refer to F+O for this information, so we'll have to take a joint look at it to see how to handle it editorially.
I agree that it is better not to define something normatively twice, so if you can get a statement in XPath 2.0 about what its stability requirements are, great. I assume that then you could and would put an explicit hot link or citation in XSLT 2.0 referring the reader to the normative text in XPath 2.0. This leaves the problem of the antecedent for "these values". I still think the third sentence that I cited is ambiguous, meaning either "the subset of XPath features that were explicitly called out in the second sentence is required to be stable during XSLT evaluation" or "all values that XPath requires to be stable, both those listed and those not listed in the second sentence, must be stable during an entire XSLT execution". Since you mean the latter, could you just humor me and change the last sentence to absolutely nail this down, even if you personally don't see a problem? Something like "All values that XPath 2.0 requires to be stable during an XPath evaluation are required to be stable during an XSLT 2.0 evaluation."
Following discussion within XSL WG, I propose to replace the paragraph: XPath requires that certain aspects of the dynamic context are stable during the evaluation of an expression. For example, the current date and time, the implicit timezone, the document order of nodes, and the set of available documents (representing the results of the document and docFO functions) are not allowed to change while an expression is being evaluated. In XSLT, these values are required to be stable throughout the entire transformation. with: A number of functions specified in [F+O] are defined to be *stable*, meaning that if they are called twice during the same *execution scope*, with the same arguments, then they return the same results (see F+O section 1.7]. In XSLT, the execution of a stylesheet defines the execution scope. This means, for example, that if the function current-dateTime is called repeatedly during a transformation, it produces the same result each time. By implication, the components of the dynamic context on which these functions depend are also stable for the duration of the transformation. Specifically, the following components defined in [XPath section 2.1.2] must be stable: function implementations, current dateTime, implicit timezone, available documents, available collections, and default collections. The values of global variables and stylesheet parameters are also stable for the duration of a transformation. The focus is *not* stable; the additional dynamic context components defined in [XSLT section 5.4.4] are also *not* stable. I am publishing this proposed text here for review both by the original commenter and by the XSL WG. I'm also marking the bug as fixed: if there is any problem with this resolution, please reopen it.
The XSL WG agreed to the proposed text so the bug is now closed. Michael Kay for the XSL WG