W3C home > Mailing lists > Public > www-xsl-fo@w3.org > November 2008

Re: Regular Expression's Jungle

From: sonika_nitj <sonika.janagill@patni.com>
Date: Thu, 6 Nov 2008 22:34:32 -0800 (PST)
Message-ID: <20375430.post@talk.nabble.com>
To: www-xsl-fo@w3.org

I have also faced same problem.
See what I have used for formatting a date from one format to other:
        <xsl:variable name="formattedIssueDate" 
HH:mm:ss.SSS' ), //IssueDate)" />
select="java:format(java:java.text.SimpleDateFormat.new('MM/dd/yyyy' ),
$formattedIssueDate)" />

What you have to do is the following:
        <xsl:variable name="formattedIssueDate" 
select="java:parse(java:java.text.SimpleDateFormat.new('MM/dd/yyyy' ),
//IssueDate)" />
select="java:format(java:java.text.SimpleDateFormat.new('MM-dd-yyyy' ),
$formattedIssueDate)" />

Note that the Date format you provide in SimpleDateFormat constructor should
be a proper date format.
And the java namespace should be added to your style sheet
 as follows:
<xsl:stylesheet version="1.1"


saqi wrote:
> Hello,
> I want to add some regular expression; when i get some data in any other
> format just convert it to my own. like if i have a date like 02/23/2008
> then
> convert it to 02-23-2008. i have surfed the web but cannot find any simple
> example that can fit in. I found many complex examples all the way, which
> just passed over me...lolz. Is there any simple example available or help
> through which i can understand the basic working of regex, and can define
> my
> own regular expressions.
> Thanks
> Regards,
> Saqib Javed

View this message in context: http://www.nabble.com/Regular-Expression%27s-Jungle-tp20375265p20375430.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Friday, 7 November 2008 06:35:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:32 UTC