/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/xsl/tests/cloneDocument.phpt
45 строк
983 B
Niels Dossche
Add missing properties to xsl stub (#12334)
06 окт 2023, 18:42
Не верифицирован
06 окт 2023, 18:42
3bb56ae
Код
Авторство
О чём код?
--TEST-- cloneDocument --EXTENSIONS-- xsl dom --FILE-- <?php $xml = new DOMDocument; $xml->loadXML('<?xml version="1.0"?><root><foo>hello</foo></root>'); function test() { global $xml; $xml->documentElement->firstChild->textContent = "bye"; } $xsl = new DOMDocument; $xsl->loadXML(<<<XML <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" version="1.0"> <xsl:template match="/root"> <xsl:value-of select="php:function('test')"/> <xsl:value-of select="//root/foo"/> </xsl:template> </xsl:stylesheet> XML); $xslt = new XSLTProcessor; $xslt->registerPHPFunctions(); $xslt->cloneDocument = true; $xslt->importStylesheet($xsl); echo $xslt->transformToXml($xml); $xslt = new XSLTProcessor; $xslt->registerPHPFunctions(); $xslt->cloneDocument = false; $xslt->importStylesheet($xsl); echo $xslt->transformToXml($xml); ?> --EXPECT-- <?xml version="1.0"?> hello <?xml version="1.0"?> bye