XPath 1 query and attributes name

后端 未结 2 1738
广开言路
广开言路 2021-02-04 15:41

First question: is there any way to get the name of a node\'s attributes?


         


        
2条回答
  •  故里飘歌
    2021-02-04 15:50

    It depends a little bit on the context, I believe. In most cases, I expect you'd have to query "@*", enumerate over the items, and call "name()" - but it may work in some tests.

    Re the edit - you can do:

    @*[number(.)>0]
    

    to find attributes matching your criteria, and:

    concat(name(),'=',.)
    

    to display the output. I don't think you can do both at once, though. What is the context here? xslt? what?

提交回复
热议问题