find common parent using Xpath

前端 未结 2 1989
时光取名叫无心
时光取名叫无心 2020-12-17 03:16

I was wondering if there was any way to access common parent node using Xpath.


sometext &
2条回答
  •  抹茶落季
    2020-12-17 03:41

    This seems complicated. Just try:

    xquery version "3.0";
    
    let $test :=
        
        
    sometext sometext2
    return ($test//*[.//b][.//d])[last()]

    to get i.e. the clostest common ancestor

提交回复
热议问题