How can I add namespaces to the root element of my XML using XSLT?

后端 未结 1 1734
庸人自扰
庸人自扰 2020-12-03 15:26

I have an input XML


  
    US
    A
   

         


        
1条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 16:18

    Here's how I'd do it in XSLT 2.0...

    XML Input

    
        
            US
            A
        
    
    

    XSLT 2.0

    
        
        
    
        
            
                
            
        
    
        
            
                
                
                
            
        
    
    
    

    XML Output

    
       
          US
          A
       
    
    

    Here's an XSLT 1.0 option which produces the same output, but requires you to know the name of the root element...

    
        
        
    
        
            
                
            
        
    
        
            
                           
            
        
    
        
            
                
            
        
    
    
    

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