[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Resend: Is there a way ...
Hi Allen, > My stylesheet converts from XML to XML, changing values or > structure. For most part it just copies what's in the input XML to > the output XML. > > But if the input has > & apos ; (') > or > & quot ; (") > , the output changes them to > ' ( ' ) > and > & # 34 ; (") > , which is not good. I'd like to preserve what was in the input. Is > there a way to do that? You shouldn't care about whether the escaped version of a character is used or not. The processor will usually not output the escaped version of a character unless it has to, but it makes no difference in terms of the XML information that the file contains. If you are really desperate to have these characters escaped, then you could write a search and replace function that searches for apostrophes and double quotes and replaces them with the relevant general entity with output escaping disabled: <xsl:text disable-output-escaping="yes">'</xsl:text> However, this will only work for element content, not for attribute values (and I think that it's attribute values you're having a problem with, since otherwise the double quote wouldn't be being escaped). So the only way around it within the styleheet is to use the text output method and output the XML in the way that you want it outputted. That means you can't use things like literal result elements, xsl:element, xsl:attribute, xsl:copy or xsl:copy-of to get your output - you have to write it all by hand. Or you could write your own output serialiser for Saxon that escaped everything in the way you want it escaped. Or you could write a post-processor in Perl or something that searched and replaced all occurrences of those characters in the file. So there are ways, but I doubt it's worth the hassle. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|