xsl-list
[Top] [All Lists]

Re: [xsl] parsing parens in the park

2008-09-28 20:28:46
Thank you very much for your speedy response. (Relativistic, I
daresay, as your response was sent over 3 hours before I posted. :-)


True, but a key table always contains tree nodes and is indexed by
values ... you cannot load up a key table with strings.

Check, thanks for the explanation.


I would have used analyze-string, as below, except that I haven't
got the time right now to figure out how to check for and preserve
a value that contains nested parentheses. So the answer below is
incomplete.
I hope this helps.

Yes and no. While you've saved me a bunch of time in hammering out
the details of analyze-string, (non-)matching-substring, and
regex-group() usage, it is the regexp for parsing over matched parens
that seems to be the hard part, at least to me.

I am probably going to start messing with expressions like
   \(([^)]|\([^)]*\))*\)
in a bit.

Meanwhile, thank you very much, Ken, for posting this. Such efforts
always have positive side effects. In this case, I had not realized
that in XSLT 2 one can use
    <xsl:value-of select="'[Got',regex-group(1), 'with',regex-group(2),']'"/>
where I would have steadfastly stuck with 
    <xsl:text>[Got </xsl:text>
    <xsl:value-of select="regex-group(1)"/>
    <xsl:text> with </xsl:text>
    <xsl:value-of select="regex-group(2)"/>
    <xsl:text>]&#x0A;</xsl:text>


--~------------------------------------------------------------------
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>
--~--