Find the maximum child count with XPath 1.0

前端 未结 3 1183
谎友^
谎友^ 2021-01-23 06:27

Can I find one XML node with the most children with XPath?


  
    
  
  
    <         


        
3条回答
  •  [愿得一人]
    2021-01-23 07:20

    I know this is pretty old, but if it helps anyone out, I wanted to do this and I think this works, at least it does for me:

    /xml/node[count(./child) > count(following-sibling::node/child) and count(./child) > count(preceding-sibling::node/child)]

    I'm not great with Xpath so maybe I'm missing something.

提交回复
热议问题