The xslbug.xsl, included in the zip-file documents 2 separate problems
with the 1.63 version of LibXSLT. Be advised that the LibXSLT module is
effectively unuseable with output method = text as follows:
1) < and > are always escaped unless you use the d-o-e option.
This is just wrong.
2) the 'd-o-e' option inserts a newline before and after the
text-element which is wrong and additionally makes this hack unuseable
as a workaround.
Summary of the files included in the zip file
apply.pl: a simple perl script which loads libxslt and libxml, and
process a list of files using the first arg: perl -w apply.pl xsl-file
xml-file+
xslbug.xml: a trivial single-element xml file.
xslbug.xsl: 3 simple, annotated output sequences which expose the two
problems.
console.txt: contains the output from running xsltproc, running LibXSLT,
and the associated version information for all the modules and programs
used.
The workaround for this problem is to call the XSLTPROC module directly
on file versions of the inputs and then load the results as needed for
further processing.
Subject: | xslbug.xsl |
<!-- xslbug.xml:
<?xml version="1.0"?>
<DUMMY>
</DUMMY>
-->
<!-- xslbug.xsl: -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<!-- stylesheet outputs
<?xml version="1.0"?>
how can this be correct behavior with the 'method = text ??
-->
<xsl:template match="/" >
<!-- desired output = '"testid: <hello>goodbye"' -->
SOD"simple-text: <hello>goodbye"EOD
<!-- simple-6ext ouputs
SOD"simple-text: <hello>goodbye"EOD
notice " is translated, while the <,$gt; are not
there should be no output escaping as indicated by youyr reference
(it's this failure that led me to try a CDATA section)
-->
SOD<![CDATA["cdata-section: <hello>goodbye"]]>EOD
<!-- cdata-section outputs
SOD"cdata-section: <hello>goodbye"EOD
notice < and > in the CDATA section are escaped. while the quotes are passed through.
how can this be correct behavior
(this failure led me to try d-o-e)
-->
SOD<xsl:text disable-output-escaping="yes">"d-o-e-text-element: <hello>goodbye"</xsl:text>EOD
<!-- d-o-e outputs
SOD
"d-o-e-text-element: <hello>goodbye"
EOD
so this is the behavior I expected without d-o-e enabled except I get newlines
before and after the text element: which makes it totally useless as a workaround.
-->
</xsl:template>
</xsl:stylesheet>
<!-- this is the complete unedited output
C:\myTk\dd>xr apply xslbug xslbug
<?xml version="1.0"?>
SOD"simple-text: <hello>goodbye"EOD
SOD"cdata-section: <hello>goodbye"EOD
SOD
"d-o-e-text-element: <hello>goodbye"
EOD
C:\myTk\dd>
-->
Subject: | xslbug.zip |