25 May
2016
25 May
'16
4:23 p.m.
Hi, While processing a XML-file with xquery I need to find the nearest ancestor that has a child-element with a certain ID-value( $refID). 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]. That way I could replace the [ last()]-predicate with a [1]-predicate, which I find more transparant. Also my gut-feeling tells me that would be a more efficient solution then the current one. [ 1] ( $element/ancestor::*/child::*[ @ID = $refID] ) [ last()] [ 2] https://www.w3.org/TR/xquery-30/#id-predicate TIA for your replies, Take care, Rob Stapper