I am having a problem using three <xsl:sort> elements.
In the example below, my output should be like this:
Line 1
Line 2
Line 3
Total for object code:
Grand Total:
Unfortunately, my result is this:
Line 1
Line 2
Total for object code:
Line 3
Total for object code:
Grand Total:
I appreciate any help with this problem. The xml and a portion of the
xsl is below. Thanks.
<?xml version="1.0" encoding="utf-16"?>
<ArrayOfAccountLineItem xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AccountLineItem>
<LineItemName>Downhill Kinderski Class #3</LineItemName>
<RegistrantFullName>Levi Rieth</RegistrantFullName>
<LineItemID>3604</LineItemID>
<PaymentType>Check</PaymentType>
<SettleDate>2003-12-31T22:57:20.0000000-05:00</SettleDate>
<PaymentReference>fedex</PaymentReference>
<Name>Early Bird Discount</Name>
<Amount>-10</Amount>
<GLAccountNumber>P3-325-23114-5501-33181</GLAccountNumber>
<AmountPaid>-10</AmountPaid>
</AccountLineItem>
<AccountLineItem>
<LineItemName>Downhill Kinderski Class #5</LineItemName>
<RegistrantFullName>Grace Schwab</RegistrantFullName>
<LineItemID>3615</LineItemID>
<PaymentType>Check</PaymentType>
<SettleDate>2003-12-31T22:57:25.4700000-05:00</SettleDate>
<PaymentReference>fedex</PaymentReference>
<Name>Early Bird Discount</Name>
<Amount>-10</Amount>
<GLAccountNumber>P3-325-23114-5501-33181</GLAccountNumber>
<AmountPaid>-10</AmountPaid>
</AccountLineItem>
<AccountLineItem>
<LineItemName>Downhill Kinderski Class #3</LineItemName>
<RegistrantFullName>Ike Rieth</RegistrantFullName>
<LineItemID>3605</LineItemID>
<PaymentType>Check</PaymentType>
<SettleDate>2003-12-31T22:57:25.5770000-05:00</SettleDate>
<PaymentReference>fedex</PaymentReference>
<Name>Early Bird Discount</Name>
<Amount>-10</Amount>
<GLAccountNumber>P3-325-23114-5501-33181</GLAccountNumber>
<AmountPaid>-10</AmountPaid>
</AccountLineItem>
<DivisionID>204</DivisionID>
<StartDate>12/01/2003</StartDate>
<EndDate>12/31/2003</EndDate>
</ArrayOfAccountLineItem>
<xsl:template match="ArrayOfAccountLineItem">
<xsl:for-each select="AccountLineItem">
<xsl:sort select="GLAccountNumber" data-type="text"
order="ascending"/>
<xsl:sort select="substring(SettleDate,1,10)"
data-type="text" order="ascending"/>
<xsl:sort select="LineItemID" data-type="number"
order="ascending"/>
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="AccountLineItem">
<tr>
<td class="fieldInfo">
<xsl:value-of
select="substring(LineItemName,1,35)"/>
</td>
<td class="fieldInfo">
<xsl:value-of
select="position()"/>
</td>
<td class="fieldInfo">
<xsl:value-of
select="GLAccountNumber"/>
</td>
<td class="fieldInfo">
<xsl:value-of
select="substring(RegistrantFullName,1,19)"/>
</td>
<td class="fieldInfo">
<xsl:value-of
select="concat(substring(SettleDate,6,2), '/',
substring(SettleDate,9,2), '/', substring(SettleDate,1,4))"/>
</td>
<td align="right" class="fieldInfo">
<xsl:value-of
select="LineItemID"/>
</td>
<td class="fieldInfo" align="right">
<xsl:choose>
<xsl:when test="Amount
> 0">
<xsl:value-of
select="format-number(Amount, '#.00')"/>
</xsl:when>
<xsl:otherwise>
 
</xsl:otherwise>
</xsl:choose>
</td>
<td>
 
</td>
<td align="right" class="fieldInfo"
style="padding-right: 5px;">
<xsl:choose>
<xsl:when test="Amount
< 0">
<xsl:value-of
select="translate(format-number(Amount, '#.00'), '-', '')"/>
</xsl:when>
<xsl:otherwise>
 
</xsl:otherwise>
</xsl:choose>
</td>
<td class="fieldInfo">
<xsl:value-of
select="substring(PaymentType,1,12)"/>
</td>
<td class="fieldInfo">
<xsl:value-of
select="substring(PaymentReference,1,15)"/>
</td>
</tr>
<xsl:if test="not(GLAccountNumber =
following::GLAccountNumber)">
<tr>
<td colspan="9">
 
</td>
</tr>
<tr>
<td colspan="4">
 
</td>
<td colspan="2"
class="fieldName" align="center">
Total by
Object Code:
</td>
<td
class="bottomFieldInfo" align="right">
<xsl:value-of select="format-number(sum(key('subTotal',
GLAccountNumber)/Amount[. > 0]), '#.00')"/>
</td>
<td>
 
</td>
<td
class="bottomFieldInfo" align="right" style="padding-right:5px">
<xsl:value-of select="translate(format-number(sum(key('subTotal',
GLAccountNumber)/Amount[. < 0]), '#.00'), '-', '')"/>
</td>
<td>
 
</td>
</tr>
<tr>
<td colspan="8">
 
</td>
</tr>
</xsl:if>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list