XSLT function to get xpath to a node

前端 未结 2 1132
独厮守ぢ
独厮守ぢ 2021-01-14 19:37

I need a XSLT function which will return me the xpath to the node from which it called.

XML

    
      
        

        
2条回答
  •  粉色の甜心
    2021-01-14 20:10

    One reason that there's no standard function is that people want the path for different reasons:

    Sometimes a/b/c/d is enough.

    Some people want a[3]/b[5]/c[1]/d[2].

    Some people want a path where the names don't contain namespace prefixes, so it has to be something like

    *:a[namespace-uri()='abc']/*:b[namespace-uri='xyz'] etc.

提交回复
热议问题