ID:               30218
 Comment by:       s6urik at mail dot ee
 Reported By:      robert dot dahlin at jerntorget dot se
 Status:           No Feedback
 Bug Type:         XSLT related
 Operating System: Linux Slackware 2.6
 PHP Version:      5.0.1
 New Comment:

The same problem, entities seems to be ignored always and in some cases
lead to "xsltApplyOneTemplate: value-of was not compiled" warning.

Zend Engine v2.2.0
PHP Version 5.2.0
DOM/XML API Version     20031129
libxml Version  2.6.26
libxslt Version         1.1.17
libexslt Version        1.1.17

Reproduce code:
---------------
$xsl = <<<EOT
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" encoding="UTF-8" indent="no"
 omit-xml-declaration="yes"  media-type="text/html" />

    <xsl:param name="myvar" select="defaultvalue" />

    <xsl:template match="/">
        <strong>&nbsp;My PHP variable : <xsl:value-of select="\$myvar"
/></strong>
    </xsl:template>

</xsl:stylesheet>
EOT;

$xml = <<<EOT
<?xml version="1.0"?>
<para>
    change me
</para>
EOT;

$xslt = new XSLTProcessor();
$xslt->setParameter('', 'myvar', 'variable');
$xslt->importStylesheet(DOMDocument::loadXML($xsl));
echo $xslt->transformToXml(DOMDocument::loadXML($xml));

Expected result:
----------------
<strong> My PHP variable : variable<strong>

Actual result:
--------------
Warning: XSLTProcessor::transformToXml(): xsltApplyOneTemplate:
value-of was not compiled in xsltest.php on line 30
<strong>My PHP variable : </strong>


As a workaround I am setting DOMDocument::substituteEntities to true
before loading XSL data.


Previous Comments:
------------------------------------------------------------------------

[2006-08-09 20:46:04] php at 6bitt dot com

I'm experiencing the same thing with this in my XSL:

&mdash;<xsl:apply-templates select="ssp:attributed/node()"/>

Using:
PHP 5.1.2
Zend Engine v2.1.0
PHP API         20041225
PHP Extension   20050922
Zend Extension  220051025
--
xml
XML Support     active
XML Namespace Support   active
libxml2 Version         2.6.23
--
xsl
XSL     enabled
libxslt Version         1.1.15
libxslt compiled against libxml Version         2.6.23
EXSLT   enabled
libexslt Version        1.1.15

------------------------------------------------------------------------

[2006-03-20 10:06:06] ross at golder dot org

Same here, PHP 5.0.5-2ubuntu1.2 (cli). Simple test case:

<?php

$xsl = "<?xml version=\"1.0\"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY whatever \"&#163;\">]>
<xsl:stylesheet version=\"1.1\"
                xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\";>
<xsl:template match=\"test\">
 <p>&whatever;<xsl:value-of select=\".\"/></p>
 <p>&whatever;<xsl:apply-templates/></p>
 <p>&whatever;No problem</p>
</xsl:template>
</xsl:stylesheet>
";

$xml = "<?xml version=\"1.0\"?>
<test>Something</test>
";

$xmldom = DOMDocument::loadXML($xml);
$xsldom = DOMDocument::loadXML($xsl);
$xsltproc = new XSLTProcessor();
$xsltproc->importStylesheet($xsldom);
echo $xsltproc->transformToXML($xmldom);

?>

------------------------------------------------------------------------

[2005-09-15 10:35:38] chabotc at xs4all dot nl

We have the same problem here. The problem happens when a NBSP is
situated before a <xsl:if> statement.

Also in the output, even if you enclose the &nbsp; with a
<span></span>, there's no &nbsp;'s or spaces..

We've tried defining <!ENTITY nbsp   "&#32;"> (or #160) but to no
avail, we get the same "xsltApplyOneTemplate: if was not compiled in"
error.

This is with libxml2-2.6.22, libxslt-1.1.15-1 and php-5.0.4 on a fully
up to date RedHat Enterprise Server 4.

>From phpinfo: 
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies
    with Zend Extension Manager v1.0.8, Copyright (c) 2003-2005, by
Zend Technologies
    with Zend Optimizer v2.5.8, Copyright (c) 1998-2004, by Zend
Technologies
    with Zend Debugger v4.0.0, Copyright (c) 1999-2005, by Zend
Technologies

libXML support  active
libXML Version  2.6.22
libXML streams  enabled

XSL     enabled
libxslt Version         1.1.15
libxslt compiled against libxml Version         2.6.22
EXSLT   enabled
libexslt Version        1.1.15

This does pose quite a problem to us for our upgrade path to php5, we
used sablotron's xslt under php4 for our products, and ofcourse the
html templates do contain quite a few &nbsp's..

------------------------------------------------------------------------

[2004-10-07 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2004-09-29 18:03:02] [EMAIL PROTECTED]

Currently can't reproduce that, can you please upgrade to a recent
libxml2/libxslt version and see if the problem persists?

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/30218

-- 
Edit this bug report at http://bugs.php.net/?id=30218&edit=1

Reply via email to