Page 1 of 1

XSLT - delete element[s] but keep contents

Posted: Wed Dec 08, 2010 2:11 pm
by HeX
I'm trying to learn XSLT.

I have a lot of XML docs and need to delete an XML element, wherever it occurs within the node tree.

The element has optional attributes and an optional child - I need to delete the parent, its attributes, the optional child (where it occurs) but leave the element contents in tact.

E.g.

<para>
Text text <movie alttitle="The Terror" year="2010"><title>Really Scared</title>, distributed by Hopeless Pictures</movie> text text
</para>

How would I use XSLT to find and remove all <movie/> elements, inc all <title> elements to leave:

<para>
Text text Really Scared, distributed by Hopeless Pictures text text
</para>

?

Re: XSLT - delete element[s] but keep contents

Posted: Thu Dec 09, 2010 5:07 pm
by HeX
Sorry - worked this one out. It's a namespace thing