Is this statement true or false:
XSLT elements that produce output can be
evaluated in any order.
Well, your terminology is wrong. I guess you are referring to XSLT
instructions; they don't "produce output", they are evaluated to return a
result value.
It's true that if two instructions are independent (neither takes the output
of the other as its input) then they can be evaluated in either order.
Example: This XSLT produces two outputs:
<xsl:text>Hello</xsl:text>
<xsl:text>World</xsl:text>
Is this statement true or false:
The output will always be "HelloWorld" regardless
of which <xsl:text> element is evaluated first.
You have shown two instructions, each of which produces a text node. The
result is two text nodes, not a single string as you have shown. So your
statement is false. However, in many contexts (for example, if the two
xsl:text instructions are children of an xsl:element instruction), the
effect will be the same as if the value were the single string "HelloWorld".
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 element:
No, this is not the way the semantics are defined. If you write
<xsl:element name="x">
<xsl:text>Hello</xsl:text>
<xsl:text>World</xsl:text>
</xsl:element>
Then the semantics are defined in section 5.7.1
http://www.w3.org/TR/xslt20/#constructing-complex-content
which in turn refers to 5.7
http://www.w3.org/TR/xslt20/#dt-sequence-constructor
The two xsl:text instructions form a sequence constructor, which is
evaluated to form a sequence of text nodes; the reason the two instructions
can be evaluated in either order is because there is nothing in the
semantics that changes the result depending on the order of execution.
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
--~------------------------------------------------------------------
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>
--~--