php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44971 XSLT does does convert "&lt;" into "<" without disable-output-escaping
Submitted: 2008-05-12 13:17 UTC Modified: 2008-05-13 05:55 UTC
From: webermax2004 at yahoo dot fr Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.2CVS-2008-05-12 (CVS) OS: Windows XP Pro
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: webermax2004 at yahoo dot fr
New email:
PHP Version: OS:

 

 [2008-05-12 13:17 UTC] webermax2004 at yahoo dot fr
Description:
------------
Here is a little XML file :

<?xml version="1.0" encoding="iso-8859-1"?>
<input>&lt;</input>

and here is a little XSL stylesheet :

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="input">
    <output>
        <xsl:value-of select="." />
    </output>
</xsl:template>
</xsl:stylesheet>

and here is a little PHP code which transforms the XML document using the XSL stylesheet and displays the nodeValue of the documentElement :

<html>
<body>
<?php
$xmlDocument = new DOMDocument ();
$xmlDocument->load ("test.xml");
$xmlStylesheet = new DOMDocument ();
$xmlStylesheet->load ("test.xsl");
$xslTransfom = new XSLTProcessor ();
$xslTransfom->importStylesheet ($xmlStylesheet);
$xmlDocument = $xslTransfom->transformToDoc ($xmlDocument);
echo ($xmlDocument->documentElement->firstChild->nodeValue);
?>
</body>
</html>

My surprise : the output is "<" instead of "&lt;", which means that the entity has been converted. This should not have happened unless I had specified the disable-output-escaping attribute in the <xsl:value-of>, right ? By the way, if I display the contents of the document after the transformation :

echo ($xmlDocument->saveXML ());

then the "&lt;" is not converted :

<output>&lt;</output>

Doesn't it sound like a problem ?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-13 05:55 UTC] chregu@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Not a bug. the nodeValue of that TextNode is actually "<"

If you do 

echo $xmlDocument->saveXML();

you'll see, that it's correctly encoded
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 21:01:23 2019 UTC