[Bug 2702] [XSLT] terminology for variable/param with 'as' attribute defined

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


mike@saxonica.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CLOSED                      |REOPENED
         Resolution|INVALID                     |




------- Comment #2 from mike@saxonica.com  2006-03-24 22:16 -------
We decided at the XSL WG telcon this week to reopen this.

I'm inclined to agree that there is a problem, and it centres around ambiguous
use of the term "temporary tree". 

In 2.1 we have [Definition: The term result tree is used to refer to any tree
constructed by instructions in the stylesheet. A result tree is either a final
result tree or a temporary tree.]

But 9.3 says: [Definition: If a variable-binding element has no select
attribute and has non-empty content ...[then] a new document (referred to as a
temporary tree) is constructed with a document node having as its children the
sequence of nodes that results from evaluating the sequence constructor and
then applying the rules given in 5.7.1 Constructing Complex Content.] 

These definitions are contradictory. If every tree is either a final result
tree or a temporary tree, then <xsl:variable name="x"
as="element()"><a/></xsl:variable> constructs a temporary tree; but 9.3 says
that temporary trees always have a document node at the root.

To add to the confusion, xsl:document (11.1.5) says: The xsl:document
instruction is used to create a new document node. .... The temporary tree
rooted at this document node forms the result tree.

We actually have three distinct concepts here:

(a) A tree that is not a source tree or a final result tree.

(b) An (a) with a document node at its root.

(c) A (b) that is created by means of an xsl:variable (or other
variable-binding element) with no "as" attribute.

I've scanned the uses of "temporary tree" in the spec, and most of them seem to
apply to concept (a). This is the most natural interpretation of the English
phrase "temporary tree" and I propose that we define and use the term this way.

I propose that we call (b) a "temporary document". Some of the existing
references to "temporary tree" will change to use this term instead.

This leaves the question of what to call (c). "Result tree fragment", anyone?
No, I don't think I can stomach that: the name is completely illogical and the
only merit it has is historical. Because these animals are a subspecies of
"temporary document" I propose that we call them "implicit temporary
documents". This term won't in fact appear very often, mainly around sections
9.3 and 9.4.

Michael Kay

Received on Friday, 24 March 2006 22:16:46 UTC