Concatenating xml files

前端 未结 4 2041
日久生厌
日久生厌 2021-01-05 14:48

I have several xml files, the names of which are stored in another xml file.

I want to use xsl to produce a summary of the combination of the xml files. I remember

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 15:34

    Here is just a small example of what you could do:

    file1.xml:

    
    Text from file1
    
    

    file2.xml:

    
    Text from file2
    
    

    index.xml:

    
    file1.xml
    file2.xml
    

    summarize.xsl:

    
    
      
          
            
          
      
    
      
    
      
        
          
          
      
    
      
        
          
          
      
    
    
    

    Applying the stylesheet to index.xml gives you:

    Text from file1Text from file2
    

    The trick is to load the different documents with the document function (extension function supported by almost all XSLT 1.0 processors), to output the contents as part of a variable body and then to convert the variable to a node-set for further processing.

提交回复
热议问题