The <xsl:processing-instruction> Element: Generating Processing Instructions

You can create new processing instructions with the <xsl:processing-instruction> element. This element has one attribute:

  • name(mandatory). Sets the name of the processing instruction. Set to an attribute value template that returns an NCName.

In the following example, I’ve removed the <?xml-stylesheet?> instruction from the beginning of planets.xml:

 <?xml version="1.0"?> <PLANETS> <PLANET> <NAME>Mercury</NAME> <MASS UNITS="(Earth = 1)">.0553</MASS> <DAY UNITS="days">58.65</DAY> <RADIUS UNITS="miles">1516</RADIUS> <DENSITY UNITS="(Earth = 1)">.983</DENSITY> <DISTANCE UNITS="million miles">43.4</DISTANCE><!--At perihelion--> </PLANET> <PLANET> <NAME>Venus</NAME> <MASS ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.