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
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: maximchick at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 17:01:24 2019 UTC