[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: sorting by date

Subject: RE: sorting by date
From: "Daniel Newman" <daniel.newman@xxxxxxxxxxx>
Date: Tue, 24 Jul 2001 14:47:54 +0100
daniel newman right
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 &lt;= $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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.