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?

CallumVass
  • 11,288
  • 26
  • 84
  • 154

3 Answers3

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.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
0

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

Madurika Welivita
  • 890
  • 1
  • 10
  • 19
  • Ok, I changed it to `2.0` and I still get the same message: `'dateTime()' is an unknown XSLT function.` – CallumVass Oct 18 '12 at 10:28
  • Nope? It says the same thing. `year-from-date() is an unknown XSLT function.` – CallumVass Oct 18 '12 at 10:39
  • 2
    Changing the version number in your stylesheet to 2.0 doesn't change the Microsoft XSLT processor into an XSLT 2.0 processor. – Michael Kay Oct 18 '12 at 10:42
  • http://stackoverflow.com/questions/515979/java-xslt-processors-supporting-xpath-2-0 http://saxon.sourceforge.net/ http://www.altova.com/xslt2-net.html think you can get help from above – Madurika Welivita Oct 18 '12 at 10:58
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.

Community
  • 1
  • 1
stjohnroe
  • 3,168
  • 1
  • 27
  • 27