j_lainio
asked on
Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.
I don't unnderstand how I should use these xslt version 2.0 functions. I have this very simple piece of xslt code and all namespaces correctly defined. But still I get this error:
Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.
What i'm doing wrong? And actually that error comes already when trying just use only datetime function.
Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.
What i'm doing wrong? And actually that error comes already when trying just use only datetime function.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2004/07/xpath-functions"
xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes">
...
Year is: <xsl:value-of select="fn:year-from-dateTime(xs:dateTime('2007-11-31T19:20:00'))" />
ASKER
No, that still won't work...? I'm getting frustrated because of this error:
Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.
I have tested my xml file with IE 7 and Firefox 2.0.07. I do my testing by opening Xml-file with the browser. Can this be some browser related issue? I even left out the "year-from-dateTime" function call to see if "xs:dateTime" is working. But it isn't?!
See my attached code.
Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.
I have tested my xml file with IE 7 and Firefox 2.0.07. I do my testing by opening Xml-file with the browser. Can this be some browser related issue? I even left out the "year-from-dateTime" function call to see if "xs:dateTime" is working. But it isn't?!
See my attached code.
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="/">
Test me: <xsl:value-of select="xs:dateTime('2007-11-30T19:20:00')" />
</xsl:template>
</xsl:stylesheet>
XML:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<Root/>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay, thank you very much about this lightening information.
So, working XSLT with only browser I can use NodeSet, String, Boolean and Number functions(XPath 1.0) but there is no smart way to deal with dates, right?
So, working XSLT with only browser I can use NodeSet, String, Boolean and Number functions(XPath 1.0) but there is no smart way to deal with dates, right?
and is no longer required
just drop the namespaces
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="/">
Year is: <xsl:value-of select="year-from-dateTime
</xsl:template>
</xsl:stylesheet>
will work
note that I changed the date... 2007-11-31 is an invalid date
cheers
Geert