Re: [xsl] deleting nodes that does not have attribute

Subject: Re: [xsl] deleting nodes that does not have attribute
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 9 Aug 2001 18:10:57 +0100
Hi Mo,

> I want to copy everything from the input xml...

Then you need an identity transformation:

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
  </xsl:copy>
</xsl:template>

> except the nodes that does not have any attibues.

The only things that can have attributes are elements, so I guess you
want to just exclude the elements that don't have attributes (not
exclude text just because they can't have attributes!). So you need
another template that overrides the identity template by doing
nothing. This template has to match elements that don't have
attributes, so:

<xsl:template match="*[not(@*)]" />

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread