php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28992 libxsl engine doesn't take <xsl:output> into account
Submitted: 2004-07-02 13:21 UTC Modified: 2004-07-02 15:42 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: bugs at weyert dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 4.3.7 OS: Windows XP
Private report: No CVE-ID: None
 [2004-07-02 13:21 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-02 14:46 UTC] bugs at weyert dot com
The same problem seems to exist in 4.3.6 of PHP.
 [2004-07-02 15:42 UTC] chregu@php.net
you have to use

result_dump_mem()

see

http://ch.php.net/manual/en/function.domxsltstylesheet-result-dump-mem.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC