Regular Expressions


Deleting comments, CDATA sections and PIs from unparsed text with REGEX in XSLT

When loading XML with the unparsed-text() function to test it with Regular Expressions, we must avoid false positives. What looks like markup in comments, PIs and CDATA sections gets escaped exactly like real markup. To make testing of markup easier it can be necessary to delete comments, CDATA sections and PIs.

Updated 2008-11-10