Order of nodes in a union

Subject: Order of nodes in a union
From: Nick Browne <NickBrowne@xxxxxxxxxxxxxxx>
Date: Fri, 30 Jun 2000 11:59:17 +0100
I have a union of two node sets which orders the elements in document
order. However, I had expected to see the first set in the union first,
followed by the second set, for example :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >
 <xsl:template match="/">
  <dummy>
 <xsl:variable name="P" select="//Purchase"/>
 <xsl:variable name="Q" select="//Quantity"/>
 <xsl:variable name="values" select="$P | $Q"/>
  <xsl:for-each select="$values">
   <xsl:value-of select="name()"/>
  </xsl:for-each>
 </dummy>
 </xsl:template>
</xsl:stylesheet>

with :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<Root>
 <Range Number="1" Total="15.00">
  <Purchase>3.00</Purchase>
  <Quantity>5</Quantity>
 </Range>
 <Range Number="2" Total="17.50">
  <Purchase>2.50</Purchase>
  <Quantity>7</Quantity>
 </Range>
 <Range Number="3" Total="13.50">
  <Purchase>4.50</Purchase>
  <Quantity>3</Quantity>
 </Range>
</Root>

This displayed :

'PurchaseQuantityPurchaseQuantityPurchaseQuantity'

whereas I had expected to see the 3 Purchase elements followed by the 3
Quantity elements.

Is this normal behaviour for the union operator, I couldn't see anything
in the spec that indicated what ordering should be used ? This was run
on Oracle v2.0.2.8.

--
Nick Browne
Slipstone Ltd


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


Current Thread