php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36549 XML,libxml,libxslt - unable to assign node-set to xslt variable
Submitted: 2006-02-27 19:50 UTC Modified: 2006-02-27 20:14 UTC
From: kwmccabe at yahoo dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.2 OS: RedHat 7.x
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kwmccabe at yahoo dot com
New email:
PHP Version: OS:

 

 [2006-02-27 19:50 UTC] kwmccabe at yahoo dot com
Description:
------------
Unable to assign node-set to xslt variable.  

<xsl:variable name="test">
  <root>
    <node>one</node>
    <node>two</node>
  </root>
</xsl:variable>

<xsl:for-each select="$test/*">
  ...
</xsl:for-each>

The variable should contain a node-set; instead it contains just a string.  This throws an "Invalid type" error (see below) when trying to iterate the (sub)nodes using for-each.

Reproduce code:
---------------
environment:  
http://www.tenandtwo.com/test_xsl/info.php

run:
http://www.tenandtwo.com/test_xsl/bug.php

source:
http://www.tenandtwo.com/test_xsl/show_source.php?file=/test_xsl/bug.php
http://www.tenandtwo.com/test_xsl/show_source.php?file=/test_xsl/bug.xsl

Expected result:
----------------
TEST: 
****

xsl:value-of select="$test": 
onetwo

xsl:copy-of select="$test": 
<RESULT>
  <node>one</node>
  <node>two</node>
</RESULT>

xsl:for-each select="$test/*": 
name=RESULT; value=
name2=node; value2=one
name2=node; value2=two
****

DONE


Actual result:
--------------
Warning: XSLTProcessor::transformToXml() [function.transformToXml]: Invalid type in /var/www/vhosts/tenandtwo.com/httpdocs/test_xsl/bug.php on line 39

TEST: 
****

xsl:value-of select="$test": 
onetwo

xsl:copy-of select="$test": 
<RESULT><node>one</node><node>two</node></RESULT>

xsl:for-each select="$test/*": 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-27 20:14 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

Read up on exslt and node-set
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 07:00:01 2026 UTC