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

Re: Resend: Is there a way ...

Subject: Re: Resend: Is there a way ...
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 14 Mar 2001 08:52:38 +0000
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 ; (&apos;)
> or
> & quot ; (&quot;)
> , the output changes them to
> '        ( ' )
> and
> & # 34 ; (&#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">&apos;</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


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.