XSLT: A simple way to merge xml files

前端 未结 1 1033
说谎
说谎 2020-11-27 07:43

I have two xml files. I need to merge them together where the element \"myid\" matches between the two. Please have a look at these example files...

File1.xml:

1条回答
  •  隐瞒了意图╮
    2020-11-27 08:16

    I have been researching a bit and found a fairly similar question here: http://forums.tizag.com/showthread.php?p=76699

    Here is what I have come up with, this seems to be mostly working except that Firefox is not recognizing it as an xml file even though I have added the xml:output.

    File1.xml (note line two, referencing our transformation):

    
    
    
      
        Title1
        Description1
        1
      
    
      
        Title2
        Description2
        2
      
    
    

    File2.xml:

    
    
      
        Author1
        12/34/5678
        1
      
    
      
        Author2
        87/65/4321
        2
      
    
    

    merge.xsl:

    
    
      
      
    
      
        
          
        
      
    
      
        
          
          
          
            
              
            
          
        
      
    
    

    Output xml when viewing File1.xml:

    
      
        Title1
        Description1
        1
        Author1
        12/34/5678
      
    
      
        Title2
        Description2
        2
        Author2
        87/65/4321
      
    
    

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