|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43299 xsl:document('') function gaves unexpected result on automatically generated te
Submitted: 2007-11-14 20:03 UTC Modified: 2007-11-14 23:43 UTC
From: maximchick at gmail dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.2.5 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2007-11-14 20:03 UTC] maximchick at gmail dot com
Take a look on a bug:
which was incorrectly marked as "bogus"

I'm talking exactly what i'm talking. Please double check what the function document('') should do. 

take attention to the line:


which clones xsl:template node, so we have two <xsl:template match="/"> nodes in result template, and you're right only one will match, BUT this template parses ITSELF:

<xsl:for-each select="document('')//xsl:*">

You can comment line:

to have a little understanding what i'm talking about.

So, it should find TWO <xsl:template match="/"/> nodes, and output should be:


And i surprize you: when the template DOM initialized by DOMDocument::loadXML() instead of DOMDocument::load() it gave the expected output.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-14 20:15 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

still bogus and you even explain and demonstrate why.
$xml (the data to be transformed) != $xsl (the stylesheet you ended up modifying)
 [2007-11-14 23:43 UTC]
There happens to be a libxslt bug occurring here under certain circumstances, so this report still bogus and being handled there.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 19 02:01:23 2021 UTC