The order of selected nodes in a select pattern with OrExpressions?

Subject: The order of selected nodes in a select pattern with OrExpressions?
From: Tyler Baker <tyler@xxxxxxxxxxx>
Date: Sun, 24 Jan 1999 15:52:12 -0500
One thing that does not seem to be clear in the XSL in the XSL draft is
in what order the nodes should be selected in a select expression with
or expressions present.

For example say I have an XML file:

<a>
  <b1>
    a
  </b1>
  <b2>
    b
  </b2>
  <b3>
    c
  </b3>
</a>

What if I have a template:

<xsl:template match=a>
  <xsl:apply-templates select="b3 | b2 | b1">
</xsl:template>

Should the output text be: cba, or should the output text be: abc.

A more general question is: "Is the order of the UnionExpressions more
significant or is the document order of the elements more significant"?

Basically what I am getting at is should an XSL Processor evaluate each
PathExpression in the UnionExpression separately and in the order that
the UnionExpressions are in, or should an XSL Processor recursively
evaluate each subtree expression of each path expression in the union
expression in that order.

Right now I am under the assumption that an XSL Processor should do
something like:

for each path expression in a union expression
  select all nodes which match up with the last subtree expression of
the currently tested path expression

Then filter out any repeatedly selected nodes in the list.

The spec only says that:

"The context of the right hand side expressions is the context of the
left hand side expression. The results of the right hand side
expressions are node sets. The result of the left hand side UnionExpr is
the union of the results of the right hand side expressions."

My understanding here is that you select in the order in which the path
expressions occur and filter out redundantly selected nodes.

Is this the right way to do things or am I barking up the wrong tree
here?

Tyler


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread