Adding element in middle of xml using xslt

前端 未结 2 1199
粉色の甜心
粉色の甜心 2020-12-03 04:56

Below is the actual xml:



 ABC
 CS
 

        
2条回答
  •  被撕碎了的回忆
    2020-12-03 05:27

    Here is an XSLT 1.0 stylesheet that will do what you asked:

    
    
       
       
          
             
          
       
    
       
          
          34
       
    
       
          
          Insurance
       
    
    

    Obviously the logic will vary depending on where you will be getting the new data from, and where it needs to go. The above stylesheet merely inserts an element after every element, and a element after every element.

    (Limitation: if your document could have or elements within other or elements, only the outermost ones will have this special processing. I don't think you intend for your document to have this kind of recursive structure, so it wouldn't affect you, but it's worth mentioning just in case.)

提交回复
热议问题