Using EXSLT regexp (oXygen and EXSLT)
Posted: Sun May 24, 2009 9:05 pm
Hi,
I read Sorin's response on using EXSLT with oXygen, however it's still not clear on how exactly xsl needs to be adopted so that EXSLT regexp will work in transformation scenario with Xalan. For example below are xml and xsl containing regexp example from EXSLT web site. This example works just fine in Firefox (by opening xml file below)
XML:
XSL (save it as regexp_firefox_01.xsl):
I added bsf.jar and js.jar as XSLT extensions to the oXygen transformation scenario. However it's not clear how exactly XSL above needs to be modified so it will work in Oxygen. Can someone post modified XSL example and detailed description of other steps required (e.g. adapted JavaScript code from the EXSLT stylesheets) so it will work?
Much appreciated.
I read Sorin's response on using EXSLT with oXygen, however it's still not clear on how exactly xsl needs to be adopted so that EXSLT regexp will work in transformation scenario with Xalan. For example below are xml and xsl containing regexp example from EXSLT web site. This example works just fine in Firefox (by opening xml file below)
XML:
Code: Select all
<?xml version="1.0" ?>
<?xml-stylesheet href="regexp_firefox_01.xsl" type="text/xsl"?>
<urls>
<url>http://www.bayes.co.uk:8080/xml/index.xml?/xml/utils/rechecker.xml</url>
</urls>
Code: Select all
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:regexp="http://exslt.org/regular-expressions"
extension-element-prefixes="regexp">
<xsl:output method="html" />
<xsl:template match="url">
<xsl:variable name="an_url" select="." />
<body>
<html>
<ul>
<li>string:</li>
<ul><li><xsl:value-of select="$an_url" /></li></ul>
<xsl:for-each select="regexp:match($an_url, '(\w+):\/\/([^/:]+):?(\d*)?([^# ]*)', 'i')">
<li>position <xsl:value-of select="position()" /></li>
<ul><li><xsl:value-of select="." /></li></ul>
</xsl:for-each>
</ul>
</html>
</body>
</xsl:template>
</xsl:stylesheet>
Much appreciated.