ID:               17596
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         XSLT related
 Operating System: Solaris 2.6
 PHP Version:      4.1.2
 New Comment:

Does this apply with 4.3.0-dev?


Previous Comments:
------------------------------------------------------------------------

[2002-06-06 10:22:11] [EMAIL PROTECTED]

The version of Sablotron I am using is 0.90, compiled via sources with
the following configure script:

#!/bin/sh
env LIBRARY_PATH=/www/lib \
env CPLUS_INCLUDE_PATH=/www/include \
  ./configure \
    --prefix=/www \
    --disable-javascript

------------------------------------------------------------------------

[2002-06-06 06:42:20] [EMAIL PROTECTED]

It should indeed - but they are rooted differently.

Could you list your sablotron version, so I can verify if it's fixed in
the current release?

------------------------------------------------------------------------

[2002-06-05 10:27:12] [EMAIL PROTECTED]

I tried specifying file:///absolute_path/htmlent.dtd as you suggested,
however this did not make any difference. The PHP cgi was still able to
correctly parse the XSL while the PHP DSO did not.

One thing I did notice was when I forgot to have the three slashes
after file:. When I ran the script via the webserver the page was
processed yet the PHP cgi had problems, specifically a Sablotron error
indicating it could not find htmlent.dtd in the path I gave. It seems
to me that with the PHP DSO it is ignoring the <!DOCTYPE ..> command.

Which is odd as the two should be using the same implementation of the
XSLT processor right?

------------------------------------------------------------------------

[2002-06-05 07:40:33] [EMAIL PROTECTED]

Could you test:
<!DOCTYPE xsl:stylesheet SYSTEM
"file:///absolute/path/to/htmlent.dtd">

I don't recall whether this was fixed in the current release - but make
sure this is the bug first.

If I recall correctly moving htmlent.dtd to on of apache/libexec or
apache/bin also 'fixes' the issue.

------------------------------------------------------------------------

[2002-06-04 10:55:46] [EMAIL PROTECTED]

The problem I am having is in specifying an external DTD within an XSL
file and having the PHP DSO parse it with the xslt_process function.
The xslt_process seems to ignore the external DTD reference (as seen in
the output from the output of the xslt_set_log function). If I was to
add these entities into the XSL file rather then referring to an
external DTD I would get the output I am looking for.

I do get the correct output from the same php script if I use the cgi
version of PHP. Which aside from the --with-apxs directive to the
configure script has the exact same options as the DSO.

Operating System: Solaris 2.6
     PHP Version: 4.1.2 (for both DSO and CGI)
  Apache Version: 1.3.9

Here is what I have for the two different configure scripts I use to
build PHP

------Configure for PHP as an Apache DSO---------
  ./configure \
    --with-apxs=/www/server/apache/bin/apxs \
    --with-config-file-path=/www/server/apache/conf \
    --with-pear=/www/server/apache/php/pear \
    --enable-libgcc \
    --enable-ftp \
    --enable-dbase \
    --enable-yp \
    --enable-bcmath \
    --enable-c9x-inline \
    --enable-calendar \
    --enable-inline-optimization \
    --enable-trans-sid \
    --with-pdflib=/www \
    --with-zlib=/www \
    --with-tiff-dir=/www \
    --with-png-dir=/www \
    --with-jpeg-dir=/www \
    --with-gd=/www \
    --with-yaz=/www \
    --with-sybase=/usr/local/sybase/client \
    --with-fdftk=/www \
    --with-regex=system \
    --with-ndbm \
    --with-dom=/www \
    --with-mcrypt=/www \
    --with-mhash=/www \
    --with-expat-dir=/www \
    --enable-xslt \
    --with-xslt-sablot=/www \
    --with-iconv=/www \
    --with-ldap=/www \
    --with-imap=/www
------Configure for PHP as an Apache DSO---------

------Configure for PHP as a cgi program---------
  ./configure \
    --with-config-file-path=/www/server/apache/conf \
    --with-pear=/www/server/apache/php/pear \
    --enable-libgcc \
    --enable-ftp \
    --enable-dbase \
    --enable-yp \
    --enable-bcmath \
    --enable-c9x-inline \
    --enable-calendar \
    --enable-inline-optimization \
    --enable-trans-sid \
    --with-pdflib=/www \
    --with-zlib=/www \
    --with-tiff-dir=/www \
    --with-png-dir=/www \
    --with-jpeg-dir=/www \
    --with-gd=/www \
    --with-yaz=/www \
    --with-sybase=/usr/local/sybase/client \
    --with-fdftk=/www \
    --with-regex=system \
    --with-ndbm \
    --with-dom=/www \
    --with-mcrypt=/www \
    --with-mhash=/www \
    --with-expat-dir=/www \
    --enable-xslt \
    --with-xslt-sablot=/www \
    --with-iconv=/www \
    --with-ldap=/www \
    --with-imap=/www
------Configure for PHP as a cgi program---------

The following is what I use to perform a make after running either of
the scripts above

-----make script for php-------
make clean

env LD_RUN_PATH=/www/lib make
-----make script for php-------

Below is the xml, xsl and php script I am using to produce the output

-------------test.xml-------------
<?xml version="1.0"?>
  <helloWorld>
    <hello>Hello</hello>
    <world>World</world>
  </helloWorld>
-------------test.xml-------------

-------------test.xsl-------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet SYSTEM "htmlent.dtd">

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:output method="html" indent="yes" encoding="US-ASCII"/>

  <xsl:template match="/helloWorld">
    <html>
      <head></head>
      <body bgcolor="#FFFFFF">
        <xsl:value-of
select="hello"/>&nbsp;&nbsp;&nbsp;x&#160;x<xsl:value-of
select="world"/><br/>
        <xsl:value-of select="hello"/>   &COPY;<xsl:value-of
select="world"/><br/>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>
-------------test.xsl-------------

-------snippet of htmlent.dtd--------
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY AElig "&#198;">
<!ENTITY AMP "&amp;#38;">
<!ENTITY Aacute "&#193;">
<!ENTITY Acirc "&#194;">
<!ENTITY Agrave "&#192;">
<!ENTITY Alpha "&#913;">
<!ENTITY Aring "&#197;">
<!ENTITY Atilde "&#195;">
<!ENTITY Auml "&#196;">
<!ENTITY Beta "&#914;">
<!ENTITY COPY "&#169;">
-------snippet of htmlent.dtd--------

-------------test.php-------------
<?
print parseXML("test.xml", "test.xsl");

function parseXML($xml, $xslt) {

        $objXML = xslt_create();
        xslt_set_log($objXML, true);
        xslt_set_log($objXML, "blah.log");

        $result = xslt_process($objXML, $xml, $xslt);

        if ($result) {
                $output = $result;
        }
        else {
                $output  = "Sorry, could not be transformed by
xsl/$template into";
                $output .= "  the $result variable the reason is that "
. xslt_error($objXML);
                $output .= " and the error code is " .
xslt_errno($objXML);
        }       
        xslt_free($objXML);
        return $output;
}
?>
-------------test.php-------------

Here is the output I get when running this script

----output from the xsl log file when viewing the script via the web
server---
Sablotron Message on line none, level log: Parsing
'file:/www/data/ip/bill/xsl/test.xsl'...
Sablotron Message on line none, level log: Parse done in 0.004 seconds
Sablotron Message on line none, level log: Parsing
'file:/www/data/ip/bill/xsl/test.xml'...
Sablotron Message on line none, level log: Parse done in 0.001 seconds
Sablotron Message on line none, level log: Executing stylesheet
'file:/www/data/ip/bill/xsl/test.xsl'...
Sablotron Message on line none, level log: Execution done in 0.002
seconds
----output from the xsl log file when viewing the script via the web
server---

----output from test.php when viewing the script via the web server---
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
charset=US-ASCII">
  </head>
  <body bgcolor="#FFFFFF">Hello&#160;World<br>HelloWorld<br>
  </body>
</html>
----output from test.php when viewing the script via the web server---

----output from the xsl log file when using the PHP cgi program---
Sablotron Message on line none, level log: Parsing
'file:/www/data/ip/bill/xsl/test.xsl'...
Sablotron Message on line none, level log: Parsing an external entity
from 'htmlent.dtd'
Sablotron Message on line none, level log: Parse done in 0.024 seconds
Sablotron Message on line none, level log: Parsing
'file:/www/data/ip/bill/xsl/test.xml'...
Sablotron Message on line none, level log: Parse done in 0.000 seconds
Sablotron Message on line none, level log: Executing stylesheet
'file:/www/data/ip/bill/xsl/test.xsl'...
Sablotron Message on line none, level log: Execution done in 0.008
seconds
----output from the xsl log file when using the PHP cgi program---

----output from test.php when using the PHP cgi program---
X-Powered-By: PHP/4.1.2
Content-type: text/html

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
charset=US-ASCII">
  </head>
  <body bgcolor="#FFFFFF">Hello&#160;&#160;&#160;&#160;World<br>Hello  
&#169;World<br>
  </body>
</html>
----output from test.php when using the PHP cgi program---

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17596&edit=1

Reply via email to