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 David Bertoni <db...@apache.org> on 2008/07/29 16:27:17 UTC

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: XPath parsing bug?

Posted by "Rob.Conde" <Ro...@ai-solutions.com>.
Thanks David for the reply and workaround - always good to know you're not
crazy/dumb.

Rob

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Friday, August 01, 2008 7:56 PM
To: xalan-c-users@xml.apache.org
Subject: Re: XPath parsing bug?

Rob.Conde wrote:
> I'm using Xalan 1.9
> 
> When compiling an xsl containing the following:
> 
> <xsl:template match="Items/value//@name">
>   <!--some stuff here -->
> </xsl:template>
> 
> I get the following error:
> 
> "A node test was expected.pattern = 'Items/value//@name' Remaining tokens
> are: ('@' 'name')
> 
> This works with the .NET xpath processor however. Isn't this valid xpath?
> 
> FYI we found the following workaround match="Items/value//*/@name" which
> while not a general substitude, works for our particular case.
Yes, this is a bug.  However, you can use the attribute axis as a 
workaround:

Items/value//attribute::name

I've created a Jira issue and I'll be attaching a patch in a bit:

https://issues.apache.org/jira/browse/XALANC-680

Dave



Re: XPath parsing bug?

Posted by David Bertoni <db...@apache.org>.
Rob.Conde wrote:
> I'm using Xalan 1.9
> 
> When compiling an xsl containing the following:
> 
> <xsl:template match="Items/value//@name">
>   <!--some stuff here -->
> </xsl:template>
> 
> I get the following error:
> 
> "A node test was expected.pattern = 'Items/value//@name' Remaining tokens
> are: ('@' 'name')
> 
> This works with the .NET xpath processor however. Isn't this valid xpath?
> 
> FYI we found the following workaround match="Items/value//*/@name" which
> while not a general substitude, works for our particular case.
Yes, this is a bug.  However, you can use the attribute axis as a 
workaround:

Items/value//attribute::name

I've created a Jira issue and I'll be attaching a patch in a bit:

https://issues.apache.org/jira/browse/XALANC-680

Dave

Re: XPath parsing bug?

Posted by David Bertoni <db...@gmail.com>.
On Wed, Jul 30, 2008 at 11:12 AM, Rob.Conde <Ro...@ai-solutions.com>wrote:

> I'm using Xalan 1.9
>
> When compiling an xsl containing the following:
>
> <xsl:template match="Items/value//@name">
>  <!--some stuff here -->
> </xsl:template>
>
> I get the following error:
>
> "A node test was expected.pattern = 'Items/value//@name' Remaining tokens
> are: ('@' 'name')
>
> This works with the .NET xpath processor however. Isn't this valid xpath?
>
Yuck.  Two bugs in match patterns this week, and they've both been there
since day 1.

Yes, this is a bug.  Can you tell me if "attribute::name" works instead of
"@name"?


>
>
> FYI we found the following workaround match="Items/value//*/@name" which
> while not a general substitude, works for our particular case.

"Items/value/@name | Items/value//*/@name" is also a possible workaround.

Dave

XPath parsing bug?

Posted by "Rob.Conde" <Ro...@ai-solutions.com>.
I'm using Xalan 1.9

When compiling an xsl containing the following:

<xsl:template match="Items/value//@name">
  <!--some stuff here -->
</xsl:template>

I get the following error:

"A node test was expected.pattern = 'Items/value//@name' Remaining tokens
are: ('@' 'name')

This works with the .NET xpath processor however. Isn't this valid xpath?

FYI we found the following workaround match="Items/value//*/@name" which
while not a general substitude, works for our particular case.

Robert Conde



RE: Xalan-C / XSL 1.0 : Curent date

Posted by "Coker, Jonathan M" <jo...@boeing.com>.
The download seemed to work from 

http://icu-project.org/download/4.0.html 

-----Original Message-----
From: Sathasivam, Elayaraja [mailto:elayaraja.sathasivam@capgemini.com] 
Sent: Wednesday, July 30, 2008 4:27 AM
To: xalan-c-users@xml.apache.org
Subject: RE: Xalan-C / XSL 1.0 : Curent date


Did any one tried with ICU with windows platform.......?
If we try to download the ICU it taken to IBM link such as
http://www.ibm.com/developerworks/opensource/    did any one downloaded
the ICU?
There is no ICU to download...
Instead of integrate ICU with the  Xerces-C++ build, is there any
download for Xerces-C++ with ICU. Hope fully it won't be there, since
Xerces-C++ & ICU belongs to different vendor.


 Or any example of XSL printing the date ?

Regards,
Raja 

-----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

RE: Xalan-C / XSL 1.0 : Curent date

Posted by "Sathasivam, Elayaraja" <el...@capgemini.com>.
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>.
Any examples ?
Could you tell us  without using ICU, by using extension function ?
example ?

Regards,
Raja 
_________________________________________________________________

-----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>.
Did any one tried with ICU with windows platform.......?
If we try to download the ICU it taken to IBM link such as
http://www.ibm.com/developerworks/opensource/    did any one downloaded
the ICU?
There is no ICU to download...
Instead of integrate ICU with the  Xerces-C++ build, is there any
download for Xerces-C++ with ICU. Hope fully it won't be there, since
Xerces-C++ & ICU belongs to different vendor.


 Or any example of XSL printing the date ?

Regards,
Raja 

-----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