[xsl] XPath: excluding a descendant

Subject: [xsl] XPath: excluding a descendant
From: "Hahn, Andrea" <a.hahn@xxxxxxxx>
Date: Mon, 1 Sep 2003 17:34:05 +0200
sorry if this is an old question turning up in yet another variation - I searched the messages I could find in the archives on the subject of selecting all children but one, but I still cannot get my XPath expression right, and would appreciate your help.

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)]"/>

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?


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

Current Thread