1

I have an XSL document which I am in the process of creating but when I try to use the DateTime functions specified here: http://www.w3schools.com/xpath/xpath_functions.asp

Such as dateTime or year-from-dateTime it says that they're unrecognised functions?

Here are the namespaces Im using:

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xheader="http://schemas.microsoft.com/dynamics/2008/01/documents/Message"
    xmlns:xsales="http://schemas.microsoft.com/dynamics/2008/01/documents/SalesInvoice"
    exclude-result-prefixes="xheader xsales"
>

I'm currently creating the XSL in Visual Studio, if that helps?

3 Answers 3

2

You need to use an XSLT 2.0 processor like Saxon 9 or AltovaXML or XmlPrime if you want to use XSLT and XPath 2.0 features like those functions. Microsoft's XSLT processors (like the various MSXML versions from MSXML 3 to 6 and XslCompiledTransform and XslTransform in .NET) only support XSLT 1.0.

Sign up to request clarification or add additional context in comments.

Comments

0

dateTime and year-from-dateTime functions are in XSLT 2.0. You are using version="1.0"

4 Comments

Ok, I changed it to 2.0 and I still get the same message: 'dateTime()' is an unknown XSLT function.
Nope? It says the same thing. year-from-date() is an unknown XSLT function.
Changing the version number in your stylesheet to 2.0 doesn't change the Microsoft XSLT processor into an XSLT 2.0 processor.
0

Looks like you are using XSLT 1.0, but the date functions are only available directly in XSLT 2.0. Unfortunately it is not really simple to run XSLT 2.0 from VS but See link for some info on integrating this against VS.

1 Comment

I tried the examples in the link but I still get the same error.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.