Getting the parent node attributes in XSL

前端 未结 2 1509
温柔的废话
温柔的废话 2021-02-18 20:21

In my XML I have the following:


  
    
      
        
          someResult         


        
相关标签:
2条回答
  • 2021-02-18 20:43

    Use:

    ancestor::c[1]/@something
    

    This selects the attribute named something of the first (from the current node upwards) ancestor named c.

    0 讨论(0)
  • 2021-02-18 20:52

    To move up the tree you use ".." per level ie in this instance probably

    select="../../../@something"
    

    You can also select an ancestor node by name (approx)

    select="ancestor::c[1]/@something"  
    

    See http://www.stackoverflow.com/questions/3672992 for further examples

    0 讨论(0)
提交回复
热议问题