title: XML processing instructions failing HTML5 validation
body: <p>I'm using PHP to read both an .xml and .xsl file on the server, then transformToXML($xml). When I run the resultant HTML5 code through the W3C Markup Validation Service, I get the following validation error:</p>
  
  <pre><code>Saw &lt;?. Probable cause: Attempt to use an XML processing instruction in HTML. 
  (XML processing instructions are not supported in HTML.) &lt;?xml version="1.0"?&gt;
  </code></pre>
  
  <p>The problem seems to be that, in addition to the HTML that is being generated through the XSL Transform, the following line is being written into the HTML (and is visible when I view the page source in the browser):</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  </code></pre>
  
  <p>PHP code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      ....
  &lt;/head&gt;
  &lt;body&gt;
      ... some hard-coded HTML here ...
  
      &lt;?php
          // Load XML file
          $xml = new DOMDocument;
          $xml-&gt;load('cdcatalog.xml');
  
          // Load XSL file
          $xsl = new DOMDocument;
          $xsl-&gt;load('cdcatalog.xsl');
  
          // Configure the transformer
          $proc = new XSLTProcessor;
  
          // Attach the xsl rules
          $proc-&gt;importStyleSheet($xsl);
  
          echo $proc-&gt;transformToXML($xml);
      ?&gt;
  
      ... more hard-coded HTML here ...
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>XML code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;catalog&gt;
      &lt;cd&gt;
          &lt;title&gt;Empire Burlesque&lt;/title&gt;
          &lt;artist&gt;Bob Dylan&lt;/artist&gt;
          &lt;country&gt;USA&lt;/country&gt;
          &lt;company&gt;Columbia&lt;/company&gt;
          &lt;price&gt;10.90&lt;/price&gt;
          &lt;year&gt;1985&lt;/year&gt;
      &lt;/cd&gt;
      ...
  &lt;/catalog&gt; 
  </code></pre>
  
  <p>XSL code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:template match="/"&gt;
      &lt;table border="1"&gt;
          &lt;tr bgcolor="#9acd32"&gt;
              &lt;th style="text-align:left"&gt;Title&lt;/th&gt;
              &lt;th style="text-align:left"="left"&gt;Artist&lt;/th&gt;
          &lt;/tr&gt;
          &lt;xsl:for-each select="catalog/cd"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;xsl:value-of select="title" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;xsl:value-of select="artist" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;/xsl:for-each&gt;
      &lt;/table&gt;
      &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt; 
  </code></pre>
  
  <p>Does anyone know how to get around this, or is the real issue that I'm embedding the transformed HTML into the middle of existing hard-coded HTML in the PHP file?</p>
  
  <p>Thanks for any guidance!</p>