Can XPath do a foreign key lookup across two subtrees of an XML?

后端 未结 4 1699
不思量自难忘°
不思量自难忘° 2020-12-18 09:07

Say I have the following XML...


  
    
    
    

        
4条回答
  •  盖世英雄少女心
    2020-12-18 09:45

    It's not pretty. As with any lookup, you need to use current():

    /root/bucket[/root/base/tent[@key = current()/tent/@key]/@color = 'blue' or /root/base/tent[@key = current()/tent/@key]/@color = 'red']

提交回复
热议问题