I’ve been looking at how to combine multiple sources forXML into a single document using XSL. It’s certainly possible and using various tricks I can get a nicely ordered output of the aggregate of the data. Trying to use the standard functions such as preceding-sibling fail though as the context isn’t unified. This makes the solution I presently have only partially succesful. I’ve tried various solutions I’ve found online but none produce the results I want.
The basic process is simple enough. First we have a small XML file that includes a set of links to RDF files with the data we wish to parse into a single list.
To get this data into a single list that we can then parse we use document().
<xsl:variable name="docs" select="document(/list/location)"/>
We now have all the root nodes from the documents listed in the input file contained with the $docs variable and can iterate through them as follows.
<xsl:for-each select="$docs/rdf:RDF"> <xsl:sort select="x:foo"/> ... </xsl:for-each>
This works and will produce the desired output. What it won’t provide is a single unified context, so functions such as preceding-sibling will give very interesting (and incorrect) results. Anyone know how I can do this such that it works? I realise that XSL 2.0 is supposed to fix all this, but I’m looking for a 1.0 solution.