xsl-list
[Top] [All Lists]

Re: [xsl] flattening an xml hierarchy

2009-01-08 11:15:39
This is a very simple modified identity transform:

<!-- Copy everything unchanged... -->
<xsl:template match="@* | node()">
 <xsl:apply-templates select="@* | node()"/>
</xsl:template>

<!-- ...except for these elements -->
<xsl:template match="Dontwant1 | dontwant2">
 <xsl:apply-templates/>  <!-- Just process their contents -->
</xsl:template>

Evan

Tim wrote:
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>

Thanks for your insghts.

Tim

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--