RE: [xsl] Transforming XML Blockquotes - Mixed Content - XSLT 1.0 Solution

Subject: RE: [xsl] Transforming XML Blockquotes - Mixed Content - XSLT 1.0 Solution
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 20 Apr 2005 20:40:51 +0100
> Perhaps there is a reason I should not solve it this way that 
> I am missing:
> 
 
> <xsl:template match="blockquote">
>   <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
>   <span class="block"><xsl:apply-templates/></span>
>   <xsl:text disable-output-escaping="yes">&lt;p 
> class="cont"&gt;</xsl:text>
> </xsl:template>

Yes, there are very good reasons why you shouldn't try to solve this problem
using disable-output-escaping. It's like using a stapler when you can't find
your cuff-links - handy in an emergency, but basically the wrong tool for
the job.

There's a deep architectural reason why d-o-e is bad, and there are
practical problems (rooted in the architectural causes) if you prefer a less
theoretical rationale.

The architectural reason is that XSLT as a language is designed to transform
trees into trees. The closure of the language - it's ability to process the
output of one transformation as the input to another, and hence the
composability and reusability of stylesheet code - depends on this property.
The d-o-e feature breaks this model, because it sends out-of-band messages
from the transformation code direct to the serializer, that destroy the
principle that the result tree forms the interface between the transformer
and the serializer.

The practical consequences are that d-o-e is not supported by all XSLT
processors, and those processors that do support it don't support it in all
situations; and that stylesheets that use it can't be combined with other
stylesheets to form a processing pipeline. Hence you might achieve your
immediate goal, but only by sacrificing portability and reusability.

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

Current Thread