From:             tenkei at mailinator dot com
Operating system: Linux
PHP version:      5.2.9
PHP Bug Type:     XSLT related
Bug description:  XSLTProcessor::transformToDoc output missing linebreaks

Description:
------------
An XSLTProcessor object imports a stylesheet that will output XML using
the XHTML1 strict doctype system, then has its transformToDoc() method
called on a DOMElement object.  The DOMDocument object returned by the
method will not produce XML with linebreaks or indentation when saveXML()
is called.

Reproduce code:
---------------
[ XSL ]
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
    <xsl:template match="/Test">
        <html>
            <head>
                <title>Test Page</title>
            </head>
            <body>This is a test.</body>
        </html>
    </xsl:template>
</xsl:stylesheet>

[ XML ]
<Test />

[ PHP ]
$proc = new XSLTProcessor();
$xslt = new DOMDocument();
$xslt->load( 'transform.xsl' );
$proc->importStylesheet( $xslt );
$xml = new DOMDocument();
$xml->load( 'file.xml' );
$doc = $proc->transformToDoc( $xml );
print $doc->saveXML();

Expected result:
----------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
    <head>
        <title>Test Page</title>
    </head>
    <body>This is a test.</body>
</html>

Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";><head><title>Test
Page</title></head><body>This is a test.</body></html>

-- 
Edit bug report at http://bugs.php.net/?id=48009&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48009&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48009&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48009&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48009&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48009&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48009&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48009&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48009&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48009&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48009&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48009&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48009&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48009&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48009&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48009&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48009&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48009&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48009&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48009&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48009&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48009&r=mysqlcfg

Reply via email to