Project

Profile

Help

Bug #4540

Serialization of processing-instructions with method="html"

Added by Michael Kay about 1 year ago. Updated about 1 year 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:

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.)

History

#1 Updated by Michael Kay about 1 year ago

  • Description updated (diff)

#2 Updated by Michael Kay about 1 year ago

  • Status changed from New to Resolved
  • Fix Committed on Branch 10 added

Added two QT3 test cases (Serialization-html-58, -59) for HTML4 and HTML5 respectively

Patched HTMLEmitter.

#3 Updated by O'Neil Delpratt about 1 year ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.1 added

Bug fix committed in the Saxon 10.1 maintenance release.

#4 Updated by O'Neil Delpratt about 1 year ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF