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

RE: Xpath 1.0 Question : Excluding Attributes?

Subject: RE: Xpath 1.0 Question : Excluding Attributes?
From: "Simon Shutter" <simon@xxxxxxxxxxx>
Date: Wed, 28 Mar 2007 21:30:31 -0700
RE:  Xpath 1.0 Question : Excluding Attributes?
Hi Abel,

Sorry for the confusion.  I meant only attribute nodes so I assume from your
examples that I have to put the entire path before each attribute of
interest.

Ie // tier1 / tier2 / @attrb1 | // tier1 / tier2 / @attrb2


Is there a way to exclude specific attributes in Xpath 1.0?

Simon


-----Original Message-----
From: Abel Braaksma [mailto:abel.online@xxxxxxxxx] 
Sent: March 28, 2007 4:54 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Xpath 1.0 Question : Excluding Attributes?

Simon Shutter wrote:
> Could someone tell me what the Xpath expression is that includes 
>
> all element nodes 
>   

//*

> and only specific attribute children?
>   

//* | //@specific1 | //@specific2

or do you mean:

//* | //specelem/@specific1 | | //specelem/@specific2


But I get the feeling that you want an identity transform of XML, where 
you want to leave all elements in place, get rid of all attributes 
except for a few. This can be done like:

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

<!-- throw away all attributes -->
<xsl:template match="@*" />

<!-- except these -->
<xsl:template match="@specific1 | @specific2">
   <xsl:copy />
</xsl:template>

<!-- and these with specific parents -->
<xsl:template match="someparent/@specific1">
   <xsl:copy />
</xsl:template>


HTH,

Cheers,
-- Abel Braaksma
   http://www.nuntia.nl

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.