On 2/28/07, Marshall Schor <[EMAIL PROTECTED]> wrote:
The XML Spec requires all 3 combinations of CR, CRLF, or LF be converted
to #xA character when "parsing" an XML document.  See section 2.11,
End-of-Line handling

The XSLT spec doesn't say how these are to be "output".  Michael Kay's
book on XSLT 2.0 says, on pg 389, Rules for Text Output, "The way in
which line endings are output (for example LF or CRLF) is not defined;
the implementation might choose to do the default line-ending
conventions of the platform on which it is running".


There may be a subtle difference between escaped newlines and
unescaped newlines.  I can certainly understand that an XSLT processor
could output a "real" newline character any way it wanted, because
from the XML parser's perspective, it makes absolutely no difference -
each newline will be considered just an LF when it is parsed.

To me the question is what happens if the input XML document contains
an escaped &#D; sequence.  Is the XSLT processor really allowed to
drop it if it copies this text to the output?  That makes no sense to
me (not that this means it isn't possible the spec was poorly written
and allows it, but it seems like the implementers now at least agree
with me that this wouldn't make sense to actually implement it that
way).

It would be nice to get a fix for this which worked on all
implementations.  Perhaps something like: do a "test" at start up to see
what convention is in use on this particular platform/software level,
and then appropriately "compensate" for it.


Not really sure what you intend to do based on a platform-specific
test here.  I think we would essentially have to implement the XML
serialization code ourselves rather than using XSLT, which is no easy
task.

There's a workaround for this issue.  Use a newer version of Java, or
if you're really committed to Sun Java 1.4, get a newer version of
Xalan.  I suppose, now that we're an Apache project, we can ship Xalan
with UIMA if we wanted to.  I just don't think UIMA should be in the
business of reimplementing XML serialization because that Xalan
version that's several years old has a bug (or undeseriable beahvior
if you prefer).

-Adam

Reply via email to