I'm trying to combine multiple, smaller XML files into one large XML.
I have done some searching and am trying to use PHP / XML / XSL but I can't seem to get it right.
I'm using:
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');
$xsl = new DOMDocument;
$xsl->load('vp.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml);
?>
And here is the XSL file I'm using:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:param name="pdoc1Url" select="'http://www.domainname.com/pages/google-feed?page=1.xml'"/>
<xsl:param name="pdoc2Url" select="'http://www.domainname.com/pages/google-feed?page=2.xml'"/>
<xsl:param name="pdoc3Url" select="'http://www.domainname.com/pages/google-feed?page=3.xml'"/>
<xsl:template match="/">
<documents>
<xsl:copy-of select="document($pdoc1Url)"/>
<xsl:copy-of select="document($pdoc2Url)"/>
<xsl:copy-of select="document($pdoc3Url)"/>
</documents>
</xsl:template>
</xsl:stylesheet>
However when I run the script nothing is combining? I know I'm doing something wrong but can't seem to find out exactly what that is. I think I'm using the PHP XSLT Processor incorrectly.
What is the best way to combine XML documents from multiple URLs into 1 xml? They all have the same formatting. Ideally I'd like to be able to view the combined XML from a URL.
The data I'm trying to combine is like these two URLs for example: http://www.domainname.com/pages/google-feed?page=1.xml http://www.domainname.com/pages/google-feed?page=2.xml