[PLUG] Perl, regex and xslt

Sean Whitney sean.whitney at gmail.com
Fri Jun 6 03:14:18 UTC 2008


I have some perl code that generates xml and with the help of xslt 
generates xhtml.

I've found that some of my source material contains characters that xslt 
doesn't like.

If I'm reading this right, this webpage seems to stipulate what 
characters are ok in xslt and what are not.

http://www.w3.org/TR/REC-xml/#NT-Char

#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

What I am trying to figure out is how to write a series of perl 
substitution lines to ensure that the output is ok for xslt.

something like

$value =~ s/\x0//g

This gets rid of the first null character, but is there a way to 
stipulate 0-8?

If there's a better way of doing it I'm all eyes.....



Thanks,

Sean



More information about the PLUG mailing list