当前位置: 动力学知识库 > 问答 > 编程问答 >

xpath - How to order by a tag's name?

问题描述:

I have a tag like this <article mdate="2005-12-08" key="journals/presence/RobinettR92">

How do I say ordering by the tags "name" the name being article for example (this is not the only name so I can't use an absolute path)?

To select ordering by the mdate attribute for example I can use {for i in $item order by $i/@mdate} and that works, but nothing I try seems to sort by the tags name.

网友答案:

To order the tag names, use the local-name(...) function.

for $i in $item
order by local-name($i)
return $i
分享给朋友:
您可能感兴趣的文章:
随机阅读: