Subject: [xsl] 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 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] sending parameters client sid, jon wa | Thread | Re: [xsl] dd mmm yyyy Date converte, Goetz Bock |
Re: [xsl] ANN: Internet-live XML-re, Christopher P. Wang | Date | [xsl] key definition, Steve Renshaw |
Month |