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

Re: Exclusions in XPATH

Subject: Re: Exclusions in XPATH
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 21 Nov 2002 15:30:16 GMT
xpath get all leaf elements
> Question 1: Can I get both attribute-names and element-names more easily in
> the select or does it have to be like I have it above ?

it's hard to answer that without knowing what your criterion for
selection was intended to be.
the select expression you had was

select="./*[1]//*[not(*)]|./*[1]//@*[not(*)]">	 

a leading ./ never does anything, and attributes never have element
 children so that can be simplified to

select="*[1]//*[not(*)]|*[1]//@*">	

which selects all the attributes and leaf elements of descendents of the
first child of the current node.

In your posted example the *[1] isn't doing anything as there is only
one child of A, so if that is always the case, or if you want all
descendents of A not just of the first child, it can be further
simplified to

select=".//*[not(*)]|.//@*">	

> How can I exclude the descendants of element F 

select="*[1]//*[not(*) and not ancestor::F]|*[1]//*[not(ancestor::F)]/@*">	

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 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.