You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Sathasivam, Elayaraja" <el...@capgemini.com> on 2008/08/06 06:26:55 UTC

RE: Xalan-C / XSL 1.0 : Curent date

Any XSL example without using ICU  ?

_________________________________________________________________

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Tuesday, July 29, 2008 7:57 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan-C / XSL 1.0 : Curent date

Sathasivam, Elayaraja wrote:
> I would like to print the current date with the format ('E yyyy MM
> dd hh:mm:ss' ) by using xsl 1.0. I am new to Xalan-C. I have worked
> only with Xalan-J.
> 
> Any thing similar as below in Xalan-C ????????
No, Xalan-C has no facility for date formatting.  You will need to 
format the date, then pass it into the stylesheet as a parameter.  Or, 
you can write an extension function that you can call in your
stylesheet.

The ICU (International Components for Unicode) has support for date 
formatting which is like the Java functionality you're using in Xalan-J.

Dave

Re: Xalan-C / XSL 1.0 : Curent date

Posted by David Bertoni <db...@apache.org>.
Coker, Jonathan M wrote:
> First, to the poster, please take a look at
> http://geekswithblogs.net/workdog/archive/2007/02/08/105858.aspx and see
> if this helps.
> 
> This thread actually brings up a point I thought I understood, but I am
> no longer sure. 
> If I create an XSLT stylesheet to transfrom XML and want to use Xalan-C,
> would another developer coding in Java using Xalan-J have to create a
> different stylesheet even if we are both acting on the same data and
> want the same transformed output?  I thought that XSLT was language
> independent.  
It is, as long as you don't use processor-specific extensions, like 
using Java function calls in your stylesheet, which is what the OP is doing.

Dave

RE: Xalan-C / XSL 1.0 : Curent date

Posted by "Coker, Jonathan M" <jo...@boeing.com>.
First, to the poster, please take a look at
http://geekswithblogs.net/workdog/archive/2007/02/08/105858.aspx and see
if this helps.

This thread actually brings up a point I thought I understood, but I am
no longer sure. 
If I create an XSLT stylesheet to transfrom XML and want to use Xalan-C,
would another developer coding in Java using Xalan-J have to create a
different stylesheet even if we are both acting on the same data and
want the same transformed output?  I thought that XSLT was language
independent.  

Thank you


-----Original Message-----
From: Sathasivam, Elayaraja [mailto:elayaraja.sathasivam@capgemini.com] 
Sent: Tuesday, August 05, 2008 11:27 PM
To: xalan-c-users@xml.apache.org
Subject: RE: Xalan-C / XSL 1.0 : Curent date


Any XSL example without using ICU  ?

_________________________________________________________________

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org]
Sent: Tuesday, July 29, 2008 7:57 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan-C / XSL 1.0 : Curent date

Sathasivam, Elayaraja wrote:
> I would like to print the current date with the format ('E yyyy MM dd 
> hh:mm:ss' ) by using xsl 1.0. I am new to Xalan-C. I have worked only 
> with Xalan-J.
> 
> Any thing similar as below in Xalan-C ????????
No, Xalan-C has no facility for date formatting.  You will need to
format the date, then pass it into the stylesheet as a parameter.  Or,
you can write an extension function that you can call in your
stylesheet.

The ICU (International Components for Unicode) has support for date
formatting which is like the Java functionality you're using in Xalan-J.

Dave

RE: Xalan-C / XSL 1.0 : Curent date

Posted by "Sathasivam, Elayaraja" <el...@capgemini.com>.
I have checked from the production server,

No error, no warning message.. i am not sure whether ICU support is
enabled or not.. in my xslt processor.
Xalan-C_1_8_0-windows_2000-msvc_60 /xerces-c_2_5_0-windows_nt-msvc_60  


XSL
<xsl:variable name="currentDate" select="date:date-time()"/>

<xsl:variable name="currentDateFormat">
<xsl:call-template name="date:format-date">
	<xsl:with-param name="date-time" select="$currentDate"/>
	<xsl:with-param name="pattern" select="'MMM dd,yyyy'"/>
</xsl:call-template>
</xsl:variable>

<xsl:variable name="resultTest">
<xsl:call-template name="date:format-date">
	<xsl:with-param name="date-time" select="2008-08-02"/>
	<xsl:with-param name="pattern" select="'MMM dd,yyyy'"/>
</xsl:call-template>
</xsl:variable>

Date with user input format:<xsl:value-of select="$resultTest"/>

CurrentDate with format:<xsl:value-of select="$currentDateFormat"/>

Output:

Date with user input format:Jan 01,1998 <Output is not correct>
CurrentDate with format: <No output>


Any other alternative solution available, such as using extension
function... example ?


-----Original Message-----
From: Sathasivam, Elayaraja Sent: Wednesday, August 06, 2008 9:57 AM
To: xalan-c-users@xml.apache.org
Subject: RE: Xalan-C / XSL 1.0 : Curent date


Any XSL example without using ICU  ?

_________________________________________________________________

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Tuesday, July 29, 2008 7:57 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan-C / XSL 1.0 : Curent date

Sathasivam, Elayaraja wrote:
> I would like to print the current date with the format ('E yyyy MM
> dd hh:mm:ss' ) by using xsl 1.0. I am new to Xalan-C. I have worked
> only with Xalan-J.
> 
> Any thing similar as below in Xalan-C ????????
No, Xalan-C has no facility for date formatting.  You will need to 
format the date, then pass it into the stylesheet as a parameter.  Or, 
you can write an extension function that you can call in your
stylesheet.

The ICU (International Components for Unicode) has support for date 
formatting which is like the Java functionality you're using in Xalan-J.

Dave

RE: Xalan-C / XSL 1.0 : Curent date

Posted by "Sathasivam, Elayaraja" <el...@capgemini.com>.
I have checked from the production server,

No error, no warning message.. i am not sure whether ICU support is
enabled or not.. in my xslt processor.
Xalan-C_1_8_0-windows_2000-msvc_60 /xerces-c_2_5_0-windows_nt-msvc_60  


XSL
<xsl:variable name="currentDate" select="date:date-time()"/>

<xsl:variable name="currentDateFormat">
<xsl:call-template name="date:format-date">
	<xsl:with-param name="date-time" select="$currentDate"/>
	<xsl:with-param name="pattern" select="'MMM dd,yyyy'"/>
</xsl:call-template>
</xsl:variable>

<xsl:variable name="resultTest">
<xsl:call-template name="date:format-date">
	<xsl:with-param name="date-time" select="2008-08-02"/>
	<xsl:with-param name="pattern" select="'MMM dd,yyyy'"/>
</xsl:call-template>
</xsl:variable>

Date with user input format:<xsl:value-of select="$resultTest"/>

CurrentDate with format:<xsl:value-of select="$currentDateFormat"/>

Output:

Date with user input format:Jan 01,1998 <Output is not correct>
CurrentDate with format: <No output>


Any other alternative solution available, such as using extension
function... example ?


-----Original Message-----
From: Sathasivam, Elayaraja Sent: Wednesday, August 06, 2008 9:57 AM
To: xalan-c-users@xml.apache.org
Subject: RE: Xalan-C / XSL 1.0 : Curent date


Any XSL example without using ICU  ?

_________________________________________________________________

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Tuesday, July 29, 2008 7:57 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan-C / XSL 1.0 : Curent date

Sathasivam, Elayaraja wrote:
> I would like to print the current date with the format ('E yyyy MM
> dd hh:mm:ss' ) by using xsl 1.0. I am new to Xalan-C. I have worked
> only with Xalan-J.
> 
> Any thing similar as below in Xalan-C ????????
No, Xalan-C has no facility for date formatting.  You will need to 
format the date, then pass it into the stylesheet as a parameter.  Or, 
you can write an extension function that you can call in your
stylesheet.

The ICU (International Components for Unicode) has support for date 
formatting which is like the Java functionality you're using in Xalan-J.

Dave