I have two sort
documents, and in one version I sort numbers (which works fine), and in the
other I am sorting a text value. They are the same, with the exception of the
data-type attribute not being included in the text one. This same code used to
work in earlier version of Xalan (we are using XalanJ
2.4.D1.
Any ideas what is
wrong? Is this a bug?
Thanks,
Cory
-- Numeric sort that
works:
<!--
Output the fw:dataSetData element.-->
<xsl:template match="/">
<fw:dataSetData>
<xsl:apply-templates select="/fw:dataSet/fw:dataSetData"/>
</fw:dataSetData>
</xsl:template>
<xsl:template match="/">
<fw:dataSetData>
<xsl:apply-templates select="/fw:dataSet/fw:dataSetData"/>
</fw:dataSetData>
</xsl:template>
<!-- Loop
each row and sort.-->
<xsl:template match="fw:dataSet/fw:dataSetData">
<xsl:for-each select="./fw:row">
<!-- Place sort elements here.-->
<xsl:sort order="ascending" data-type="number" select="././fw:column[@index='1']" />
<xsl:template match="fw:dataSet/fw:dataSetData">
<xsl:for-each select="./fw:row">
<!-- Place sort elements here.-->
<xsl:sort order="ascending" data-type="number" select="././fw:column[@index='1']" />
<!-- Copy each row.-->
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:template>
<xsl:template match=".|@*|*|text()">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:template>
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:template>
-- Text sort which does not work:
<!--
Output the fw:dataSetData element.-->
<xsl:template match="/">
<fw:dataSetData>
<xsl:apply-templates select="/fw:dataSet/fw:dataSetData"/>
</fw:dataSetData>
</xsl:template>
<xsl:template match="/">
<fw:dataSetData>
<xsl:apply-templates select="/fw:dataSet/fw:dataSetData"/>
</fw:dataSetData>
</xsl:template>
<!-- Loop
each row and sort.-->
<xsl:template match="fw:dataSet/fw:dataSetData">
<xsl:for-each select="./fw:row">
<!-- Place sort elements here.-->
<xsl:sort order="ascending" select="././fw:column[@index='2']" />
<xsl:template match="fw:dataSet/fw:dataSetData">
<xsl:for-each select="./fw:row">
<!-- Place sort elements here.-->
<xsl:sort order="ascending" select="././fw:column[@index='2']" />
<!-- Copy each row.-->
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:template>
<xsl:template match=".|@*|*|text()">
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:template>
<xsl:copy>
<xsl:apply-templates select="@*|*|text()"/>
</xsl:copy>
</xsl:template>
Cory Isaacson
President & CTO
Compuflex International
(818) 884-1168
