You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by L Duperval <du...@videotron.com> on 2010/06/07 18:24:45 UTC

Cannot run datetime extensions

Hi,

I am trying to use some date and time functions in my XSL but when I do, I get
this error:

For extension function, could not find method
org.apache.xalan.lib.ExsltDatetime.dateTime([ExpressionContext,] #NODESET).

My XSL declaration looks like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:redirect="http://xml.apache.org/xalan/redirect"
  xmlns:datetime="http://exslt.org/dates-and-times"
  extension-element-prefixes="redirect datetime" version="1.0">

and my usage like this:

<xsl:template match="DATAFILE">
  <xsl:variable name="nextUpdate">
    <xsl:value-of select="datetime:date-time(@GENTIME)" />
  </xsl:variable>
  <NextUpdate>
    <xsl:value-of select="nextUpdate" />
  </NextUpdate>
</xsl:template>

What am I doing wrong?

Thanks,

L


Re: Cannot run datetime extensions

Posted by L Duperval <du...@videotron.com>.
Mukul Gandhi <gandhi.mukul <at> gmail.com> writes:

> 
> It seems, there's not a function datetime:date-time(arg) in EXSLT. I'm
> just curious, what do you want this function to do with the argument?
> 
> 

You are correct. I was misinterpreting the documentation.

What I want is to take a time that appears in my XML file, add an hour to it,
then round it to the next hour. So for example:

2010-06-06T03:45:00 and 2010-06-06T03:22:43 would both give 2010-06-06T05:00:00
as results.

So I think I have to do a combination of parse-date and date:add to make it
work. I'll be trying it out later today. If there is a better appeoach, I'm all
eyes. :)

Thanks,

L


Re: Cannot run datetime extensions

Posted by Mukul Gandhi <ga...@gmail.com>.
It seems, there's not a function datetime:date-time(arg) in EXSLT. I'm
just curious, what do you want this function to do with the argument?

ref, http://exslt.org/date/functions/date-time/index.html

but there's a function:
datetime:date-time() which returns the current date & time

On Mon, Jun 7, 2010 at 9:54 PM, L Duperval <du...@videotron.com> wrote:
> Hi,
>
> I am trying to use some date and time functions in my XSL but when I do, I get
> this error:
>
> For extension function, could not find method
> org.apache.xalan.lib.ExsltDatetime.dateTime([ExpressionContext,] #NODESET).
>
> My XSL declaration looks like this:
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:redirect="http://xml.apache.org/xalan/redirect"
>  xmlns:datetime="http://exslt.org/dates-and-times"
>  extension-element-prefixes="redirect datetime" version="1.0">
>
> and my usage like this:
>
> <xsl:template match="DATAFILE">
>  <xsl:variable name="nextUpdate">
>    <xsl:value-of select="datetime:date-time(@GENTIME)" />
>  </xsl:variable>
>  <NextUpdate>
>    <xsl:value-of select="nextUpdate" />
>  </NextUpdate>
> </xsl:template>
>
> What am I doing wrong?
>
> Thanks,
>
> L



-- 
Regards,
Mukul Gandhi