1--TEST-- 2Auto-registration of namespaces in XSL stylesheet with new DOM 3--EXTENSIONS-- 4dom 5xsl 6--SKIPIF-- 7<?php 8require __DIR__.'/skip_upstream_issue113.inc'; 9?> 10--FILE-- 11<?php 12 13$sheet = Dom\XMLDocument::createFromString(<<<XML 14<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 15 xmlns:php="http://php.net/xsl" 16 xmlns:str="http://exslt.org/strings" 17 xmlns:xsdl="http://www.w3.org/1999/XSL/Transform"> 18 <xsl:output method="text" omit-xml-declaration="yes" indent="no"/> 19 <xsl:template match="/root"> 20 <xsl:value-of select="php:function('strtoupper', string(./hello))"/> 21 <xsl:value-of select="test:reverse(string(./hello))"/> 22 </xsl:template> 23</xsl:stylesheet> 24XML); 25 26// Make sure it will auto-register urn:test 27$sheet->documentElement->append($sheet->createElementNS('urn:test', 'test:dummy')); 28 29$input = Dom\XMLDocument::createFromString(<<<XML 30<root> 31 <hello>World</hello> 32</root> 33XML); 34 35$processor = new XSLTProcessor(); 36$processor->importStylesheet($sheet); 37$processor->registerPHPFunctions(); 38$processor->registerPHPFunctionNS('urn:test', 'reverse', 'strrev'); 39echo $processor->transformToXML($input), "\n"; 40 41?> 42--EXPECT-- 43WORLDdlroW 44