- From: Michael Kay <mhk@mhk.me.uk>
- Date: Mon, 16 Aug 2004 23:17:15 +0100
- To: "'Mark D. Anderson'" <mda@discerning.com>, <public-qt-comments@w3.org>
> > It isn't builtin, but it isn't hard. After all, fn:match is intended > to work similarly to the perl "m//", which some people have > found to be useful :). > > non-looping example: > > let $matches = fn:match("alpha/beta/gamma", "(\w+)/.*/(\w+)") > return <first>{$matches[1]}</first><second>{$matches[2]}</second> > > looping example: > > for $matches in fn:match(fn:doc('stuff.xml'), > "(\w+)/.*/(\w+)", "g") > return > > <match><first>{$matches[1]}</first><second>{$matches[2]}</seco > nd></match> > > I don't really see how this is much different in power than: > > <xsl:analyze-string select="document('stuff.xml')" > regex="(\w+)/.*/(\w+)"> > <xsl:matching-substring> > <match> > <first><xsl:value-of select="regexp-group(1)"/></first> > <second><xsl:value-of select="regexp-group(2)"/></second> > </match> > </xsl:matching-substring> > </xsl:analyze-string> The main difference is that there is no equivalent of xsl:non-matching-substring. How would you translate <name>John F. /Kennedy/</name> to <name>John F. <surname>Kennedy</surname></name> Regards, Michael Kay
Received on Monday, 16 August 2004 22:17:52 UTC