[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: The output of evaluating an XSLT transform is the

Subject: Re: The output of evaluating an XSLT transform is the same regardless of the order in which output elements are evaluated. Right?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 15 Apr 2010 19:34:22 -0700
Re:  The output of evaluating an XSLT transform is the
On Mon, Apr 12, 2010 at 10:37 AM, Costello, Roger L. <costello@xxxxxxxxx>
> Hi Folks,
> Is this statement true or false:
> B XSLT elements that produce output can be
> B evaluated in any order.

Notice the last sentence in the quoted text from the XSLT 1.0 Specification;

"<!-- Category: instruction -->
  select = node-set-expression>
  <!-- Content: (xsl:sort*, template) -->

When the result has a known regular structure, it is useful to be able
to specify directly the template for selected nodes. The xsl:for-each
instruction contains a template, which is instantiated for each node
selected by the expression specified by the select attribute. The
select attribute is required. The expression must evaluate to a
node-set. The template is instantiated with the selected node as the
current node, and with a list of all of the selected nodes as the
current node list. The nodes are processed in document order, unless a
sorting specification is present (see [10 Sorting])."

So, in XSLT 1.0 there is order of processing (at least in the case of
<xsl:for-each/>) and it is explicitly specified. We could argue that
such restriction isn't necessary, but this doesn't change the text of
the Spec. I only wonder if an official test case exists to test
conformance to the required order of processing (and could this be
verified at all?).

The XSLT 2.0 Specification is very careful not to define any
processing order for <xsl:for-each/>

However, I don't know what the following text from the XSLT 2.0
Specification means (does it mean that in many cases there is still
prescribed order of processing?):


With XSLT 1.0, the selected nodes were processed in document order.
With XSLT 2.0, XPath expressions that would have been valid under
XPath 1.0 (such as path expressions and union expressions) will return
a sequence of nodes that is already in document order, so backwards
compatibility is maintained."

I personaly find that these texts contradict what we would like a
functional language to be: as independent of any processing order as

> Example: This XSLT produces two outputs:
> B  <xsl:text>Hello</xsl:text>
> B  <xsl:text>World</xsl:text>
> Is this statement true or false:
> B  The output will always be "HelloWorld" regardless
> B  of which <xsl:text> element is evaluated first.
> Is this explanation correct:
> Explanation: the outputs produced by each XSLT element is placed in an
in-memory "result tree." Their position in the result tree depends on the
sequential order of the outputs in the XSLT document. Thus, this XSLT
> B  <xsl:text>World</xsl:text>
> occurs later in the XSLT document and so therefore it is placed later in the
result tree. After the XSLT transform completes executing then the result tree
is serialized to an output file, in document order, which result in "Hello"
first and "World" second.
> /Roger

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.
To invent, you need a good imagination and a pile of junk
Never fight an inanimate object
You've achieved success in your field when you don't know whether what
you're doing is work or play
I enjoy the massacre of ads. This sentence will slaughter ads without
a messy bloodbath.

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.