Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
XML
XPATH2.0 fn:matches() can somebody confirm if my understanding is OK
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="RolfK, post: 3186203"] Dear ALL, I'm writing some first examples to get a better understanding of XSLT/ XPATH2.0. Please excute this code, any xml input is OK. I'm using saxon. The example runs perfect with ALTOVA, but fails with SAXON. Please refere to line with element <matches> which is quite close to the error. Error at choose on line 26 of file:/.....: No function found matching fn:matches with 2 arguments Transformation failed: Run-time errors were reported Any idea ? Any comments on the rest of the example are very welcome ! (I'm just started to dig into XSLT2.0 stub) ################ xslt ####################### <xsl:transform xmlns:xsl="[URL]http://www.w3.org/1999/XSL/Transform[/URL]" version="2.0" xmlns:fn="[URL]http://www.w3.org/2005/xpath-functions[/URL]"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <output> <analyze> <xsl:analyze-string select="'[USER=54920]@abcd[/USER][123]'" regex="(@|#)?(\w+)\[(\d+) \]"> <xsl:matching-substring> <m group="1"> <xsl:value-of select="regex-group(1)"/> </m> <m group="2"> <xsl:value-of select="regex-group(2)"/> </m> <m group="3"> <xsl:value-of select="regex-group(3)"/> </m> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </analyze> <functions> <xsl:for-each select="('@param[2]','#define','0','H','L','invalid','##','@@','HL')"> <matches> <xsl:choose> <xsl:when test="fn:matches(.,'^@\w+\[\d+\]$')"> <item Value="{.}" Type="Parameter"/> </xsl:when> <xsl:when test="fn:matches(.,'^#\w+$')"> <item Value="{.}" Type="Define"/> </xsl:when> <xsl:when test="fn:matches(.,'^[01ZHLX]{1}$')"> <item Value="{.}" Type="Value"/> </xsl:when> <xsl:otherwise> <item Value="{.}" Type="ERROR"/> </xsl:otherwise> </xsl:choose> </matches> <tokenize> <xsl:variable name="vTokens" select="fn:tokenize(.,'(@)|(#)|(\[)| (\])')"/> <tokens count="{count($vTokens)}"> <xsl:for-each select="$vTokens"> <token value="{.}"/> </xsl:for-each> </tokens> </tokenize> </xsl:for-each> </functions> </output> </xsl:template> </xsl:transform> ############################ [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
XML
XPATH2.0 fn:matches() can somebody confirm if my understanding is OK
Top