This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

sort question


I'm obviously missing something in reading through the sorting examples
available on many web sites.  All I want to do is obtain the same nodes out
of the transformation, just sorted.  Sort order is only applied to the KH
and Key nodes, the KH nodes sort by the KSort attribute value and within a
KH node, the Key nodes sort by the KeySort value.  No other nodes require
sorting, they should remain in the order they were in originally.  I keep
getting the same nodes in the same order they started with from the
transformation, I am not getting a sort applied.  Could someone enlighten me
as to what I am missing?

XSL:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
	<xsl:template match="/">
		<xsl:apply-templates select="Data/KH">
			<xsl:sort select="@KSort" data-type="text" order="ascending"/>
			<xsl:sort select="Key[@KeySort]" data-type="text" order="ascending"/>
		</xsl:apply-templates>
		<xsl:copy-of select="node()"/>
	</xsl:template>
</xsl:stylesheet>

XML:

<QuoteData>
<QuoteFilter CurrentIndex="0"><DefaultFilter CommodityID="1" ID="1">
<LocID V_1="266" V_2="267" />
<ProdID V_1="72" V_2="69" V_3="73" V_4="71"/>
</DefaultFilter>
</QuoteFilter>
<Data>
<Map schema="2" col0="12" col1="2" col2="2" col3="2" col4="2" >
<MapKey col0="0" col1="2" col2="5"/>
<MapMD col0="0"/>
<MapMy col0="0"/>
</Map>
</Data>
<Data><row ID="69"/><row ID="71"/><row ID="72"/><row ID="73"/><row
ID="74"/><row ID="75"/><row ID="76"/>
</Data>
<Data>
<KH KHID="13" KSort="NE TCO-POOL Basis IF">
<Key KeyID="598" KeySort="NE TCO-POOL 2001-11-01 2001-11-01 Basis IF" >
<MD Depth="1" QID="27984"/></Key>
</KH>
<KH KHID="108" KSort="AWEST SAN-JUAN (PAPER) Basis GD/D">
<Key KeyID="563" KeySort="AWEST SAN-JUAN (PAPER) 2001-04-01 2001-08-01 Basis
GD/D" >
<MD Depth="1" QID="28107"/>
<MD Depth="2" QID="28109"/>
</Key>
<Key KeyID="563" KeySort="AWEST SAN-JUAN (PAPER) 2001-01-01 2001-08-01 Basis
GD/D" >
<MD Depth="1" QID="29107"/>
<MD Depth="2" QID="29103"/>
</Key>
</KH>
</Data>
<Key KeyID="563" ProdID="73">
<My BidID="2879" AskID="2345"/>
</Key>
<Data>
</Data>
</QuoteData>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]