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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC