|  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
 [2008-05-12 13:17 UTC] webermax2004 at yahoo dot fr
Here is a little XML file :

<?xml version="1.0" encoding="iso-8859-1"?>

and here is a little XSL stylesheet :

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:template match="input">
        <xsl:value-of select="." />

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

$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);

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 :


Doesn't it sound like a problem ?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-13 05:55 UTC]
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 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-2021 The PHP Group
All rights reserved.
Last updated: Sat Apr 17 09:01:24 2021 UTC