How to find the max attribute from an XML document using Xpath 1.0

后端 未结 7 1064
无人及你
无人及你 2020-11-29 10:43

Is there a way to query an XML document to return the maximum of a given attribute using Xpath 1.0 ?

For example is there a way to get the max id ?

&         


        
7条回答
  •  盖世英雄少女心
    2020-11-29 10:51

    If you're willing to use external tooling - which depends on your implementation featuring implementations of these tools - try the EXSLT:Math function highest().

    The fact that EXSLT implements this implies that such a feature isn't directly available in plain xpath, of course. If you're not using Transforms, or want to stick purely with standards-compliant markup, other posters' suggestions would be a better choice.

提交回复
热议问题