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

Subject: RE: [xsl] Can I predict the build order of nodes?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 14 Feb 2010 22:55:03 -0000
The specification is clear that if two nodes are in different documents,
their relative position in document order is implementation-dependent.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 
 

> -----Original Message-----
> From: Kevin Brown [mailto:kevin@xxxxxxxxxxx] 
> Sent: 14 February 2010 18:51
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Can I predict the build order of nodes?
> 
> 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