XSLT transform XML with default namespace without adding prefix?

前端 未结 3 1393
走了就别回头了
走了就别回头了 2021-02-15 17:31

I am trying to transform an XML file with the following namespace, but couldn\'t find out a way to make it working with the default namespace without adding a prefix to the outp

3条回答
  •  -上瘾入骨i
    2021-02-15 18:15

    I can make it working by adding a prefix to the default namespace (the last one), but how could I output a XML without adding a prefix, it is possible by using XslCompiledTransform in .NET 4 ?

    Here is a concrete example how to do it:

    This transformation:

    
     
     
    
     
      
       3
       5000
      
     
    
     
      
       
      
     
    
     
      
      
     
    
    

    when applied with XslCompiledTransform on the following XML document:

    
     
      
       5
       1000
      
     
    
    

    produces the wanted (the same XML document with a new item added), correct result:

    
      
        
          5
          1000
        
        
          3
          5000
        
      
    
    

提交回复
热议问题