This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: deleting nodes that does not have attribute


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]