I am using the XslTransform class in C#.net to output XML files that include
non-ascii Unicode characters such as the Greek capital letter theta U+0398.
I can easily outout the data as serialized UTF-8 by using the default
encoding of UTF-8; however, my customer wants any non-ascii characters
output as numerically-entity encoded characters, e.g. Θ (where 920 is
the decimal equivalent for hexadecimal 398). If I use the Saxon processor
or MSXSL, and the xsl transform has the output type set to us-ascii as
follows:
<xsl:output method="xml" encoding="us-ascii" indent="no" />
then all non-ascii characters are automatically output as numerically-entity
encoded characters. However, if I use the XsltTransform class outputting to
a streamwriter with an encoding type of ASCII, then no entity encoding takes
place - in fact the character is replaced with a question mark. Can anyone
tell me how to configure the properties of the transform to output
numerically-entity encoded characters for all non-ascii characters?
Thank you,
Tim