|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-02-01 11:14 UTC] maximgb at is-a dot ru
Description: ------------ I have two stylesheets first one with xsl:output tag only, where method="XML" and encoding="windows-1251", second one which imports the first one and where all other templates are stored. When I use <xsl:import href='first.xsl' /> then all russian characters after transformation become XML entities, when I use <xsl:include href="first.xsl' /> then everything is ok. All XML files involved in transformation has following xml declaration <?xml version="1.0" encoding="windows-1251"?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 21:00:02 2025 UTC |
bug.php ------- <?php $source = new DOMDocument(); $source->load("bugsrc.xml"); $transform = new DOMDocument(); $transform->load('bug2.xsl'); $xslt = new XSLTProcessor(); $xslt->importStyleSheet($transform); file_put_contents("bugdest.xml", $xslt->transformToXML($source)); ?> bugsrc.xml ---------- <?xml version="1.0" encoding="windows-1251"?> <bug/> bug1.xsl -------- <?xml version="1.0" encoding="windows-1251"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="windows-1251" indent="yes" omit-xml-declaration="no" /> </xsl:stylesheet> bug2.xsl -------- <?xml version="1.0" encoding="windows-1251"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="bug1.xsl"/> <!--<xsl:import href="bug1.xsl"/>--> <xsl:template match="bug"> <bug message="Вот тут не должно быть XML сущностей" /> </xsl:template> </xsl:stylesheet>Put <xsl:output method="xml" encoding="windows-1251" indent="yes" omit-xml-declaration="no" /> into bug2.xsl and it works. Besides from that, the output produced is correct, even 'though not really human readable (but if you open it up in Firefox, it shows the characters just fine) xsltproc has the same behaviour, so if you think this is a bug, you have to complain to the libxslt guys (i'm too lazy to look up the specs right now)