XPath “in” operator

后端 未结 3 1906
误落风尘
误落风尘 2021-01-17 22:57

Is there is an operator in XPath 1.0 that acts as \"in\" operator in SQL?

select * from tbl_students where id in (1,2,3)
3条回答
  •  孤街浪徒
    2021-01-17 23:27

    To find out if the 'id' you search is in the sequence of (1, 2, 3, 4) index-of() might be a choice. Pay attention it returns list of indexes.

    For a document part like

    
    
    
    

    Select will something like

    //*[not(empty(index-of((1, 2, 3, 4), @id)))]
    

提交回复
热议问题