Re: [xsl] Entities Conversion

Subject: Re: [xsl] Entities Conversion
From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 May 2007 13:25:18 +0100
On Sat, May 26 2007 23:39:12 +0100, Abel Braaksma wrote:
> J. S. Rawat wrote:
>> &ldquo; &rdquo; &ndash; &mdash;
> there's a way to get this in XSLT 2.0 using character-sets, but it is
> usually not the way to go as you will invalidate your xml.

...unless your output includes (or is included as an external general
parsed entity in a document that includes) the DOCTYPE declaration for
a DTD that defines those entities.

It's generally not necessary to turn the characters back into entity
references since your XML parser will turn them back into characters
again anyway when you come to parse your XML.

About the only use that I can see for turning the characters back into
entities is if you both need to eyeball the XML and it would make more
sense to you if you saw named entity references rather than numeric

If you want to, your stylesheet can import a set of XSLT 2.0 character
maps for the ISO entity sets that can be downloaded from

While DTDs sometimes map multiple different ISO entities to
the same numeric entity reference, these character maps can only
convert a character back to a single entity reference.  If you use
these character maps, you might particularly look at the mappings to
'rsquor' and 'rdquor' in the ISOpub mapping since you may want 'rsquo'
and 'rdquo' instead.


Tony Graham.

Menteith Consulting Ltd             Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Menteith Consulting -- Understanding markup

Current Thread