How to replace namespace prefix in element and attributes using xslt

后端 未结 1 1535
南方客
南方客 2021-01-21 09:30

I have a source xml like following:



        
1条回答
  •  孤街浪徒
    2021-01-21 10:29

    There are two problems in your XSLT. Firstly, where you match the s1 and s2 elements, you are not subsequently trying to apply templates to any attributes. You need to replace this statement

    
    

    With this statement

    
    

    Secondly, you don't have any templates to match such attributes. You need a template like so:

    
        
            
        
    
    

    Try this XSLT

    
    
       
    
       
    
       
          
             http://sample.com/t targetSchema.xsd
             
                
             
          
       
    
       
          
             
          
       
    
       
          
             
          
       
    
       
          
             
          
       
    
       
          
             
          
       
    
    

    When applied to your sample XML, the following is output:

    
       
        123 test street 
    
    

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