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

RE: XPath: excluding a descendant

Subject: RE: XPath: excluding a descendant
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 2 Sep 2003 09:03:07 +0100
xpath exclude node
> The aim:
> For providing some quick-and-dirty html output, just making 
> sure all data are in there somehow, I want to "dump" all 
> content below a certain node (not the root element) to the 
> screen. There is, however, one sub-sub-sub-node whose 
> contents I want to display on its own in a more structured 
> way, and I do not want it duplicated in the dump. Following 
> the suggestions I could find for selecting all children 
> except for one in the FAQ I constructed this:
> 
> <xsl:apply-templates 
> select="abcd:Gathering[not(self::LongitudeDecimal)]"/>

This will process all the abcd:Gathering elements that are not
LongitudeDecimal elements. Of course, none of them are.

Without seeing the structure of your XML I find it difficult to tell you
the correct code.

But the simplest way of not processing a particular element (and its
children/descendants) is to write an empty template rule for it:

<xsl:template match="LongitideDecimal"/>

Michael Kay


> 
> where Gathering is the top node for the dump, and 
> Gathering/GatheringSite/SiteCoordinates/LongitudeDecimal the 
> one node I would want _not_ to display. This does not work at 
> all, I guess because the element-to-exclude is not a child, 
> but a descendant (?). If I change the line above to 
> "...not(descendant::...", I get a different effect: not 
> excepting the one element from the output, but just testing 
> on presence of the node, with everything being displayed when 
> "LongitudeDecimal" does not exist, but nothing when it does. 
> How can I achieve to always display everything, always 
> without the Longitude-content?
> 
> Thanks,
> Andrea
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


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.