Merge different products belong to each standard

后端 未结 1 1275
北荒
北荒 2021-01-25 08:53

I have to transform the following xml content,


    
        200057<         


        
1条回答
  •  鱼传尺愫
    2021-01-25 09:26

    Switching from imperative "pull" processing () to "push" processing, where you depend on the natural processing loop of the XSL engine, simplifies the stylesheet significantly.

    
    
        
    
        
        
            
                
            
        
    
        
            
                
                
                
                
                    
                
                
                
            
        
    
        
            
                
                
            
        
    
    
    

    This is essentially an "identity transform" plus one template to match Standard, and output only what we want from within it. The template for x:RelatedProduct copies those elements to the output verbatim and adds the RelationType element whose text is the name of the containing element.

    Output is

    
    
        
          200057
          ISO
          1001
          
             
                    1500163
                DraftProducts
             
             
                    263973
                    708519
                    
                ReferenceProducts
             
             
                    320056
                    934789
                    
                ReferenceProducts
             
             
                    
                    116881
                    Identical
                    NEN ISO 1001
                RelatedIntProducts
             
             
                    208076
                    116886
                    Identical
                    
                RelatedIntProducts
             
          
          1001
          1986
       
        
          200058
          ISO
          1002
          
             
                    1500167
                DraftProducts
             
             
                    263974
                    708519
                    
                ReferenceProducts
             
             
                    320052
                    934754
                    
                ReferenceProducts
             
             
                    
                    116837
                    Identical
                    NEN ISO 1001
                RelatedIntProducts
             
             
                    208074
                    116843
                    Identical
                    
                RelatedIntProducts
             
          
          1005
          1983
       
    
    

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