EXSLT and regexp

C

Chris Croughton

I'm trying to use the EXSLT regexp package from

http://www.exslt.org/regexp/functions/match/index.html

(specifically the match function) with the libxml xltproc (which
supports EXSLT), but whatever I do gets errors. The examples use
namespace regExp, but the supplied files use regexp, I've got it so that
it at least doesn't complain about namespaces but it then complains that
it can't find the match function. My stylesheet is:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:func="http://exslt.org/functions"
xmlns:regexp="http://exslt.org/regular-expressions"
extension-element-prefixes="regexp"
<import href="regexp.match.xsl" />

<xsl:eek:utput method="text"/>

<xsl:template match="/">
<xsl:for-each select="regexp:match('This is a test string', '(\w+)', 'g')">
Part <xsl:value-of select="position()" /> = <xsl:value-of select="." />
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

(This is the same test as the second one on the page referenced above,
with regExp changed to regexp and the closing parenthesis added.)

The errors I get are:

xmlXPathCompOpEval: function match not found
Error xpath.c:9637: Unregistered function
xmlXPathCompiledEval: 2 object left on the stack

Has anyone actually had the regexp functions working?

Chris C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,250
Members
46,848
Latest member
Graciela Mitchell

Latest Threads

Top