Manfred Staudinger wrote:
I would like to eliminate substrings starting and ending
with square-brackets,
for example "[abc, 1954-57]" should be replaced by ""
(null-string). What is the regex for this to match?
~/drafts/xsl> cat regexp.xsl
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="root/test"/>
</xsl:template>
<xsl:template match="test">
<xsl:value-of select="replace(., '\[[^\]]+\]', '')"/>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:transform>
~/drafts/xsl> cat regexp.xml
<root>
<test>text [with brackets]</test>
<test>plain text</test>
<test>text [with [problematic] brackets]</test>
</root>
~/drafts/xsl> saxon regexp.xml regexp.xsl
text
plain text
text brackets]
How do you recommend to test xslt regex? Is it possible to
to see what is actually matched?
I'm not sure what you're looking for, but maybe
xsl:analyze-string, xsl:matching-substring and
xsl:non-matching-substring can be of interest.
Regards,
--drkm
___________________________________________________________________________
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs
exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.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>
--~--