[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

Subject: dd mmm yyyy Date converted to number - attempt to sort using variable -unable to do so
From: mark.clare@xxxxxxxxxxxx
Date: Sun, 28 Oct 2001 11:33:31 +0000
java sort date
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(&quot;dd MMM yyyy&quot;)"/>
  <xsl:variable name="NUMBER_FORMATTER" select="java:java.text.DecimalFormat.new(&quot;00000000000000&quot;)"/>

.......................
.......................

 <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


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.