[Bug 2149] [XSLT] what parts of the dynamic context must be stable?

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2149

           Summary: [XSLT] what parts of the dynamic context must be stable?
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: fred.zemke@oracle.com
         QAContact: public-qt-comments@w3.org


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."

Received on Monday, 12 September 2005 18:54:06 UTC