This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: deleting nodes that does not have attribute
- To: "Mohammed Rahman" <mrahman at planlinx dot com>
- Subject: Re: [xsl] deleting nodes that does not have attribute
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 9 Aug 2001 18:10:57 +0100
- CC: XSL-List at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <NFBBJGKGDKINFAFJALEOOEIICAAA.mrahman@planlinx.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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