xsltxslt-1.0altova

XSLT date-time() function is unknown in ALTOVA XmlSpy


Good day! I downloaded Altova XMLSpy trial, installed FOP 0.95 and tried to perform XSLT (version 1.0) transformation. My template is valid but during the transformation it fails on the line containing "date-time()" function:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:dt="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="dt exsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
    <html>
        <body>
            <xsl:value-of select="dt:date-time()"/>
        </body>
    </html>
</xsl:template>

</xsl:stylesheet>

The error message is:

Error in XPath expression
Unknown function - Name and number of arguments do not match any function signature in
the static context - 'http://exslt.org/dates-and-times:date-time'

Please how to make this function available? I'm sure this function exists. The template works for example in this online XSLT tester: http://markbucayan.appspot.com/xslt/index.html

Thank you in advance! Vojtech

UPDATE: I installed SAXON 9 (both HE and EE), configured ALTOVA to use it but again the same error.


Solution

  • If you are using Altova or saxon you can use XSLT2 rather than XSLT1 so do not need to load the EXSLT extensions, xpath2 has this function built in

    select="current-dateTime()"
    

    http://www.w3.org/TR/xpath-functions/#func-current-dateTime