Thanks for clarifying some misconceptions
(2) only ‘<’
and ‘&’ must be escaped in the text nodes for an XML parser to
be able to correctly parse the file;
(3) XML entity references in the mapping
element string are normalized before being inserted in the hash table. This is
different from the string I thought was in use during translation.
-----Original Message----- From: email@example.com
[mailto:firstname.lastname@example.org] On Behalf Of Michael Kay Sent:Sunday, March 28, 2004 To:
email@example.com Subject: RE: [saxon]
expansion of XML metacharacters
Firstly, they aren't called metacharacters
- they are called entity references.
Secondly, you don't say why it's essential
that they are preserved. Any XML parser treats " and " as
equivalent. Does this mean that you are reading the XML with something other
than an XML parser? If so, why?
Thirdly, if you want to control this using
character-map, you can do so. If you specify the target string as " (which
is written ") then it will be output as ". If you specify the
target string as " (which is written &quot;) then it will be
output as ".
[mailto:firstname.lastname@example.org] On Behalf Of Johnson, Wayne Sent:28 March 2004 To:
email@example.com Subject: [saxon] expansion of XML
My application is performing a series of XML to XML transformations. It
is essential that the " and ' metacharacters be preserved
after each transformation. However, I find that while the < > &
characters are expanded, saxon (and xalan) will not expand the ‘
“characters in the output
serialization. If character maps (or entity property files) are used, the
mappings have the effect of turning off the expansion for the XML
metacharacters. For example, if I create a mapping from > to <
the output element will contain the < character, not the < I expect.
(The mappings work as advertised for characters that are not XML metacharacters.)
What is the reason for this behavior and what is the simplest way to
ensure that the five XML metacharacters will be expanded?