php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30218 xsltApplyOneTeplate warning c'se  
Submitted: 2004-09-24 13:10 UTC Modified: 2004-10-07 01:00 UTC
Votes:8
Avg. Score:4.6 ± 0.7
Reproduced:7 of 8 (87.5%)
Same Version:1 (14.3%)
Same OS:6 (85.7%)
From: robert dot dahlin at jerntorget dot se Assigned:
Status: No Feedback Package: XSLT related
PHP Version: 5.0.1 OS: Linux Slackware 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: robert dot dahlin at jerntorget dot se
New email:
PHP Version: OS:

 

 [2004-09-24 13:10 UTC] robert dot dahlin at jerntorget dot se
Description:
------------
xsltApplyOneTemplate is always shown if i have an &nbsp; followed by for example <xsl:if test="object"> in an xsl file.

xsltApplyOneTemplate: if was not compiled in (if can for example be apply-template or some other method), i've found that the problem seems to be an &nbsp; directly before the <xsl:if> or what ever "method" is causing the problem.

One way to get thru the problem is to use span tags around &nbsp;  like : <span>&nbsp;</span> but I don't think that it should be nessesary to do that.


Reproduce code:
---------------
  <td>&nbsp;<xsl:apply-templates select="object"/></td>

Expected result:
----------------
<td>(the value of object in xml)</td>


Actual result:
--------------
Warning: xsltApplyOneTemplate: if was not compiled in /www/include/xslttest.php on line 19
<td>(the value of object in xml)</td>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-24 13:13 UTC] robert dot dahlin at jerntorget dot se
Version info from phpifo() just in case.

Zend Engine v2.0.1
Zend Extension Manager v1.0.2
---------------
xml
XML Support  active  
XML Namespace Support  active  
libxml2 Version  2.5.11  
---------------
xsl
XSL  enabled  
libxslt Version  1.0.33  
libxslt compiled against libxml Version  2.5.11  
EXSLT  enabled  
libexslt Version  1.0.33  
---------------
 [2004-09-24 14:24 UTC] chregu@php.net
Can you please provide a full XSLT and XML example and did you declare the &nbsp; entity?
 [2004-09-28 11:06 UTC] robert dot dahlin at jerntorget dot se
XML and XSL example.
----------------------------
The same thing happens when i use for example &raquo; but if 
<span>&raquo;</span> it does not appear either. If i wan't it to be 
visible i have to use "&#187;" instead, but that's not OK.

Here is an example that does not work for me, I just get the following 
warnings.

Warning: xsltApplyOneTemplate: apply-templates was not compiled in 
xsltest.php on line 20

Warning: xsltApplyOneTemplate: apply-templates was not compiled in 
xsltest.php on line 20

//Robert Dahlin

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

XML:
-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"[ <!ENTITY nbsp 
"&#160;">]>
<document>
	<data>
		<sessid></sessid>
		<oid></oid>
		<object type="html" id="12345" pageOID="4"><![CDATA[TESTSTRING]]></object>
	</data>
</document>
-----------------------------
XSL:
-----------------------------
<!DOCTYPE wasp [
<!ENTITY lt     "&#38;#60;">
<!ENTITY gt     "&#62;">
<!ENTITY amp    "&#38;#38;">
<!ENTITY apos   "&#39;">
<!ENTITY quot   "&#34;">
<!ENTITY nbsp   "&#32;">
<!ENTITY raquo  "&#187;">
<!ENTITY deg    "&#176;">
<!ENTITY space  " ">
]>

<xsl:stylesheet  version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:include href='/www/xsl-includes/menu.xsl'/>
	<xsl:template match="/">
		<xsl:apply-templates select="document"/>
     </xsl:template>
     <xsl:template match="document">
         <html>
		    <xsl:apply-templates select="data"/>
         </html>
     </xsl:template>
			
	<xsl:template match="data">
     <body bgcolor="#FFFFFF" marginwidth="" topmargin="" marginheight="" 
leftmargin="" >
		<table border="0" background="" width="100%" cellspacing="0" 
cellpadding="0">
			<tr><td style="">&raquo;<xsl:apply-templates select="object"/></td></tr>
			<tr><td style="">&nbsp;<xsl:apply-templates select="object"/></td></tr>
		</table>
	</body>
	</xsl:template>
</xsl:stylesheet>
-----------------------------
 [2004-09-29 18:03 UTC] chregu@php.net
Currently can't reproduce that, can you please upgrade to a recent libxml2/libxslt version and see if the problem persists?
 [2004-10-07 01:00 UTC] 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".
 [2005-09-15 10:35 UTC] 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..
 [2006-03-20 10:06 UTC] 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);

?>
 [2006-08-09 20:46 UTC] 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
 [2007-01-09 10:29 UTC] s6urik at mail dot ee
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 13:01:30 2024 UTC