Project

Profile

Help

Bug #4540

closed

Serialization of processing-instructions with method="html"

Added by Michael Kay about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Serialization
Sprint/Milestone:
-
Start date:
2020-05-04
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
10
Fixed in Maintenance Release:
Platforms:

Description

In Saxon 10.0, the following stylesheet

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:php="http://php.net/xsl"
    exclude-result-prefixes="php" version="1.0">
    <xsl:output omit-xml-declaration="yes" method="html" />
    <xsl:template match="/">
        <html> 
            <head>
            </head>
            <body bgcolor="#000">
                    <div class="main" style="background:lightblue;">
                        <xsl:processing-instruction name="php">
                        echo 'OK IT DOESN't WORK!!!!!!!!!!!!!!!!!!!';
                        </xsl:processing-instruction>
                    </div>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

produces the incorrect output:

<!DOCTYPE HTML><html xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   </head>
   <body bgcolor="#000">
      <div class="main" style="background:lightblue;"<?php echo 'OK IT DOESN't WORK!!!!!!!!!!!!!!!!!!!';
          >></div>
   </body>
</html>

Specifically, the PI is output before the closing ">" of the start tag.

The bug is not present in 9.9.

(PI's in HTML are totally useless, and the serialization rule that they're output with a closing ">" instead of "?>" has no relevance with HTML5, and defeats any attempt to output PHP code. But that's what the serialization spec says we should do.)

Please register to edit this issue

Also available in: Atom PDF