This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Sort list based on matching equal to another element
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Sort list based on matching equal to another element
- From: Linda Zammit <binky_35 at yahoo dot ca>
- Date: Thu, 27 Sep 2001 08:36:00 -0400 (EDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
The list I have displays the LOCATION_NAME sorted by
LOCATION_NAME & START_TIME.
I need the COST to display in the next table cell, by
matching the SHIPMENT_GID from the REPORT_CUSTOMER
element to the REPORT_COST element.
This is what I have for the list of the SHIPMENT_GID
from the REPORT_CUSTOMER - which works great but I
can't figure out how to display the associated cost
for the matching SHIPMENT_GID.
<xsl:key name="records-by-party"
match="REPORT_CUSTOMER/ROW" use="LOCATION_NAME"/>
<xsl:for-each select="REPORT_CUSTOMER/ROW[count(.
| key('records-by-party', LOCATION_NAME)[1]) = 1]">
<hr/>
<xsl:sort select="LOCATION_NAME" />
<br />
<xsl:for-each select="key('records-by-party',
LOCATION_NAME)">
<xsl:sort select="START_TIME" />
<xsl:value-of select="SHIPMENT_GID" /><br />
</xsl:for-each>
</xsl:for-each>
Sample XML:
<REPORT>
<REPORT_COST>
<ROW>
<SHIPMENT_GID>123</SHIPMENT_GID>
</ROW>
<ROW>
<COST>100.00</COST> <---- HOW DO I GET
THIS AMOUNT IN THE NEXT LIST?
</ROW>
</REPORT_COST>
<REPORT_CUSTOMER>
<ROW>
<SHIPMENT_GID>123</SHIPMENT_GID>
</ROW>
<ROW>
<LOCATION_NAME>SAM'S PLACE</LOCATION_NAME>
</ROW>
</REPORT_CUSTOMER>
</REPORT>
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list