|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] dd mmm yyyy Date converted to number - attempt to sort
I have a list of items which contain a date in the format dd mmm yyyy. I
want to sort these entries by date. To do so I have used the following
code:
<xsl:variable name="FORMATTER" select="java:java.text.SimpleDateFormat.new("dd MMM yyyy")"/>
<xsl:variable name="NUMBER_FORMATTER" select="java:java.text.DecimalFormat.new("00000000000000")"/>
.......................
.......................
<xsl:for-each select="CashSettlementFlow">
<xsl:variable name="SETTLEMENT_DATE" select="string(dateAdjusted)"/>
<xsl:variable name="SETTLEMENT_JAVA_DATE" select="java:parse($FORMATTER,$SETTLEMENT_DATE)"/>
<xsl:variable name="SETTLEMENT_JAVA_TIME" select="java:getTime($SETTLEMENT_JAVA_DATE)"/>
<xsl:variable name="SETTLEMENT_PADDED_NUMBER" select="java:format($NUMBER_FORMATTER,$SETTLEMENT_JAVA_TIME)"/>
<!-- <xsl:sort select="*[name()=$SETTLEMENT_PADDED_NUMBER]"/> -->
<xsl:sort select="$SETTLEMENT_PADDED_NUMBER"/>
As can be seen I first convert the date into a number and it is this number which I want to sort on (this is within a transform which creates HTML
output for display).
This produces the error:
XSL Error: pattern = '$SETTLEMENT_PADDED_NUMBER'
VariableReference given for variable out of context or without definition! Name = SETTLEMENT_PADDED_NUMBER, source tree node: CashSettlementFlow
XSL Error: SAX Exception
Exception in thread "main" org.apache.xalan.xslt.XSLProcessorException: pattern = '$SETTLEMENT_PADDED_NUMBER'
VariableReference given for variable out of context or without definition! Name = SETTLEMENT_PADDED_NUMBER
Can anyone advise how I can utilise the variable in the sort function?
This e-mail message is CONFIDENTIAL and may contain legally privileged
information. If you are not the intended recipient you should not read,
copy, distribute, disclose or otherwise use the information in this e-mail.
Please also telephone or fax us immediately and delete the message from
your system. E-mail may be susceptible to data corruption, interception
and unauthorised amendment, and we do not accept liability for any such
corruption, interception or amendment or the consequences thereof.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








