XSLT - delete element[s] but keep contents

Here should go questions about transforming XML with XSLT and FOP.
HeX
Posts: 2
Joined: Wed Dec 08, 2010 2:00 pm

XSLT - delete element[s] but keep contents

Post 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>

?
HeX
Posts: 2
Joined: Wed Dec 08, 2010 2:00 pm

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

Post by HeX »

Sorry - worked this one out. It's a namespace thing
Post Reply