Cannot make transformation with stylesheet, which has entity inside xsl:text node. I've got no errors and empty output if I put &some; outside xsl:text node.
test.php
$xml = new DOMDocument;
$xml->load('test.xml');
$xsl = new DOMDocument;
$xsl->load('test.xsl');
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
test.xml
<?xml version="1.0" ?>
<test>123</test>
test.xsl
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY some "22323"> ]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:text>&some;</xsl:text>
</xsl:template>
</xsl:stylesheet>
Got error:
Warning: XSLTProcessor::importStylesheet(): xsltParseTemplateContent: xslt:text content problem in /Users/stexe/Repos/umi.cms.2/test.php on line 13
Call Stack:
0.0003 226288 1. {main}() /Users/stexe/Repos/umi.cms.2/test.php:0
0.0009 228424 2. XSLTProcessor->importStylesheet() /Users/stexe/Repos/umi.cms.2/test.php:13
Os X, PHP 5.4.45 (Homebrew)
PHP info:
libxml2 Version => 2.9.5
ibxslt Version => 1.1.29
libxslt compiled against libxml Version => 2.9.4
&, is a special XML entity and its symbol cannot standalone. And do note XML entities are not the same as HTML entities.