Merge all child nodes of respective parent under first parent, if parent node value matches

后端 未结 1 577
甜味超标
甜味超标 2021-01-26 02:35

Hi My Input is something like this.


         
            9837
              


        
1条回答
  •  独厮守ぢ
    2021-01-26 03:33

    You have a template in your XSLT that ignores PartPosition

    
    

    Therefore, when you do in your copy template, because you are positioned on a DamagePosition at this point, the above template will match the child PartPosition and simply ignore it.

    Perhaps you should be ignoring DamageSeqNumber instead of PartPosition at this point?

    Also, you probably don't really need the copy template at all. Instead, change the call to it, to simply get all the child elements of the key, and then let the identity template take care of it.

    
    

    Try this XSLT

    
    
     
     
    
     
         
           
             
           
         
     
    
     
    
     
      
       
       
       
      
     
    
    

    This doesn't quite give the output you show in your question, because you show two OperationPosition elements in your output, although there is only one in your input.

    EDIT: If you wanted OperationPosition elements before PartPosition elements, you could replace the existing with these two lines instead:

    
    
    

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