From:             x-penguin at tut dot by
Operating system: Linux
PHP version:      5CVS-2004-08-12 (dev)
PHP Bug Type:     XSLT related
Bug description:  XSLTProcessor don't process 'omit-xml-declaration' in 'xsl:output'

Description:
------------
PHP Version 5.1.0-dev, configure with:
'./configure' '--prefix=/usr/' '--with-apxs2' '--with-gettext'
'--with-iconv' '--with-mysql' '--enable-mbstring=ru' '--enable-mbregex'
'--enable-mbstr-enc-trans' '--disable-short-tags' '--with-xsl'
'--with-libxml' '--without-sqlite' '--enable-soap'

libxslt Version     1.1.8
libxml Version      2.6.11
libexslt Version    1.1.8

apache 2.0.48

XSLTProcessor don't process 'omit-xml-declaration' in 'xsl:output'. If
'omit-xml-declaration' set to 'yes' than xml declaration will be output;
when set to 'no', than xml declaration will be output too.


Reproduce code:
---------------
<?php
$xsl = new DomDocument();
$xsl->loadXML(
'<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:php="http://php.net/xsl";>
<xsl:output method="xml" omit-xml-declaration="no"/>
<xsl:template match="/">
    <xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>'
);

$xml = new DomDocument;
$xml->loadXML('<?xml version="1.0"?><null>test</null>');

$proc = new XSLTProcessor();
$proc->importStylesheet($xsl);

$dom = $proc->transformToDoc($xml);
echo $dom->saveXML();
?>

Expected result:
----------------
test

Actual result:
--------------
<?xml version="1.0"?>
test

-- 
Edit bug report at http://bugs.php.net/?id=29623&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29623&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29623&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29623&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29623&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29623&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29623&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29623&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29623&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29623&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29623&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29623&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29623&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29623&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29623&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29623&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29623&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29623&r=float

Reply via email to