xsl-list
[Top] [All Lists]

RE: [xsl] two regexp related questions

2011-05-19 13:19:46
If you're on XSLT 2.0, you really want to be using <xsl:analyze-string> for 
this. 

________________________________________
From: Julian Reschke [julian(_dot_)reschke(_at_)gmx(_dot_)de]
Sent: Thursday, May 19, 2011 1:45 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] two regexp related questions

Hi there,

I've got two regexp-related questions.

1) Is it correct that XSLT/XPath2's regular expressions do not support
non-capturing groups (as shown in
<http://www.exampledepot.com/egs/java.util.regex/NoGroup.html>)?

2) With respect to analyze-string, and the captured regex-groups:

I'm using a regex like

   ([A-Z]+) = ([A-Z]+) ( ; ([A-Z]+) = ([A-Z]+) )*

for matching things like

   a=b;c=d;e=f

Works fine, but the regex-group function only returns values for the
last match, so, with the example above, I can capture

  a=b (because it's a non-repeating part)

and

  e=f

I've worked around this by using recursion, feeding the "remainder" into
another template.

Is there a simpler way to achieve this?

Best regards, Julian

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--