RE: [xsl] How to preserve numerical representation of chars when parsing?

Subject: RE: [xsl] How to preserve numerical representation of chars when parsing?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 6 Sep 2002 10:40:26 +0100
> > > Is there any possibility to let the numerical references pass
> > transparently?
> ...
> I suggest to consider a setting/property for XML Parsers that 
> allows to not 
> expand numerical refs. Would this make any sense or is this 
> feature too exotic to consider?
> 
XML tries - not always successfully - to separate the logical
information content from the physical encoding of the file. Certain
features of XML are considered to carry information that applications
can legitimately use (for example, the names and values of elements and
attributes, the order of elements), and other features are considered to
be accidents of the encoding (for example, the order of attributes, the
whitespace within a start tag, the choice of single or double quotes).

There are some boundary cases such as CDATA sections, comments, and
namespace prefixes, where different specs have interpreted the
constructs differently in this respect. But the distinction between
representing a character literally and representing it by a decimal or
hexadecimal character reference is definitely in the "accident of
encoding" category, and no application should rely on it being
represented one way or the other. Indeed, XML parsers should not even
tell the application which way it was encoded.

XSLT works strictly at the level of the logical information content: it
is not concerned with retaining the original encoding, though it does
allow you some limited control over the output encoding if you use the
XSLT serializer.

You haven't really explained why your target application (the one that
is the recipient of the output from the transformation) cares which XML
representation of the characters in the document is chosen. As David
explained, if it does care, then it is not an XML application as defined
by the XML specification.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread