0

I have imported the EXSLT date package:

<xsl:import href="str/str.xsl" />
<xsl:import href="date/date.xsl" />

When I do:

<xsl:variable name="month" select="date:month-in-year($pDate)" />

I get:

XPST0017 XPath syntax error at char 0 on line 186 in {date:month-in-year($pDate)}:
Cannot find a matching 1-argument function named
{http://exslt.org/dates-and-times}month-in-year().
There is no Saxon extension function with the local name month-in-year

What does "There is no Saxon extension function with the local name month-in-year" mean? I have already imported the EXSLT date package.

12
  • Which version of Saxon? Jul 23, 2014 at 13:44
  • 1
    XSLT 2.0 has its own date and dateTime support and EXSLT extensions are usually written for XSLT 1.0 processors, often using features that are proprietary to a certain XSLT 1.0 processor. So first consider using the date or dateTime data types and functions defined in XSLT and XPath 2.0 and supported out of the box in Saxon 9. If you need to use EXSLT then make sure the implementation is using features that XSLT 2.0 supports. How does the date.xsl look? Jul 23, 2014 at 13:53
  • 1
    Saxon 9.x is an XSLT 2.0 processor and does not support EXSLT. Doesn't need to, since these functions are available in XSLT 2.0 natively. Jul 23, 2014 at 13:57
  • 1
    Can you use Saxon 6.5? Jul 23, 2014 at 14:04
  • 1
    I am afraid I can't help you with that, but surely others will. -- The other thing that puzzles me is the import: you should not need to import anything, only declare the EXSLT xmlns:date namespace prefix in the stylesheet header. Jul 23, 2014 at 14:11

1 Answer 1

1

When you import EXSLT modules, the functionality is delivered in the form of named templates rather than functions, so you need to call them using xsl:call-template rather than with an XPath function call. If you look at the content of the module you are importing you'll see it contains no functions, only templates.

Most of the functions/templates in the EXSLT date package are superseded by functions in XPath 2.0, so it's not clear why you are still using the EXSLT version.

Saxon 6.5 supported the EXSLT date package (as XPath functions), but they dropped out of the product some time before 9.5 because they simply are no longer needed with XPath 2.0.

There are probably still quite a few people using Saxon 6.5, but it's not something I would recommend. You say you like the diagnostics in Saxon 9, and you are clearly after more features than you can get in XSLT 1.0, so move forward...

3
  • Revisiting that answer, I see there's an error: the EXSLT date functions are still provided in Saxon 9.5 (PE and EE only). Sep 4, 2014 at 21:05
  • but not in the Saxon HE? With xslt 1.0 how to proceed? When need EXSLT ?
    – Xelian
    Aug 24, 2016 at 12:42
  • @Xelian please ask a new question rather than trying to add a supplementary question in a comment on an answer to a closed question. Aug 24, 2016 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.