From: korisu at gmail dot com Operating system: Windows Vista PHP version: 5.2.1 PHP Bug Type: XSLT related Bug description: Built-in template rule for processing-instruction()|comment() missing
Description: ------------ The default (built-in) template for processing instructions and comments is not implemented in the current version of libxslt. The template should be as follows: <xsl:template match="processing-instruction()|comment()"/> This is defined in the W3C recommendation (http://www.w3.org/TR/xslt#built-in-rule). The files used in the test code can be found here: http://scott.trenda.net/xml/php-bug-report/test.php (source pasted to "Reproduce Code" section) http://scott.trenda.net/xml/php-bug-report/checkerboard.xml http://scott.trenda.net/xml/php-bug-report/checkerboard.xsl http://scott.trenda.net/xml/php-bug-report/checkerboard2.xsl This has been reproduced on Windows Vista, running 5.2.1 through IIS7 (ISAPI), and on Linux running 5.1.2 through Apache 2.0 (http://scott.trenda.net/phpinfo.php). Reproduce code: --------------- <?php $xslt = new xsltProcessor; ?> <div> <span>Incorrect transformation:</span> <div> <?php $xslt->importStyleSheet(DOMDocument::load("checkerboard.xsl")); echo $xslt->transformToXML(DOMDocument::load("checkerboard.xml")); ?> </div> <span>Correct transformation (built-in stylesheet explicitly defined in checkerboard2.xsl)</span> <div> <?php $xslt->importStyleSheet(DOMDocument::load("checkerboard2.xsl")); echo $xslt->transformToXML(DOMDocument::load("checkerboard.xml")); ?> </div> </div> Expected result: ---------------- The first example does not have a template defined for processing instructions and comments; if you view the source, you will see the xml-stylesheet processing instruction from the source, and the test comment following it: <?xml-stylesheet type="text/xsl" href="xslt/checkerboard.xsl"><!-- Testing comment template --> The second example has the template explicitly defined as per the W3C Recommendation; its source has neither the xml-stylesheet processing instruction nor the test comment. Actual result: -------------- <div> <span>Incorrect transformation:</span> <div> <?xml-stylesheet type="text/xsl" href="xslt/checkerboard.xsl"><!-- Testing comment template --><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> table { border: 1px solid gray; border-collapse: collapse; } td { width: 40px; height: 40px; } .cell0 { background-color: black; } .cell1 { background-color: white; } </style> </head> <body><table> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> </table></body> </html> </div> <span>Correct transformation (built-in stylesheet explicitly defined in checkerboard2.xsl)</span> <div> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> table { border: 1px solid gray; border-collapse: collapse; } td { width: 40px; height: 40px; } .cell0 { background-color: black; } .cell1 { background-color: white; } </style> </head> <body><table> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> <tr> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> </tr> <tr> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> <td class="cell1"></td> <td class="cell0"></td> </tr> </table></body> </html> </div> </div> -- Edit bug report at http://bugs.php.net/?id=40838&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40838&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40838&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40838&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40838&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40838&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40838&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40838&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40838&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40838&r=support Expected behavior: http://bugs.php.net/fix.php?id=40838&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40838&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40838&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40838&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40838&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40838&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40838&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40838&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40838&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40838&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40838&r=mysqlcfg
