ChuTri Posted November 25, 2010 Share Posted November 25, 2010 Hi all,I want to get day ( Mon, Tue, Wed .... ) from date ( 2/2/2010 ). I use folow coding in my xsl file <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xsl:template match="/"> <html> <body> <xsl:variable name="date2" select="xs:date('2005-03-01')"/> <xsl:value-of select="format-date($date2,'[F]')"/> </body> </html> </xsl:template></xsl:stylesheet> But when open xml file ( that embedded xsl file ) for running, i receive error : Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions. How could i solve it ? Link to comment Share on other sites More sharing options...
Martin Honnen Posted November 25, 2010 Share Posted November 25, 2010 Functions like xs:date and format-date are only supported by XSLT 2.0 processors, not by XSLT 1.0 processors. So probably you are simply using the wrong software to run your stylesheet. Known XSLT 2.0 processors are Saxon 9, AltovaXML Tools, XQSharp 2.0. Intel and IBM also have XSLT 2.0 processors. Link to comment Share on other sites More sharing options...
ChuTri Posted November 25, 2010 Author Share Posted November 25, 2010 Functions like xs:date and format-date are only supported by XSLT 2.0 processors, not by XSLT 1.0 processors. So probably you are simply using the wrong software to run your stylesheet. Known XSLT 2.0 processors are Saxon 9, AltovaXML Tools, XQSharp 2.0. Intel and IBM also have XSLT 2.0 processors.So, is there anyways that could i get day ( Mon, Tue, Wed ... ) from date in xslt 1.0 ? Link to comment Share on other sites More sharing options...
Martin Honnen Posted November 26, 2010 Share Posted November 26, 2010 You could check whether your XSLT 1.0 processor supports http://www.exslt.org/date/index.html. It has functions like http://www.exslt.org/date/functions/day-in-week/index.html or http://www.exslt.org/date/functions/day-name/index.html.Other options are using extension functions or objects, for instance an XSLT processor like the .NET System.Xml.Xsl.XslCompiledTransform can with the help of extension functions or objects use the .NET framework's class library date support. Or an XSLT processor implemented in Java usually allows extension functions to use Java APIs. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.