I am working on an XSLT transform from one XML doc to another XML doc because I need to present some of the content in a different order and I want to inject the CSS stylesheet call like this:
<?xml-stylesheet href="styles.css" type="text/css"?>
into the resulting XML so that after transformation I get a new XML doc that looks something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="styles.css" type="text/css"?> <!--THIS LINE INJECTED-->
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
</CD>
</CATALOG>
Is there a way to do this within the XSLT transformation or will I need to do some further post-processing of the resulting XML to inject the tag?
Use the
xsl:processing-instructionelement, as outlined in 7.3 Creating Processing Instructions, thus: