RE: [xsl] flattening an xml hierarchy

Subject: RE: [xsl] flattening an xml hierarchy
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Thu, 8 Jan 2009 11:15:25 -0500
> From: Tim [mailto:timlhunt@xxxxxxxxxxxxxx]
> Sent: Thursday, January 08, 2009 11:12 AM
> To: XSL MulberryTech
> Subject: [xsl] flattening an xml hierarchy
>
> Hi,
> I'd like to remove some elements from an xml hierachy using xslt:
>
> Original xml example:
> <Dontwant1>
>     <dontwant2>foo</dontwant2>
>     <x3>
>         <x4>stuff</x4>
>         <y5>more stuff</y5>
>     </x3>
> </Dontwant1>
>
> Like to have transform output:
> <x3>
>    <x4>stuff</x4>
>     <y5>more stuff</y5>
> </x3>
>

Just search for x3 and do a copy-of

<xsl:template match="/">
  <xsl:copy-of select="//x3" />
</xsl:template>

Current Thread