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 "[(_at_)minimum]".
So, the test returning a boolean true would probably be:
test="..//*[not(node())][(_at_)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(_at_)CraneSoftwrights(_dot_)com
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