Get Nth child of a node using xpath

后端 未结 2 703
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 11:38

My sample input XML is:


 
   item
   item1
   item2
   item3         


        
2条回答
  •  囚心锁ツ
    2020-11-28 12:08

    you can use this:

    /root/a/b[position()=$variable]
    

    position() is 1 based

    http://saxon.sourceforge.net/saxon6.5.3/expressions.html

提交回复
热议问题