|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: RegEx in XSLT?
Regexp-matching is not actually powerful with XSLT alone.
But there are a lot of possibilities concerning extension functions. The way of integrating them depends on the processor you are using.
Saxon for example can integrate java-functions somehow like this, by defining a namespace to a java class:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:RegexpClass="http://www.jclark.com/xt/java/com.hico.onlaw.convert.RegexpClass">
Then in the stylesheet in which you use the functions you can define variables like:
<xsl:variable name="RegexpFunction" select="RegexpClass:new()"/>
For example, one application of regexp-functions in my stylesheet looks like this:
<xsl:variable name="doknr">
<xsl:if test="Regexp:matchRegex($RegexpFunction, ris.c/ris.c.doknr, '&ris.c.doknr;')">
<r1>
<v1>
<xsl:value-of select="Regexp:getMatchRes($RegexpFunction, 1)"/>
</v1>
<v2>
<xsl:value-of select="Regexp:getMatchRes($RegexpFunction, 2)"/>
</v2>
<v3>
<xsl:value-of select="Regexp:getMatchRes($RegexpFunction, 3)"/>
</v3>
</r1>
</xsl:if>
</xsl:variable>
Hope this was helpful input
regards
Mario
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








