Re: [xsl] How to insert Root Element in XML Output

Subject: Re: [xsl] How to insert Root Element in XML Output
From: "Jon Gorman" <jonathan.gorman@xxxxxxxxx>
Date: Wed, 3 May 2006 08:49:50 -0500
On 5/3/06, Gary E. Daniels <gdaniels@xxxxxxxxxxx> wrote:
Hi. Newbie here.  I have an XSL Stylesheet that produces XML as
output.  How do I code the XSL sheet to add a Root Element to the outputted
XML document?  Below is an example of the  current XML output and the
desired XML output with the root element <foo>.  Thanks.
Gary



Ummm.... <xsl:template match="/"> <foo> <xsl:apply-templates /> </foo> </xsl:template>

/ matches the "top" of the document.  This wraps all the elements,
even the root element.

You might want to browse through the XPath specs for more info:
http://www.w3.org/TR/xpath

Jon Gorman

Current Thread