Hi All,
I'm stumped on this one. I'm attempting to duplicate this xml but with
the <days> sorted by @sortID for each <DeliveryMethod>. The first
sorting of <days> for the first <DeliveryMethod> works as it should
however <days> for the second <DeliveryMethod> are not output. I've
tried various methods but cannot get the second grouping to output. Any
suggestions:
----Sample XML-----
<CustomerDeliveryDays>
<DeliveryDays Calculate="1" TimeOffset="0" MaxDaysOut="7">
<DeliveryMethod Type="1" Desc="Standard (Truck)">
<Day OrderDate="0" DayIndex="4"
DeliveryTime="00:00" DeliveryDescription="" DeliveryDate="2/26/2003
12:00:00 AM" DateDifference="0" SortID="111"/>
<Day OrderDate="0" DayIndex="2"
DeliveryTime="00:00" DeliveryDescription="" DeliveryDate="2/24/2003
12:00:00 AM" DateDifference="0" SortID="63"/>
</DeliveryMethod>
<DeliveryMethod Type="2" Desc="Will Call / Pickup "/>
<Day OrderDate="0" DayIndex="4"
DeliveryTime="00:00" DeliveryDescription="" DeliveryDate="2/26/2003
12:b00:00 AM" DateDifference="0" SortID="111"/>
<Day OrderDate="0" DayIndex="2"
DeliveryTime="00:00" DeliveryDescription="" DeliveryDate="2/24/2003
12:00:00 AM" DateDifference="0" SortID="63"/>
</DeliveryDays>
</CustomerDeliveryDays>
----XSL----
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<CustomerDeliveryDays>
<xsl:apply-templates
select="CustomerDeliveryDays/DeliveryDays"/>
</CustomerDeliveryDays>
</xsl:template>
<xsl:template match="CustomerDeliveryDays/DeliveryDays">
<DeliveryDays>
<xsl:call-template name="AddAllAttributes" />
<xsl:for-each select="DeliveryMethod">
<DeliveryMethod>
<xsl:call-template
name="AddAllAttributes" />
<xsl:call-template
name="GetDays" />
</DeliveryMethod>
</xsl:for-each>
</DeliveryDays>
</xsl:template>
<xsl:template name="GetDays">
<xsl:for-each select="Day">
<xsl:sort select="@sortID" order="ascending"/>
<Day>
<xsl:call-template
name="AddAllAttributes" />
</Day>
</xsl:for-each>
</xsl:template>
<xsl:template name="AddAllAttributes">
<xsl:for-each select="@*">
<xsl:attribute name="{name(.)}"><xsl:value-of
select="."/></xsl:attribute>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks in advance,
Chris Restall
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list