Hi
I’m using Xalan and trying to sort blocks of element
but without success.
I’m trying to sort each block of NetPrice
element by the attribute NetAmount.
In each ProductOption, I have
multiple NetPrice element
Check my example below.
Thanks for your help
Stephane
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template
match="/GetProductOptionsResponse/DetailedProduct/ProductOptionGroup/ProductOption">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort data-type="number"
select="NetPrice/@netAmount" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<GetProductOptionsResponse
xmlns="http://www.org/TRIP2004A/01";>
<Header
language="en" version="5.1.0"/>
<DetailedProduct
availabilityStatus="available">
<ProductOptionGroup
description="OPTION GROUP
1">
<ProductOption
description="option A">
<NetPrice currency="EUR" netAmount="2.27"
priceReferenceID="HTLAVO13XAAX" quantity="1"/>
<NetPrice
currency="EUR" netAmount="-45.09"
priceReferenceID="HTLAVO13XAAX" quantity="1"/>
<TravelerPrice age="10" travelerId="003">
<PriceSummary baseAmount="0.00"/>
</TravelerPrice>
</ProductOption>
<ProductOption description="option B">
<NetPrice
currency="EUR" netAmount="222.27"
priceReferenceID="HTLAVO13XAAX" quantity="1"/>
<NetPrice
currency="EUR" netAmount="45.09"
priceReferenceID="HTLAVO13XAAX" quantity="1"/>
<TravelerPrice age="10" travelerId="003">
<PriceSummary baseAmount="0.00"/>
</TravelerPrice>
</ProductOption>
</ProductOptionGroup>
<ProductOptionGroup description="OPTION GROUP
2">
<ProductOption
description="option Z">
<NetPrice currency="EUR" netAmount="5.55"
priceReferenceID="BHTLAVO13XAAX" quantity="1"/>
<NetPrice currency="EUR" netAmount="-145.09"
priceReferenceID="BHTLAVO13XAAX" quantity="1"/>
<TravelerPrice
age="99" travelerId="001">
<PriceSummary baseAmount="1.00"/>
</TravelerPrice>
</ProductOption>
</ProductOptionGroup>
</DetailedProduct>
</GetProductOptionsResponse>