php.net |  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
Description:
------------
Take a look on a bug: http://bugs.php.net/bug.php?id=43289
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:

$xpath->query('//xsl:stylesheet')->item(0)->appendChild($xpath->query('/
/xsl:template')->item(0)->cloneNode(true));

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:
//$xml->load('/tmp/template.xsl');

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

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

xsl:stylesheet
xsl:output
xsl:template
xsl:for-each
xsl:value-of
xsl:text
xsl:template
xsl:for-each
xsl:value-of
xsl:text

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


Patches

Pull Requests

History

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

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] rrichards@php.net
There happens to be a libxslt bug occurring here under certain circumstances, so this report still bogus and being handled there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC