Re: [xslt] disable-output-escaping disfunctional
- From: Gabor Hojtsy <gabor hojtsy hu>
- To: xslt gnome org
- Subject: Re: [xslt] disable-output-escaping disfunctional
- Date: Mon, 21 Apr 2003 19:29:34 +0200
>>As disable-output-escaping is a local statement for the xslt processor,
>>it cannot be overriden by it's context. Therefore I still strongly
>>beleive that I have found a bug in xsltproc/libxml and not a bug in the
>>DocBook sheets.
>
> Have you read the following from the spec 16.4 Disabling Output Escaping:
>
> "It is an error for output escaping to be disabled for a text node that
> is used for something other than a text node in the result tree. Thus,
> it is an error to disable output escaping for an xsl:value-of or xsl:text
> element that is used to generate the string-value of a comment, processing
> instruction or attribute node; it is also an error to convert a result
> tree fragment to a number or a string if the result tree fragment
> contains a text node for which escaping was disabled. In both cases,
> an XSLT processor may signal the error; if it does not signal the error,
> it must recover by ignoring the disable-output-escaping attribute."
>
> So basically if you use disable-output-escaping for something which
> is not a text node immediately used as output then, it is normal for
> libxslt/xsltproc to ignore that statement completely. Like if you use
> it to build a variable or a result value tree passed to a node-set()
> extension then this is guaranteed to be ignored rightfully.
> In general the rule is *do not use disable-output-escaping* !
> It just prove you're trying to do something which is wrong from a
> structure transformation point of view.
Well, maybe what I am trying to do is wrong. :( I have read that
statement above, *but* was unaware of the method used to generate
separate chunks. The PHP manual from it's 13MB source size comes down to
19MB of PHP files (~3200 files). To generate these files,
<exsl:document> is used, and the content of the chunks is copied there
with <xsl:copy-of>, which is probably very similarly handled as
<xsl-value-of> mentioned in the spec. While the template itself
generates a text node, it is not immediately sent out to the output, but
stored in a variable for chunking, so it is affected by the rule you
quoted above.
Well, it is at least clear to me, that there is no way to make that
disable-output-escaping work there, and we need to add a postprocessor
that runs after xsltproc to make the output ready for PHP.
Just a very simple test case for reference, for anybody finding this
message in a search engine searching for a solution ;)
XSLT:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="a">
<xsl:param name="this-is-escaped">
<xsl:text disable-output-escaping="yes">></xsl:text>
</xsl:param>
<xsl:value-of select="$this-is-escaped"/>
</xsl:template>
</xsl:stylesheet>
XML:
<a/>
This outputs >, regardless of the disable-output-escaping="yes"
setting, and as you pointed out, this is perfectly in conformance with
the XSLT spec.
I am so said coming to this conclusion, but I am closer to a solution at
least... Thanks for your help, and excuse me for waisting your time,
Goba
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]