ID: 28992
User updated by: bugs at weyert dot com
Reported By: bugs at weyert dot com
Status: Open
Bug Type: XSLT related
Operating System: Windows XP
PHP Version: 4.3.7
New Comment:
The same problem seems to exist in 4.3.6 of PHP.
Previous Comments:
------------------------------------------------------------------------
[2004-07-02 13:21:57] bugs at weyert dot com
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 this bug report at http://bugs.php.net/?id=28992&edit=1