Christoffer
Christoffer

Reputation: 7777

Attach a XSL stylesheet to the XML output of a XSL

I'm transforming an XML-document into a new restructured XML-document, by attaching a XSLT stylesheet to it. The new XML file is then going to be transformed by a second XSLT.

Is there a way I could make the first XSLT attach the second XSLT to the output?

The output now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <children> 
    ....

I want it to be:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="trans.xslt"?>
<root>
  <children> 
     ....

Sorry for a somewhat confusing post. But the question is - how do I tell a XSLT stylesheet to add a stylesheet-tag to the output document?

Upvotes: 1

Views: 279

Answers (1)

Linga Murthy C S
Linga Murthy C S

Reputation: 5432

You can use processing-instruction in your template:

<xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="trans.xslt"</xsl:processing-instruction>

Upvotes: 4

Related Questions