xsl:processing-instruction

  1. processing-instruction_1-input.xml

  2. <?xml version="1.0"?>
  3. <products>
  4.   <product id="p1" price="3250"/>
  5. </products>
  1. processing-instruction_1-stylesheet.xsl

  2. <?xml version="1.0"?>
  3. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.   <xsl:output indent="yes"/>
  5.   <xsl:template match="/">
  6.     <xsl:processing-instruction name="xml-stylesheet"> type="text/xsl" href="xml2xhtml-1.xsl</xsl:processing-instruction>
  7.     <xsl:copy-of select="products"/>
  8.   </xsl:template>
  9. </xsl:stylesheet>
  1. processing-instruction_1-output.xml

  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <?xml-stylesheet type="text/xsl" href="xml2xhtml-1.xsl?>
  4. <products>
  5.   <product id="p1" price="3250"/>
  6. </products>

Comment

Many processing-instructions make use of pseudo-attributes but the content of a processing- instruction just have to be a string.

Updated 2009-03-19