xsl-list
[Top] [All Lists]

RE: remove certain elements but keep children

2004-10-04 01:32:14
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(_at_)munat(_dot_)com] 
Sent: 03 October 2004 23:47
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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   

              

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