[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: remove certain elements but keep children

Subject: RE: remove certain elements but keep children
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 4 Oct 2004 09:32:14 +0100
remove elements with xsl
Write an identity template:

<xsl:template match="*">
  <xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
</xsl:template>

and override it for "output" elements:

<xsl:template match="output">
  <xsl:apply-templates/>
</xsl:template>

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Ben Munat [mailto:bent@xxxxxxxxx] 
> Sent: 03 October 2004 23:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  remove certain elements but keep children
> 
> Hello,
> 
> I'm writing an app that aggregates html into a single doc. 
> The chunks of 
> html are put into the new document wrapped in "output" tags. These 
> output tags can be intermingled with html tags.
> 
> I'm trying to come up with an xpath or xsl template(s) that 
> will remove 
> the output tags, while leaving their child html and without producing 
> duplicate content.
> 
> Here's an example doc:
> 
> <output>
> 	<div>
> 		<output>
> 			<h1>a header</h1>
> 			<p>some stuff</p>
> 			<output>
> 				<div>
> 					<p>foo bar</p>
> 				</div>
> 			</output>
> 			<p>more html</p>
> 		</output>
> 	</div>
> 	<p>some html</p>
> </output>
> 
> And I want it to be:
> 
> <div>
> 	<h1>a header</h1>
> 	<p>some stuff</p>
> 		<div>
> 			<p>foo bar</p>
> 		</div>
> 		<p>more html</p>
> </div>
> <p>some html</p>
> 
> 
> Any ideas?
> 
> thanks,
> 
> Ben	

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.