Subject: RE: [xsl] sorting by date From: "Daniel Newman" <daniel.newman@xxxxxxxxxxx> Date: Tue, 24 Jul 2001 14:47:54 +0100 |
hmmm, for some reason it hasn't worked. I've tried testing to see what the xsl:sort is actually producing, and it doesn't seem to make a difference to the order? Here's a bit more of my XSL: <xsl:apply-templates select="RetrieveTransactionHistory2RSResponse"> <xsl:sort select="concat(substring(Items/Item/Date,5,4),substring(Items/Item/Date,3,2) ,substring(Items/Item/Date,1,2))" order="descending" data-type="number" /> </xsl:apply-templates> <xsl:template match="RetrieveTransactionHistory2RSResponse"> <xsl:variable name="ClassCode" select="Items/Item[1]/ClassCode" /> <xsl:call-template name="ShowRunningBalance"> <xsl:with-param name="ThisRecord" select="1" /> <xsl:with-param name="MaxRecord" select="NoOfItems" /> <xsl:with-param name="CurrentBalance" select="/Shareholder_Information/HoldingInformation2Response/Items/Item[clas s_code = $ClassCode]/Holding" /> </xsl:call-template> </xsl:template> <xsl:template name="ShowRunningBalance"> <xsl:param name="ThisRecord" /> <xsl:param name="MaxRecord" /> <xsl:param name="CurrentBalance" /> <xsl:variable name="TestValue" select="Items/Item[position()=$ThisRecord]/UnitsTraded" /> <xsl:variable name="UnitsTraded"> <xsl:choose> <xsl:when test="$TestValue != 0"> <xsl:value-of select="$TestValue" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="Items/Item[position()=$ThisRecord]/MoneyTrade" /> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="$ThisRecord <= $MaxRecord"> <tr valign="top"> <xsl:call-template name="GenerateRowColor"> <xsl:with-param name="Index" select="$ThisRecord + 1" /> </xsl:call-template> <td width="10%"> <xsl:variable name="ThisDate" select="Items/Item[position()=$ThisRecord]/Date" /> <xsl:value-of select="concat(substring($ThisDate, 1, 2), '/', substring($ThisDate, 3, 2), '/', substring($ThisDate, 5))" /> </td> <td width="50%" nowrap="nowrap"> <xsl:value-of select="Items/Item[position()=$ThisRecord]/Description" /> </td> <td align="right" width="15%"> <xsl:call-template name="PlusOrMinus"> <xsl:with-param name="ThisNumber" select="$UnitsTraded" /> </xsl:call-template> <xsl:value-of select="format-number($UnitsTraded, '#,##0')" /> </td> <td align="right" width="15%"> <xsl:call-template name="PlusOrMinus"> <xsl:with-param name="ThisNumber" select="$CurrentBalance" /> </xsl:call-template> <xsl:value-of select="format-number($CurrentBalance, '#,##0')" /> </td> <td bgcolor="{$DisplayCell}"> <img src="/images/shim.gif" border="0" width="20" height="20" /> </td> <td bgcolor="{$AmendCell}"> <img src="/images/shim.gif" border="0" width="20" height="20" /> </td> </tr> <xsl:call-template name="ShowRunningBalance"> <xsl:with-param name="ThisRecord" select="$ThisRecord + 1" /> <xsl:with-param name="MaxRecord" select="$MaxRecord" /> <xsl:with-param name="CurrentBalance" select="$CurrentBalance - $UnitsTraded" /> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:template> I've obviously done this arse around face, as I went with a total (almost) named template design, so i could call each one expicitly when required. The RetrieveTransactionHistory2RSResponse Calls upon ShowRunningBalance, which produces a table row with data from the previous sibling. I still need this call to the template, so I can update the Running Balance. Is it beyound repair, or is there anything that can be done??? Thanks, Daniel. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] sorting by date, David Carlisle | Thread | RE: [xsl] sorting by date, Daniel Newman |
RE: [xsl] accessing xsl with XML DO, Crowers, Steve | Date | RE: [xsl] accessing xsl with XML DO, Chris Bayes |
Month |