XPath to count the child nodes based on complex filter

前端 未结 2 1337
南旧
南旧 2021-01-05 04:21

I have an XML in the following format:


  
    
        

        
相关标签:
2条回答
  • 2021-01-05 05:02

    How about count(//ComRequest/root/component[count(compLine)>10]) ?

    0 讨论(0)
  • 2021-01-05 05:07

    @Bala-R (+1) is correctly evaluated using a compliant XSLT 1.0 processor (Saxon):

    count(//ComRequest/root/component[count(compLine)>10])
    

    or, either

    count(/*/*/*[count(compLine)>10])
    

    Otherwise something is going bad in your tests, your context (different from the one provided in the question) or your xpath evaluator.

    0 讨论(0)
提交回复
热议问题