php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26242 XSLT instruction comment() doesn't work when libxslt is used
Submitted: 2003-11-13 12:05 UTC Modified: 2003-12-03 11:26 UTC
From: apetrenko at tmsoft-ltd dot kiev dot ua Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.4 OS: Windows
Private report: No CVE-ID: None
 [2003-11-13 12:05 UTC] apetrenko at tmsoft-ltd dot kiev dot ua
Description:
------------
XSLT instruction comment() doesn't work when libxslt is used. But when I've replaced php extension php_domxml.dll by old version (from php 4.3.2) all was worked.

Reproduce code:
---------------
$xml = '<?xml version="1.0"?>
<root>
	<A>
		<!-- COMMENT 1 //-->
	</A>
</root>
';

$xslt = '
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="windows-1251"/>
<xsl:template match="@*|node()|comment()">
	<xsl:copy><xsl:apply-templates select="@*|node()|comment()" /></xsl:copy>
</xsl:template>
</xsl:stylesheet>
';

$xml_obj = domxml_open_mem ($xml);
$xslt_obj = domxml_xslt_stylesheet ($xslt);
$result_obj = $xslt_obj->process ($xml_obj);
$result = $xslt_obj->result_dump_mem ($result_obj);
echo htmlspecialchars ($result);

Expected result:
----------------
<?xml version="1.0" encoding="windows-1251"?> <root> <A> <!-- COMMENT 1 //--> </A> </root> 

Actual result:
--------------
<?xml version="1.0" encoding="windows-1251"?> <root> <A> </A> </root> 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-13 12:59 UTC] rrichards@php.net
Can you send a link to your phpinfo output? as I can't reproduce this
 [2003-11-14 03:24 UTC] apetrenko at tmsoft-ltd dot com
Hello.
This note was sent to wrong section (for ALL user). May be you'll receive it twice.

There is a new info: it works properly in CGI mode but incorrectly in API mode (I use Apache 1.3.27).

phpinfo reference:
http://www.aesthetic.com.ua/misc/phpinfo.htm
Sorry for some skipped info - this was done by demand of our system administrator.
 [2003-11-14 04:48 UTC] apetrenko at tmsoft-ltd dot com
Furthermore if I remove comment() instruction from XSTL template the result in CGI mode is correct!

The part of XSLT template:
<xsl:template match="@*|node()">
  <xsl:copy><xsl:apply-templates select="@*|node()"/>
</xsl:copy>

The result:
<?xml version="1.0" encoding="windows-1251"?> <root> <A> <!-- COMMENT 1 //--> </A> </root>
 [2003-11-17 18:35 UTC] sniper@php.net
Try disabling the Zend Optimizer first..

 [2003-11-19 10:38 UTC] apetrenko at tmsoft-ltd dot com
Trying...
It has no effect.
 [2003-11-30 04:23 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

And make sure you first remove ALL old php dlls before installing the snapshot.

 [2003-12-01 07:34 UTC] apetrenko at tmsoft-ltd dot com
There are no changes. :-(( What do I wrong? All dll's were deleted first. Then I unpacked files into php dir and restarted web server.
 [2003-12-01 08:44 UTC] sniper@php.net
Tested with latest CVS myself on Windows and could not reproduce with the provided example script.

Make sure you REALLY replaced ALL the related DLLs. INCLUDING the libxslt.dll and libxml2.dll and iconv.dll..

 [2003-12-03 11:26 UTC] apetrenko at tmsoft-ltd dot kiev dot ua
The files libxslt.dll and libxml2.dll are not present in package php4-win32-STABLE-latest.zip (downloaded 01.12.2003). Moreover I can't find them on my hard disk...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 00:01:30 2024 UTC