Wrap group of XML nodes

前端 未结 3 880
梦如初夏
梦如初夏 2021-01-19 07:17

Im working with PHP5, and I need to transform XML in the following form:


    some text
    

        
3条回答
  •  一整个雨季
    2021-01-19 08:03

    This stylesheet:

    
        
            
                
            
            
        
        
            
                
            
            
        
        
            
                
            
        
    
    

    Output:

    
        some text
        
            some text
            
                some text
                some text
            
        
    
    

    Also, this stylesheet:

    
        
        
            
                
            
        
        
        
            
                
                    
                
            
        
    
    

    Note: First stylesheet use most fine grained transversal (it will wrap any node after first item). Second stylesheet full recursive identity transform.

    Edit: Addressing new requeriment, with new input, both stylesheets output:

    
        some text
        
            
                some text
                some text
            
            some text
            
                some text
                some text
            
        
    
    

提交回复
热议问题