Re: Replace Special Characters: return, blank and tab
> If I called the template only once in my code to only replace the #13, then > it works fine, the whole node is inserted instead of the text in it. This means that your input _does_ have #13's in it which means that one of the following is true: a) you have a broken XML parser or b) your input has explicit in it rather than ends of lines or c) (Probably this one) your input tree was not made by parsing an XML file but built programmatically in a DOM of some sort, and teh #13's were forcefully injected into it. I think your problem is that your are replacing #13 twice. It's the outermost replacement 9which is fine) but also the innermost one which has teh following effect you first replace newlines by an element then you pass the resulting node set back into your template to replace #9 The first thing your template does with its input $string parameter is coerce it to be a _string_ ie, throwing away all element nodesand just keeping is character data: <xsl:value-of select="substring-before($string, $pattern)" /> both substring-before and xsl:vale-of would both have that effect, using both of them doubaly makes sure that you get no eleemnt nodes from this part, her though you use copy-of <xsl:copy-of select="$replacement" /> so the nodes in the replacement are preserved (that is preserved on output from the template, no nodes in the templates input are preserved.) so you just need to do your newline replacement as the _last_ one (and figure out why you are getting #13's) David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format