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 2702 - [XSLT] terminology for variable/param with 'as' attribute defined
Summary: [XSLT] terminology for variable/param with 'as' attribute defined
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
Hardware: All All
: 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-01-11 18:53 UTC by Joanne Tong
Modified: 2006-05-02 21:47 UTC (History)
0 users

See Also:


Attachments

Description Joanne Tong 2006-01-11 18:53:23 UTC
A temporary tree refers to 
	"an xsl:variable, xsl:param, or xsl:with-param element that has non-
empty content and that has no as attribute"
A source tree 
	"means any tree provided as input to that instruction; this may be a 
source tree of the transformation as a whole, or it may be a temporary tree 
produced during the course of the transformation."
A result tree is
	"either a final result tree or a temporary tree." where a final result 
tree "is a result tree that forms part of the final output of a transformation"
Since the result produced by an xsl:variable, xsl:param, or xsl:with-param 
element that has an 'as' attribute is neither a temporary tree, a source tree, 
nor a result tree, what is the correct terminology in this case?  It is 
clearly the intention of the working group that such a node bound to this 
variable/param can be used in a path expression.  However, based on current 
definitions of different types of trees, this does not seem to be true.
Comment 1 Joanne Tong 2006-03-14 21:46:22 UTC
I am withdrawing this comment.
Comment 2 Michael Kay 2006-03-24 22:16:37 UTC
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
Comment 3 Michael Kay 2006-04-19 13:37:34 UTC
We agreed to use the term "temporary tree" in the most general sense (that is, meaning (a) in comment #2) and I was asked to make proposals for dealing with text that uses the term differently - preferably without introducing new technical terms if possible. This proposal attempts to do that.

I've been through all uses of the term "temporary tree". Where the text doesn't need to change, or where the only change is to remove a reference to section 9.4, I have said nothing.

2.1 Add the definition "A temporary tree is a tree that is neither a source tree nor a result tree". All termrefs from "temporary tree" will now point here.

9.3 <old>[Definition: If a variable-binding element has no select attribute and has non-empty content (that is, the variable-binding element has one or more child nodes), and has no as attribute, then the content of the variable-binding element specifies the supplied value. The content of the variable-binding element is a sequence constructor; 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.] The value of the variable is then a singleton sequence containing this document node. Temporary trees are described in more detail in 9.4 Temporary Trees.</old>

Change this as follows: (a) make it no longer a definition. (b) delete "(referred to as a temporary tree)". (c) Replace "Temporary trees are described in more detail in 9.4 Temporary Trees." by "See also 9.4 Creating implicit document nodes".

9.3, table, row 8 column 4, current text "Value is a temporary tree", change to "Value is a document node whose content is obtained by evaluating the sequence constructor"

9.3, Example 4: delete "(that is, a temporary tree)".

9.4 Temporary trees: change the section heading to "Creating implicit document nodes". Change 

<old>A temporary tree is constructed by evaluating an xsl:variable, xsl:param, or xsl:with-param element that has non-empty content and that has no as attribute. This element is referred to as the variable-binding element. The value of the variable is a single node, the document node of the temporary tree. This document node is created implicitly, and its content is formed from the result of evaluating the sequence constructor contained within the variable-binding element, as described in 5.7.1 Constructing Complex Content.</old>

to

<new>A document node is constructed implicitly when evaluating an xsl:variable, xsl:param, or xsl:with-param element that has non-empty content and that has no as attribute. This element is referred to as the variable-binding element. The value of the variable is a single node, the document node at the root of a temporary tree. The content of the document node is formed from the result of evaluating the sequence constructor contained within the variable-binding element, as described in 5.7.1 Constructing Complex Content.</new> 

In the para after the first note ("The base URI...") delete "at the root of a temporary tree".

In the para above the example, change "Also, the key and idFO functions can be used to find nodes within a temporary tree." to "Also, the key and idFO functions can be used to find nodes within a temporary tree, provided that its root is a document node."

In 19.2.2, change "Validation is not applied to temporary trees unless the document node is constructed using an xsl:document instruction." to "Document-level validation is not applied to the document node that is created implicitly when a variable-binding element has no select attribute or as attribute (see 9.4)."
Comment 4 Michael Kay 2006-04-27 19:48:18 UTC
The WG today agreed the proposal in comment #3, which has now been implemented.