Subject: RE: [xsl] xslt 2.0 regex and how to test it From: Florent Georges <darkman_spam@xxxxxxxx> Date: Sun, 19 Mar 2006 03:01:40 +0100 (CET) |
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 : tiliphonez moins cher avec Yahoo! Messenger ! Dicouvez les tarifs exceptionnels pour appeler la France et l'international. Tilichargez sur http://fr.messenger.yahoo.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xslt 2.0 regex and how to tes, Manfred Staudinger | Thread | Re: [xsl] xslt 2.0 regex and how to, Manfred Staudinger |
[xsl] xslt 2.0 regex and how to tes, Manfred Staudinger | Date | [xsl] XSL-FO: Suppressing Header on, Jordan (Wraezor) |
Month |