[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] finding elements lowest in hierarchy?


Subject: Re: [xsl] finding elements lowest in hierarchy?
From: "james walker" <jameswalkerandy@xxxxxxxxxxx>
Date: Tue, 27 Jan 2004 13:53:03 +0000

What happens if the hierarchy is alot bigger? Is it possible to use "descendent" to find if any of the lowest level descendents of a particular node contain a particular attribute?

cheers
james

From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] finding elements lowest in hierarchy?
Date: Tue, 27 Jan 2004 08:30:49 -0500

At 2004-01-27 12:41 +0000, james walker wrote:
I have several template matches at several stages in a hierarchy of elements, i am trying to find an xpath staement to find out if any of a particuler elements lowest children have an attirbute called "minimum".
e.g. given this hierarchy
<1>
<2>
<3><4 minimum="true"></4><4></4><4 minimum="true"></4><4></4></3>
<3><4></4><4></4></3>
</2>
<2>
<3><4></4><4></4><4></4></3>
</2>
</1>


e.g. when it template matches for "2" i am trying to say if any "4" elements below the current element have a minimum attribute then execute some code.....
i would like to do the smae for other elemnts such as "3"-- if there are any "4" elements below the current element have a minimum attribute then execute some code


does anyone know how to find out whether any of the lowest children in a hierarchy have a particuler attribute??

To look anywhere below oneself, use ".//" ... to look for any element use "*" ... to filter only those elements that do not have any element, comment or PI children (i.e. lowest in the hierarchy), use the predicate "[not(node())]" and to check for a particular attribute existing use the predicate "[@minimum]".


So, the test returning a boolean true would probably be:

test="..//*[not(node())][@minimum]"

I hope this helps.

.................... Ken


-- Public courses: sign up for one or both soon to reserve your seat! Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Washington, DC: 2004-03-15 San Francisco, CA: 2004-03-22 Hong Kong, China: 2004-05-17 Bremen, Germany: 2004-05-24 World-wide on-site corporate, government & user group XML training

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


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



_________________________________________________________________
Sign-up for a FREE BT Broadband connection today! http://www.msn.co.uk/specials/btbroadband



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




Current Thread
Keywords