views:

208

answers:

1

Does Nokogiri only support XPath 1.0? I'm trying to do simple string replacement in a value-of cell, like so (where element contains something like '* My string (useless text)')

<xsl:value-of select="replace(element,'^\*\ (.+)\ \(.*\)$','\\1')">

Is this poorly formed XSL? Or is there a limitation with Nokogiri?

A: 

The replace() function is only defined in XPath 2.0 (and XPath 2.x is only supported by XSLT 2.x, not XSLT 1.0)

Nokogiri uses libxml2, which only supports XPath 1.0/XSLT1.0

Dimitre Novatchev