- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Tue, 22 Jan 2002 22:04:25 +0000
- To: "Nagy, Marton" <MARTON.NAGY@saic.com>
- CC: www-xml-query-comments@w3.org, jmarsh@microsoft.com
Hi Marton, > Thank you for listing some of the factors why document node > permissiveness is necessary. I think one could possibly argue that > temporary trees in XSLT could be represented as sequences containing > nodes and there is no need for a container document node. > Nevertheless we will consider the use cases you listed when > resolving the issue. I agree to a certain extent that temporary trees in XSLT could be represented as sequences containing nodes. However, for backwards compatibility with XSLT 1.0, it is necessary for document nodes to have more than one element node child, and to have text nodes as direct children. This is because in XSLT 1.0, result tree fragments were described as a tree with their own root node. The difference between a variable holding a document node and the same variable holding a sequence has a significant effect on the "string value" of the variable, as well as how you treat that variable when you manipulate it as a node set (which people are used to doing with the various node-set() extension functions). From experience with the node-set() extension functions, it also turns out to be easier to use temporary trees if they have their own document node, for two reasons. Firstly, it is a lot easier to select nodes within the temporary tree if they are the children of the node to which you have a reference, so that you can do: $variable/element rather than doing: $variable[self::element] Secondly, and more importantly, providing a document node provides a document order to the (new) elements in the sequence, which enables you to process groups of those elements through the preceding-sibling and following-sibling axes (given that it is not possible to access the preceding and following items when processing a sequence). An alternative, to retain the backwards compatibility and utility of "root nodes", would be to introduce a new type of 'document fragment' node (using DOM terminology), which would be similar to document nodes, but allow multiple element (and text node) children. Then variable-binding elements in XSLT could create a document fragment node, rather than a document node, and so retain their helpful characteristics without undermining the equivalence between the infoset and the XPath/XQuery data model. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Tuesday, 22 January 2002 17:04:45 UTC