Subject: RE: Re: Spam: Stripping out non-*ML tags?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 15 Nov 2005 00:17:41 -0000
|
> > Strictly for readability, I need to strip or at least minimize
> > the amount of that stuff that gets past my XSL. I would be
> > perfectly happy to replace, in regex terms, \[[^\]]\] with "".
> > That is, just delete all of the tags, so that "[b]text[/b]"
> > becomes "text"
>
> If you can use XSLT 2.0, you can actually use regular
> expressions. That's
> one of 2.0's very welcome features. If you can switch to 2.0 or are
> already using it, look at xsl:analyze-string.
Another way of tackling this input would be to replace the [] characters by
<> (using the translate function), and then use saxon:parse() or a similar
extension function to parse the resulting character string as XML.
Michael Kay
http://www.saxonica.com/
|