[Home] [By Thread] [By Date] [Recent Entries]
Sorry about that. Please try this stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/Root">
<Root>
<xsl:for-each select="Item">
<xsl:sort select="Line_No" data-type="number" />
<New_Item>
<xsl:variable name="x" select="substring(Line_No, 1,
1)" /> <xsl:variable name="pow_result">
<xsl:call-template name="pow">
<xsl:with-param name="m" select="10" />
<xsl:with-param name="n" select="string-length(Line_No) - 1" />
<xsl:with-param name="result" select="10" />
</xsl:call-template>
</xsl:variable>
<Line_No><xsl:value-of select=" ($x * $pow_result) +
count(preceding::Line_No[substring(., 1, 1) = $x] )+ 1" /></Line_No>
<Line_No_Og><xsl:value-of select=" Line_No" /></Line_No_Og>
<Amount><xsl:value-of select="Amount" /></Amount>
</New_Item>
</xsl:for-each>
</Root>
</xsl:template> <!-- Template to calculate m to the power n -->
<xsl:template name="pow">
<xsl:param name="m" />
<xsl:param name="n" />
<xsl:param name="result" /> <xsl:choose>
<xsl:when test="$n > 1">
<xsl:call-template name="pow">
<xsl:with-param name="m" select="$m" />
<xsl:with-param name="n" select="$n - 1" />
<xsl:with-param name="result" select="$result * $m" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result" />
</xsl:otherwise>
</xsl:choose>
</xsl:template></xsl:stylesheet> Regards, Mukul On 6/23/06, rostom aghanian <rostom@xxxxxxxx> wrote: Thanks Gandi. I tried your stylesheet and it is very good with just one problem: I need the renumbering to begin only for each 100th group; not each 10th group as your stylesheet does. For example:
|

Cart



