> I need regex capability of the type provided by
> the java regex Matcher and Pattern classes. In
> particular I need to obtain the number of matching
> groups from the regex and the portion of the
> original string which matched. ( analyze-string
> does not provide this). Also, I do not know in
> advance what the regex is (separate XML source).
I would be very surprised if the facilities in 2.0 (both
xsl:analyze-string and regex-group() in XSLT, plus the matches(),
replace(), and tokenize() functions in XPath) can't be exploited to
achieve what you need, though it won't necessarily be intuitive.
>
> Sometime back there was a thread on the XSLT list
> on using the java regex and ORO matcher classes,
> but I can't get these to work as advertised. Is
> it better to create my own java wrapper to provide
> a better interface to work from within XSLT or
> how are others using regexs in Saxon ?
Although there are things that are easier to do with the JDK 1.4 regex
APIs than with the XSLT/XPath interfaces, they are very procedural in
nature and this makes it difficult to expose them as extension functions
in a usable way. I would encourage you to do what you can with the
XSLT/XPath facilities provided before resorting to any direct use of
Java.
If you could explain what transformation you want to carry out, rather
than saying how you want to code it, it's more likely that people would
be able to help.
Michael Kay
|