[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Adding CDATA to the transformed XML

Subject: RE: [xsl] Adding CDATA to the transformed XML
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Jan 2005 18:39:48 -0500

The OP hasn't said exactly, but it sounds to me like the other subsystem is some sort of interface that lets users input whatever they like into the XML.

Since they can input anything from their keyboard, they occasionally input stuff like "&" which of course doesn't parse.

In any case, what Mike said is still correct. The XSLT process that transforms this XML doesn't need to force a CDATA marked section wrapper, because the serializer will do any necessary escaping. That is, if the problem is in the other subsystem, forcing CDATA in this one will guarantee nothing. The real solution is to fix the other subsystem so it converts disallowed characters into their allowed representations, or does a CDATA wrapping of its own as a poor-man's version of the same.

So I'm guessing the the problem is not in a parser, but rather in a tool (a UI or something, maybe just a text editor) that allows users to input malformed data and doesn't correct it for them before passing it over. A compliant parser is part of the fix; but we don't know that that the offending subsystem uses a parser at all.


At 11:21 AM 1/12/2005, it was written:

> No the other Sub system does not use XSLT

The point they are trying to make is that provided the other 'Sub
system' is a compiant XML parser, then anything produced by a transform
using the xml output method should parse ok.

If the parsing is failing at the other end, then it's a problem with the
parser and a fix should be applied there rather than bodging your output
to a work around the non-comformity.

What characters made the parsing at the other end fail?  It could be
that you are mis-using disable-output-escaping?

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread