<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Evil XML: Creating a document on the fly</title>
 </head>
 <body onload="test()">
  <iframe src="010b.xml" id="frame"/>
  <script type="text/javascript">
   function test() {
     var frame = document.getElementById('frame');
     var pi = frame.contentDocument.createProcessingInstruction('xml-stylesheet', 'href="010b.css"');
     frame.contentDocument.insertBefore(pi, frame.contentDocument.documentElement);
     frame.contentDocument.documentElement.appendChild(frame.contentDocument.createTextNode('This line should be green.'));
   }
  </script>
 </body>
</html>

