Explicit cast to date in Xpath 2.0- unknown namespace prefix?

Viewed 21

I have created an XSLT 2.0 stylesheet and want to explicitly cast a string to a date using xs:date.

Specifically looks like this:

<xsl:value-of select="format-dateTime( xs:date(concat (EDI_DC40/CREDAT,EDI_DC40/CREDAT, 'T', EDI_DC40/CREDAT,EDI_DC40/CRETIM), '[Y0001]-[M01]-[D01]T[h1]:[m01]:[s01]')"/>

Then a validation message is thrown indicating that the namespace prefix xs: is not defined.

Any idea what needs to be done or what is wrong?

1 Answers

You need to declare the XML Schema namespace in your stylesheet in order to use the functions in the XML Schema namespace. It isn't declared and available by default.

xmlns:xs="http://www.w3.org/2001/XMLSchema" 
Related