eeeeaaii
eeeeaaii

Reputation: 3460

getting xpath 2.0 functions to work in any browser at all

I want to use XPath 2.0 functions, like these:

http://www.w3schools.com/xpath/xpath_functions.asp

In a browser XSL transform. I can specify the XSL version as 2.0 in the stylesheet tag, but this doesn't seem to activate the 2.0 XPath functions (at least in Firefox).

So for example this:

<xsl:value-of select="node-name(//testnode)"/>

gives me:

'node-name' is not a valid XSLT or XPath function. -->node-name(//testnode)<--

in IE 8. The XPath 1.0 functions:

http://www.edankert.com/xpathfunctions.html

seem to work fine. Chrome doesn't appear to support XSL 2.0 from what I read.

Upvotes: 2

Views: 1952

Answers (3)

Michael Kay
Michael Kay

Reputation: 163262

Update to 2019: if you want later versions of XPath and XSLT in the browser you can achieve this through third-party Javascript libraries such as Saxon-JS. This currently supports XPath 3.1 and XSLT 3.0. (Disclaimer: my company, Saxonica, develops Saxon-JS)

Upvotes: 2

Mads Hansen
Mads Hansen

Reputation: 66714

I don't believe that any browsers support XSLT 2.0.

If you want to have the browser perform the transform, then you are relegated to XSLT 1.0.

However, you may be able to use EXSLT extension functions in certain browsers.

Upvotes: 1

user357812
user357812

Reputation:

Today, no browser support XPath 2.0

Use name() instead.

Upvotes: 4

Related Questions