Solved

Namespace 'http://www.w3.org/2001/XMLSchema' does not contain any functions.

Posted on 2007-11-20
4
1,808 Views
Last Modified: 2013-11-18
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.
<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'))" />

Open in new window

0
Comment
Question by:j_lainio
  • 2
  • 2
4 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20326103
prefixing XPath functions was necessary in an old draft of the XSLT2 spec
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(xs:dateTime('2007-11-30T19:20:00'))" />
    </xsl:template>
</xsl:stylesheet>

will work

note that I changed the date... 2007-11-31 is an invalid date

cheers

Geert
0
 

Author Comment

by:j_lainio
ID: 20326387
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.
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/>

Open in new window

0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 250 total points
ID: 20326437
> I have tested my xml file with IE 7 and Firefox 2.0.07

my friend, browsers don't support XSLT2
In a browser you only have access to XPath1.0 functions
0
 

Author Closing Comment

by:j_lainio
ID: 31410231
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?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Issue configuring a dropdown selector on a donation form. 13 68
Technology stack suggestions 4 61
ColdFusion Rereplace 3 72
AngularJS directive issue 6 65
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now