XSLT Create a hierarchical structure from a flat structure by using certain level criteria

后端 未结 2 1255
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 08:18

I want to create a XSD structure from an Excel output using XSLT. But my XSLT does not generate the hierarchical structure, correctly. It has some additional nodes in an element

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-26 08:55

    Let me suggest a different approach to creating the nested hierarchy. To demonstrate, I will use the following minimized input:

    XML

    
       
          
             1
          
       
       
          
             2
          
       
       
          
             3
          
       
       
          
             3
          
       
       
          
             2
          
       
       
          
             1
          
       
       
          
             1
          
       
       
          
             1
          
       
       
          
             2
          
       
       
          
             2
          
       
    
    

    Applying the following stylesheet:

    XSLT

    
    
    
    
    
    
        
            
        
    
    
    
        
            
        
    
    
    
    

    will return:

    Result

    
    
       
          
             
             
          
          
       
       
       
       
          
          
       
    
    

    This works recursively with any number of levels.

提交回复
热议问题