xsl-list
[Top] [All Lists]

Re: Identity Transform

2005-11-07 04:41:30
Hi Christian,

Has this something to do with document traversal order, i.e. while
building the list of selected items using "node()|@*", the attribute
nodes (satisfying the expression) are found first and are therefore
added first to the list of items to be copied, in consequence
satisfying the "attribute-before-children" requirement?

Close. In XSLT 1.0, whenever you process a node-set (using
<xsl:apply-templates> or <xsl:for-each>, for example), those nodes are
processed in *document order*. The attributes of an element always
come before the children of the element, so whether you use
"@*|node()" or "node()|@*", you always copy the attributes first.

In XSLT 2.0 things are slightly different, in that each XPath 2.0
expression generates a sequence of nodes rather than a (by definition,
unordered) set of nodes. However, when you use the union operator ("|"
or "union"), the nodes in the resulting sequence are always sorted
into document order, so again "@*|node()" and "node()|@*" return the
same sequence of nodes.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>