RE: [xsl] weird formatting and characters with <xsl:text disable-output-escaping>

Subject: RE: [xsl] weird formatting and characters with <xsl:text disable-output-escaping>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 26 Apr 2005 22:26:23 +0100
> Shoot just realized we can't even do that as InDesign uses mandatory
> nested tags to define paragraph styles, like <this is a tag<this is a
> nested tag>>, so perhaps I will have to look at this all another way??
> 

This is the general problem of generating output in a format that has a
passing resemblance to XML but is not actually XML. There are a surprising
number of such formats still in use (some of them, of course, are valid
SGML). There are a number of choices available:

(a) define an XML representation of the required output and generate that
using XSLT. Then write a converter in some other language to convert this
XML to the target form. 

(b) write a stylesheet that outputs text (xsl:output method="text")

(c) write a stylesheet that outputs a mixture of XML and text (xsl:output
method="xml" with disable-output-escaping). Messy but sometimes pragmatic.

(d) implement a custom serialization method. If you have some Java skills,
this isn't as daunting as it may sound, for example in Saxon you can do it
by subclassing the serializer that comes with the product.

The main thing is to try and keep the peculiarities contained to as small a
part of your code as you can. I'd suggest going for (a) if you can.

Michael Kay
http://www.saxonica.com/

Current Thread