How to select distinct values from XML document using XPATH?

前端 未结 3 698
广开言路
广开言路 2021-01-01 17:00

How can I select only distinct elements for the XML document using XPATH?I\'ve tried to use the \'distinct-values\' function but it didn\'t work for some reason..

Th

3条回答
  •  孤城傲影
    2021-01-01 17:08

    distinct-values() is available in XPath 2.0. Are you using that?

    If distinct-values() is not available, the standard way of getting distinct values is to use not(@result = preceding:: @result) to get unique @result. It will give you the first occurrence only.

提交回复
热议问题