RE: [xsl] XSL to output new XML document with root node

Subject: RE: [xsl] XSL to output new XML document with root node
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 2 May 2006 10:00:29 +0100
> Hi.  I have an XSL sheet to extract certain data from an XML 
> document.  I use Saxon for the transform and have the output 
> as XML.  I need to have the outputted XML document to contain 
> a root node.  How do I code the XSL sheet to create the root 
> node for the XML output document?  The purpose is so I am 
> able to run a different XSL transform on the output XML 
> document.  Thanks.

As Ken explained, your terminology is confused, which makes it difficult to
understand your problem. I'm wondering though, perhaps what you are trying
to do is to generate an <?xml-stylesheet?> processing instruction in the
output? If so, you can do that with an <xsl:processing-instruction> element
in the stylesheet. However, unless the next transformation is to run in a
browser, this isn't the way I would normally implement stylesheet chaining:
I would fire off the sequence of transformations from some controlling
application, written in Java, Ant, shell-script, or a pipeline language,
depending on the environment.

Michael Kay

Current Thread