xref: /php-src/ext/xsl/tests/xinclude/xinclude.phpt (revision 3bb56ae4)
1--TEST--
2doXInclude
3--EXTENSIONS--
4xsl
5dom
6--FILE--
7<?php
8
9chdir(__DIR__);
10
11$xml = new DOMDocument;
12$xml->loadXML('<?xml version="1.0"?><root/>');
13
14$xsl = new DOMDocument;
15$xsl->loadXML(<<<XML
16<?xml version="1.0"?>
17<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
18    <xsl:template match="/root">
19        <container>
20            <xsl:value-of select="document('data.xml')/data/content"/>
21        </container>
22    </xsl:template>
23</xsl:stylesheet>
24XML);
25
26$xslt = new XSLTProcessor;
27$xslt->doXInclude = true;
28$xslt->importStylesheet($xsl);
29echo $xslt->transformToXml($xml);
30
31$xslt = new XSLTProcessor;
32$xslt->doXInclude = false;
33$xslt->importStylesheet($xsl);
34echo $xslt->transformToXml($xml);
35
36?>
37--EXPECT--
38<?xml version="1.0"?>
39<container>This is sample content</container>
40<?xml version="1.0"?>
41<container/>
42