3

I am using the IntelliJ IDEA 13. The XSLT processor is SAXON. I need to convert date and time a in my transformation. I have decided to use EXSLT. Here is what I've added to my transformation:

<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:setupCustom="urn:customization_2013_1.setup.webservices.netsuite.com"
                xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com"
                xmlns:date="http://exslt.org/dates-and-times"
                extension-element-prefixes="date">
    <xsl:import href="exslt/date/date.xsl"/>

The "exslt" directory is located on the same level as current transformation file. Here is the way I try to call EXSLT functions:

<CreationDateTime>
    <xsl:value-of select="date:date-time()"/>
</CreationDateTime>

Here is the compilation error:

Cannot find a matching 0-argument function named {http://exslt.org/dates-and-times}date-time(). There is no Saxon extension function with the local name date-time

Could you please tell me what I am doing wrong? I have read that date and time extensions are usually natively supported by SAXON, but I have chosen EXSLT to be able to run the transformation on any XSLT processor.

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
Sergey Shafiev
  • 4,205
  • 4
  • 26
  • 37
  • possible duplicate of [error when calling exslt in Saxon](http://stackoverflow.com/questions/5027232/error-when-calling-exslt-in-saxon) – Mathias Müller Jan 27 '14 at 15:45
  • 1
    Not exactly. Another function. Plus the multi-XSLT-processor support is required, I cannot rely on SAXON only. – Sergey Shafiev Jan 27 '14 at 16:50
  • 2
    Check which version of Saxon is being used by calling system-property('xsl:vendor') etc. If you want portability, there are probably more implementations of XSLT 2.0 than of EXSLT these days, and the date-time handling in XSLT 2.0 is much more rigorously specified. – Michael Kay Jan 27 '14 at 20:12
  • Version: 1.0 Vendor: Apache Software Foundation (Xalan XSLTC) Hm, that is strange. Seems there is a Saxon in IDEA 13, and Xalan in IDEA 12. Anyway, please recommend me how to transform date and time from one format to another and get current date and time in these conditions. – Sergey Shafiev Jan 27 '14 at 22:16
  • I find IntelliJ a brilliant IDE for Java but I don't use it as an XML IDE. Try oXygen. And move to XSLT 2.0, which almost certainly has the date-and-time functionality that you want. – Michael Kay Jan 30 '14 at 22:55
  • Thanks a lot. I have decided to use XSLT 2.0 and appropriate processor. Everything works fine without extensions. – Sergey Shafiev Jan 31 '14 at 09:54

0 Answers0