1--TEST--
2XSLTProcessor namespace mapper lifetime
3--EXTENSIONS--
4dom
5xsl
6--FILE--
7<?php
8
9$input = Dom\XMLDocument::createFromString(<<<XML
10<root>
11    <hello>World</hello>
12</root>
13XML);
14
15$xslXML = <<<XML
16<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
17    xmlns:php="http://php.net/xsl"
18    xmlns:xsdl="http://www.w3.org/1999/XSL/Transform">
19    <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
20    <xsl:template match="/root">
21        <xsl:value-of select="php:function('strtoupper', string(./hello))"/>
22    </xsl:template>
23</xsl:stylesheet>
24XML;
25
26$processor = new XSLTProcessor();
27// The fact that this is a temporary is important!
28// And yes, this is done twice on purpose to check for leaks
29$processor->importStylesheet(Dom\XMLDocument::createFromString($xslXML));
30$processor->importStylesheet(Dom\XMLDocument::createFromString($xslXML));
31$processor->registerPHPFunctions();
32echo $processor->transformToXML($input), "\n";
33
34?>
35--EXPECT--
36WORLD
37