[xsl] Can I predict the build order of nodes?

Subject: [xsl] Can I predict the build order of nodes?
From: "Kevin Brown" <kevin@xxxxxxxxxxx>
Date: Sun, 14 Feb 2010 10:50:47 -0800
I noticed an interesting build order/selection issue between Saxon and
Microsoft XSL transforms ... in my style sheet I have:

<xsl:param name="stylemasterfile">
     <xsl:value-of select="/winelist/stylemasterfile"/>
</xsl:param>

<xsl:param name="stylemasterset" select="document($stylemasterfile)/styles |
/winelist/styles"/>

<xsl:variable name="stylemaster" select="$stylemasterset[last()]"/>

The XML may have:

1) a file pointer (in /winelist/stylemasterfile) which contains <styles>
2) an embedded <styles> (at /winelist/styles)
3) both

If it contains both, the rule should be to select the embedded one. 

But selecting $stylemasterset[last()] and testing I noted that they are in
opposite order on the two XSLT transformers when both exist.

Without saying which is which ... what is the right answer? What do you
think is the proper result of this:

document($stylemasterfile)/styles | /winelist/styles

Internal styles from /winelist/styles
External styles from document($stylemaster)/styles

or

External styles from document($stylemaster)/styles
Internal styles from /winelist/styles

Or does the spec make no determination of order?

Kevin Brown
RenderX

Current Thread