Re: [xsl] Preseving character entities

Subject: Re: [xsl] Preseving character entities
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 25 Nov 2004 13:24:15 GMT
> The problem is that, when the XSLT parser (Saxon 8) parses the document,
> it resolves all the character entities 

It's not really saxon (ie the XSLT engine) expanding entities is done
(and can't be configured) by the XML parser before XSLT (conceptually)
starts.

since you are using xslt2 you can use character-maps to map charaters to
entity refs in the result, but this won't preserve the entities, any
characters will be written back in that form, whether originally entered
as entities or not.

I'm a bit confused as to whether you did really have entity references
or charater references in your source (and required output).

entity references would be something like

& n b s p ;
& a l p h a ;

character references (which don't reference entities) would be something
like

& # 1 6 0 ;
& # 9 4 5 ;

I don't read python really but I would guess that your character map was
generating character references (not entity references)

That should have worked (did you also specify that that character map
should be used in your xsl:output ?)

although a more direct an reliable way to achieve the same effect is
just ask that the document is serialised in US-ASCII as then any
character not in the encoding will automatically be serialised using a
character reference.

If in fact you want non ascii characters that have ISO entities output
using the iSO entity name, there are some xslt2 character maps that do
just that here

http://www.w3.org/2003/entities/iso9573-1991/iso9573-1991map.xsl

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. 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
________________________________________________________________________

Current Thread