XPath recursive “parent”-selection in a flat structure

前端 未结 2 1213
北恋
北恋 2021-01-16 04:12

The following XML is given:


  
    1
  
  
    2
    <         


        
2条回答
  •  鱼传尺愫
    2021-01-16 04:40

    Consider the following example:

    XSLT 1.0

    
    
    
    
    
    
    
    
        
            
        
    
    
    
        
        
    
    
    
    

    Applying this to your XML input with a start-id parameter value of 6, will produce:

    Result

    
    
      
      
      
      
    
    

    To exclude the starting node and list only its ancestors, you could do:

    
    
    
    
    
    
    
    
        
            
        
    
    
    
        
        
    
    
    
    

提交回复
热议问题