1--TEST-- 2Request #30622 (XSLT: xsltProcessor->setParameter() cannot set namespace URI) 3--EXTENSIONS-- 4xsl 5--CREDITS-- 6Based on a test by <ishikawa at arielworks dot com> 7--FILE-- 8<?php 9 10$xmlDom = new DOMDocument(); 11$xmlDom->loadXML('<root/>'); 12 13$xslDom = new DOMDocument(); 14$xslDom->loadXML(<<<'XML' 15<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 16 xmlns:test="http://www.php.net/test"> 17 <xsl:param name="foo" select="'EMPTY'"/> 18 <xsl:param name="test:foo" select="'EMPTY'"/> 19 20 <xsl:template match="/root"> 21 <xsl:text>Namespace "NULL": </xsl:text> 22 <xsl:value-of select="$foo"/> 23 <xsl:text>, Namespace "http://www.php.net/test": </xsl:text> 24 <xsl:value-of select="$test:foo"/> 25 </xsl:template> 26</xsl:stylesheet> 27XML); 28 29$proc = new XSLTProcessor(); 30$proc->importStyleSheet($xslDom); 31 32echo "--- Set both empty and non-empty namespace ---\n"; 33 34$proc->setParameter("", "foo", "SET1"); 35$proc->setParameter("http://www.php.net/test", "foo", "SET2"); 36var_dump($proc->getParameter("", "foo")); 37var_dump($proc->getParameter("http://www.php.net/test", "foo")); 38 39print $proc->transformToXML($xmlDom); 40 41echo "--- Remove empty namespace entry ---\n"; 42 43var_dump($proc->removeParameter("", "foo")); 44var_dump($proc->getParameter("", "foo")); 45var_dump($proc->getParameter("http://www.php.net/test", "foo")); 46 47print $proc->transformToXML($xmlDom); 48 49echo "--- Remove non-empty namespace entry ---\n"; 50 51var_dump($proc->removeParameter("http://www.php.net/test", "foo")); 52var_dump($proc->getParameter("", "foo")); 53var_dump($proc->getParameter("http://www.php.net/test", "foo")); 54 55print $proc->transformToXML($xmlDom); 56 57echo "--- Set via array ---\n"; 58 59$proc->setParameter("", ["foo" => "SET1"]); 60$proc->setParameter("http://www.php.net/test", ["foo" => "SET2"]); 61 62print $proc->transformToXML($xmlDom); 63 64?> 65--EXPECT-- 66--- Set both empty and non-empty namespace --- 67string(4) "SET1" 68string(4) "SET2" 69<?xml version="1.0"?> 70Namespace "NULL": SET1, Namespace "http://www.php.net/test": SET2 71--- Remove empty namespace entry --- 72bool(true) 73bool(false) 74string(4) "SET2" 75<?xml version="1.0"?> 76Namespace "NULL": EMPTY, Namespace "http://www.php.net/test": SET2 77--- Remove non-empty namespace entry --- 78bool(true) 79bool(false) 80bool(false) 81<?xml version="1.0"?> 82Namespace "NULL": EMPTY, Namespace "http://www.php.net/test": EMPTY 83--- Set via array --- 84<?xml version="1.0"?> 85Namespace "NULL": SET1, Namespace "http://www.php.net/test": SET2 86