Project

Profile

Help

Bug #4540

Updated by Michael Kay almost 4 years ago

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> 
                         <xsl:for-each select="webpage/content/main"> 
                             <a href="{link}" style="color:#000; text-decoration:none;"> 
                                 <h1><xsl:value-of select="heading" /></h1> 
                                 <h2><xsl:value-of select="subheading" /></h2> 
                                 <div class="img"> 
                                     <img src="../images/{image}" width="100%" height="auto"/> 
                                 </div> 
                                 <xsl:value-of select="description" /> 
                             </a> 
                         </xsl:for-each> 
                     </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.)

Back