Re: [xsl] question about identity transform

Subject: Re: [xsl] question about identity transform
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Tue, 31 Oct 2006 15:20:35 -0800
I think this has been discussed quite often in this list and should
probably be well-reflected in the FAQ.

A node-set is a set.

A set, by definition, is unordered.

Therefore, it doesn't matter whether an XPath expression is written as:

A | B

or

B | A


the result is the same set.



-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play




On 10/31/06, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
Dimitre Novatchev wrote:
>> If you would refers it, and make it, say: ` node ( ) | @* ' the nodes
>> would first be copied, resulting in the attributes ending up illegally:
>> you may not create an attribute node after you create an element node in
>> the result tree. However, I'm not sure if this is really enforced by the
>> specs.
>
>
> This is not true.
>
> The order in which an <xsl:apply-templates> instruction is applied on
> the nodes selected by the expression as specified in its select
> attribute is not defined and may be in any order.

Thanks for pointing that out. Indeed, I always forget about this
processing order, and tend to think in terms of result tree order...

>
> What is important, is that the results of these applications are
> combined/ordered based on the document order of the processed nodes.

I see. Meaning that though it can be processes in any order, the actual
order of the output is determined by a certain set of rules, which is
based on the original document order and not the order of the xpath in
the template or the template itself. And I was always so careful putting
the right order for the " | " unioned items ;-)

-- Abel

Current Thread