RE: [xsl] Make safe XML

Subject: RE: [xsl] Make safe XML
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 3 Jul 2003 21:13:12 +0100
> I have a database that I'd like to persist to XML.

(How I hate that term. "Persist" is not a transitive verb. This isn't
just linguistic pedantry. In the old days we used to read and write
data. Then Malcolm Atkinson and co developed the idea that persistence
should be a property of the data, rather than something that happened
because of imperative actions by the programmer. The word caught on, but
people didn't get the idea behind it, and now they use the word as a
synonym for "write". Data persists, users don't persist it.) 


  I'm going 
> to use XSLT to insure that the data in each of the fields is 
> suited for XML.  Since I have complete control over this 
> data, should I:
> 
> a)  use XSLT to encode special characters
> b)  just throw all data into CDATA nodes?
> 

The only thing you need to do is to ensure that the data uses the XML
subset of Unicode, which means for example not using characters in the
C0 control block except for TAB/CR/NL. Everything else you can leave to
the serializer to handle for you. Escaping and unescaping of special
characters happen in the conversion from serial XML to tree structures,
and is therefore of no concern to an XSLT stylesheet.

Michael Kay

Michael Kay


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


Current Thread