|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Output character references for all but one charac
I think you should be able to achieve this by selecting iso-8859-1 as the encoding, and using a character map that forces NBSP to be output as  , and similarly for all other characters that you want output as numeric references. With HTML output, Saxon has an option (saxon:character-representation - see http://www.saxonica.com/documentation/extensions/output-extras.html ) that forces non-ASCII characters to be represented as character references, but (a) it applies to all non-ASCII characters, and (b) it doesn't work for XML output. If you're really determined then you could write your own serializer by subclassing Saxon's XMLEmitter; you would only need to override one method. Michael Kay > -----Original Message----- > From: Andrew Welch [mailto:ajwelch@xxxxxxxxxxxxxxx] > Sent: 22 June 2004 09:49 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: Output character references for all but > one character > > > > > > I have the problem where I need characters outside the ascii > > > range to be output as references, apart from the pound sign, > > > which must remain as the actual character. > > > > I don't understand. You want the output to be ASCII, but you > > want the # sign output as a hex A3 byte? Those are surely > > contradictory requirements. > > Long story, I doubt there's a solution (as it's a daft > requirement) but here are the requirements, maybe xslt 2.0 > can help me out here: > > This xml: > > <node value="£">Hello World</node> > > Once transformed, looks the same: > > <node value="£">Hello World</node> > > That is, the non-breaking-space appears as a character > reference, and the pound sign appears as the actual character. > > I've tried various combinations of output encodings, d-o-e > and character maps, but I haven't be able to do it so far. > How would character maps replace d-o-e on attributes here? > Maybe a 'force-output-escaping' would be useful, as it does > come up on the list now and again where the answer is to > specify an encoding that doesn't contain the character you > need in order to force the serialiser to escape it? > > cheers > andrew > > > --+------------------------------------------------------------------ > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ > or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> > --+-- > >
|
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
|

Cart








