using XSL to replace XML nodes with new nodes

后端 未结 3 635
旧时难觅i
旧时难觅i 2020-12-14 22:39

I need an XSL solution to replace XML nodes with new nodes.

Say I have the following existing XML structure:


    
               


        
3条回答
  •  攒了一身酷
    2020-12-14 23:29

    Here is one correct solution, which is probably one of the shortest:

     
     
     
    
     
      
       
      
     
    
     
      BBB
      CCC
      DDD 
    
    

    When this transformation is applied on the provided XML document, the wanted result is produced:

    
        
            BBB
            CCC
            DDD
        
    
    

    Do note:

    1. The use of the identity template.

    2. How the identity template is overriden by a specific template -- only for a criterion element, whose string value is 'AAA'.

提交回复
热议问题