I am trying to use analyze-string. I have this query:
declare namespace str = 'str.analysis';
declare function str:analyze-string($string as xs:string, $regex as xs:string,$n as xs:integer ) as xs:string {
xslt:transform(<item />, (
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match='/' >
<xsl:analyze-string regex="{$regex}" select="'{$string}'" >
<xsl:matching-substring>
<xsl:for-each select="1 to {$n}">
<match>
<xsl:value-of select="regex-group(.)"/>
</match>
</xsl:for-each>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:template>
</xsl:stylesheet>))
};
let $item as xs:string := 'test MM23423 junk MM11111 junkagain man'
let $result := str:analyze-string($item, 'MM', 10)
return $result
However I am getting an error that this is unsupported. Upon further investigation I found that this is only available in Saxon EE. I'm guessing this is my problem. Is there anything of similar functionality included in basex?
Any help would be appreciated. thanks.