Analyze-string unsupported?
Friday, 9 August 2013 · 3 messages
CG
What about simply using XQuery?…
analyze-string('test MM23423 junk MM11111 junkagain man', 'MM')Quoted text · James Wright · 39 lines
> 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. > > - james > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
JW
James Wright9 Aug 2013 20:31 #
Hey,
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.
- jamesJW
Christian,
That is a grand idea. I obviously took the wrong fork in the road somewhere in my trials/research. Thanks once again. - James
Quoted text · Christian Grün · 50 lines
> From: christian.gruen at gmail.com > Date: Fri, 9 Aug 2013 18:49:52 +0200 > Subject: Re: [basex-talk] Analyze-string unsupported? > To: james.jw at hotmail.com > CC: basex-talk at mailman.uni-konstanz.de > > What about simply using XQuery?… > > analyze-string('test MM23423 junk MM11111 junkagain man', 'MM') > ___________________________ > > > 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. > > > > - james > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery