[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Stripping out non-*ML tags?

Subject: Re: Stripping out non-*ML tags?
From: JBryant@xxxxxxxxx
Date: Mon, 14 Nov 2005 17:48:08 -0600
regular expression remove xml tags
(Reposted to remove the accursed SPAM tag - my apologies to Tommie and the 
list.)

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

If you are stuck with XSLT 1.0, regular expressions are out. At that 
point, I'd make a list of all the markers (both beginning and ending, so 
[b] and [/b] are separate items in the list) and write a template to 
replace each term with "". I'd put the list of terms in a separate file 
and get it with the document function (and maybe a parameter to specify 
the list document if you need to handle more than one set of markers).

I've done something similar (finding each instance of a set of 800+ 
acronyms and turning them into links in a 2,000-page document), but I had 
the luxury of using 2.0 and xsl:analyze-string.

HTH

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.