26 May
2016
26 May
'16
8:49 a.m.
Hi Christian, I've been thinking about that solution too. Thanx for your reply, Rob -----Oorspronkelijk bericht----- Van: Christian GrĂ¼n [mailto:christian.gruen@gmail.com] Verzonden: woensdag 25 mei 2016 16:40 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] searching for the nearest ancestor Hi Rob,
I found this solution [1] but I was wondering if also a solution is possible that makes use of the ancestor being a reverse-axis[ 2].
[ 1] ( $element/ancestor::*/child::*[ @ID = $refID] ) [ last()] You probably need two id tests: $element/ancestor::*[*/@ID = $refID][1]/*[@ID = $refID] I guess it depends mostly on the input if the first or second alternative will be faster. Hope this helps, Christian