1--TEST--
2Test the basics to function XSLTProcessor::transformToDoc().
3--CREDITS--
4Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
5--EXTENSIONS--
6xsl
7--FILE--
8<?php
9$xml = <<<EOB
10<allusers>
11 <user>
12  <uid>royopa</uid>
13 </user>
14</allusers>
15EOB;
16$xsl = <<<EOB
17<?xml version="1.0" encoding="UTF-8"?>
18<xsl:stylesheet version="1.0"
19     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20     xmlns:php="http://php.net/xsl">
21<xsl:output method="html" encoding="utf-8" indent="yes"/>
22 <xsl:template match="allusers">
23  <html><body>
24    <h2>Users</h2>
25    <table>
26    <xsl:for-each select="user">
27      <tr><td>
28        <xsl:value-of
29             select="php:function('ucfirst',string(uid))"/>
30      </td></tr>
31    </xsl:for-each>
32    </table>
33  </body></html>
34 </xsl:template>
35</xsl:stylesheet>
36EOB;
37
38$xmldoc = new DOMDocument('1.0', 'utf-8');
39$xmldoc->loadXML($xml);
40
41$xsldoc = new DOMDocument('1.0', 'utf-8');
42$xsldoc->loadXML($xsl);
43
44$proc = new XSLTProcessor();
45$proc->registerPHPFunctions();
46$proc->importStyleSheet($xsldoc);
47
48var_dump($proc->transformToDoc($xmldoc)->firstChild->tagName);
49?>
50--EXPECT--
51string(4) "html"
52