From:             bugs at weyert dot com
Operating system: Windows XP
PHP version:      4.3.7
PHP Bug Type:     XSLT related
Bug description:  libxsl engine doesn't take <xsl:output> into account

Description:
------------
I am using the domxml php extension for transforming XSLT, only I have
the problem that it doesnt take some of my <XSL:output> settings into
acocunt. For example when I set ident="yes" it doesn't ident the
output, and when I enabled the "omit-xml-declaration"-attribute this
<?xml> declaration is this availabe, which should not in the output.

The XSL:Output I use:

<xsl:output
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"

doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
        encoding="UTF-8"
        method="xml"
        indent="yes"
        omit-xml-declaration="yes"
    />

When I use the exact same XSLT file with php_xslt extension/Sablotron
the output is as expected both settings are taken into account. Does
anyone know if I am doing something wrong in my code? (see code below)
I think it's a bug in the php_xmldom extension, because when I use
xsltproc.exe (standalone version libxsl) the output is okay too.

I also tried it in PHP5RC3 using DOMXSLT (well, the DomDocument and
xsltprocessor classes) and in this one it also works as expected!


Reproduce code:
---------------
//
// Process the XML file together with the XSLT file to generate the
apporiate XHTML page...
$xml = domxml_open_mem( $result );    // create a XmlDocument-object
with the return xml file...
if ( !$xml ) {
    die( "Error while parsing the XML document. Application has
aborted." );
}

// assign the XSLT stylesheet for this XML document...
$xsl = domxml_xslt_stylesheet_file( $xsl_file );

// process the XSLT stylesheet with the assigned XML document...
$result = NULL;
$result = $xsl->process( $xml );

if ( DEBUG_MODE ) {           
    $result->dump_file( $output_file );
}
echo $result->dump_mem();
$xml->free(); // dispose the object


Expected result:
----------------
I would expect a omitted <?xml version=""?> line, and the XSLT output to
be formatted as seen in PHP5 RC3 or the sablotron XSLT library.

Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";><head><title>My
Title</title><script language="JavaScript" type="text/javascript"
src="./j/forms.js"/><style type="text/css" media="all">
                @import url( styles/allstyles.css );
        </style></head><body><div 

etc.

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

Reply via email to