Dynamic grouping on element and attributes names

前端 未结 2 884
谎友^
谎友^ 2021-01-24 20:01

I would like to categorize results from an XPath under headings by element name (and then by same attribute names). Note: XML data could be inconsistent and some elements with t

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-24 20:20

    This transformation doesn't make any assumptions about the sets having the same number of attributes -- no assumptions at all.

    
     
     
    
     
      
        
      
     
    
     
       
         
         
           
             ||
         
       
     
    
     
       
         
            
                  
                
                
                    
    Element Name

    When applied on the provided XML document:

    
        
        
        
        
        
        
        
        
    
    

    the wanted, correct result is produced:

    Element Name color cute name
    cat brown yes Fluffy
    cat brown no Lucy
    cat grey yes Simba

    Element Name color name
    cat brown Princess

    Element Name color cute name type
    dog brown yes Frank Lab
    dog beige yes Rupert Pug

    Element Name color cute name
    dog brown no Spot
    dog brown yes Rover

提交回复
热议问题