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 Matt Coarr <ma...@gmail.com> on 2004/11/04 21:05:31 UTC

using exslt extension functions (date-time)

Hello,

The EXSLT extension functions and elements are a set of extensions
that many XSLT engines support.  Xalan has an implementation of many
of these functions.

I am trying to use the EXSLT extension functions provided by
org.apache.xalan.lib.* both in a J2EE application server and (for
debugging) on the command line.  However, I get the error that
"TransformException: Instance method call to method date-time requires
an Object instance as first argument."  However this method is static
(I looked it up in cvs).

What is the correct way to use these extension functions?  Does anyone
have a few good examples?  Or can anyone suggest what I might be doing
wrong?

I am using JDK 1.4 and I have followed the tips for using xalan on JDK
1.4.  In particular, I have the latest xalan, xerces, and xml-api's
jar files in an endorsed lib directory.

Here's my command-line for testing:

java -classpath
-Djava.endorsed.dirs=/apps/sjes/opt/SUNWam/lib/endorsed
org.apache.xalan.xslt.Process -IN input.xml -XSL portal_rss.xsl -OUT
out.html

EnvironmentCheck tells me that I have xerces 2.6.2 and xalan 2.6.0.

Here's the namespace declaration:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rss="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:netscape="http://my.netscape.com/rdf/simple/0.9/"
    xmlns:datetime="http://exslt.org/date-and-times">

Here's where I am using the extension function:

  <td align="left"><span class="small">Consumed: 
    <xsl:value-of select="datetime:date-time()"/></span></td>


Referenced information:

The xalan implementation class's javadocs:
http://xml.apache.org/xalan-j/apidocs/org/apache/xalan/lib/ExsltDatetime.html

The implementation class in cvs:
http://cvs.apache.org/viewcvs.cgi/xml-xalan/java/src/org/apache/xalan/lib/ExsltDatetime.java

The exslt web site's section on the datetime functions:
http://www.exslt.org/date/

Thank you,
Matt

Re: using exslt extension functions (date-time)

Posted by Morris Kwan <mk...@ca.ibm.com>.



You have a typo here.

xmlns:datetime="http://exslt.org/date-and-times

should be

xmlns:datetime="http://exslt.org/dates-and-times

Regards,

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com



                                                                           
             Matt Coarr                                                    
             <mattcoarr@gmail.                                             
             com>                                                       To 
                                       xalan-j-users@xml.apache.org        
             11/04/2004 03:05                                           cc 
             PM                                                            
                                                                   Subject 
                                       using exslt extension functions     
             Please respond to         (date-time)                         
                Matt Coarr                                                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hello,

The EXSLT extension functions and elements are a set of extensions
that many XSLT engines support.  Xalan has an implementation of many
of these functions.

I am trying to use the EXSLT extension functions provided by
org.apache.xalan.lib.* both in a J2EE application server and (for
debugging) on the command line.  However, I get the error that
"TransformException: Instance method call to method date-time requires
an Object instance as first argument."  However this method is static
(I looked it up in cvs).

What is the correct way to use these extension functions?  Does anyone
have a few good examples?  Or can anyone suggest what I might be doing
wrong?

I am using JDK 1.4 and I have followed the tips for using xalan on JDK
1.4.  In particular, I have the latest xalan, xerces, and xml-api's
jar files in an endorsed lib directory.

Here's my command-line for testing:

java -classpath
-Djava.endorsed.dirs=/apps/sjes/opt/SUNWam/lib/endorsed
org.apache.xalan.xslt.Process -IN input.xml -XSL portal_rss.xsl -OUT
out.html

EnvironmentCheck tells me that I have xerces 2.6.2 and xalan 2.6.0.

Here's the namespace declaration:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rss="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:netscape="http://my.netscape.com/rdf/simple/0.9/"
    xmlns:datetime="http://exslt.org/date-and-times">

Here's where I am using the extension function:

  <td align="left"><span class="small">Consumed:
    <xsl:value-of select="datetime:date-time()"/></span></td>


Referenced information:

The xalan implementation class's javadocs:
http://xml.apache.org/xalan-j/apidocs/org/apache/xalan/lib/ExsltDatetime.html


The implementation class in cvs:
http://cvs.apache.org/viewcvs.cgi/xml-xalan/java/src/org/apache/xalan/lib/ExsltDatetime.java


The exslt web site's section on the datetime functions:
http://www.exslt.org/date/

Thank you,
Matt