Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Re: Joining XML files?

Thread Tools

Re: Joining XML files?

Joseph J. Kesselman
Posts: n/a
rhino wrote:
> Given that these are two separate XML files but that there is some common
> information, specifically the department number, could I use XSLT to
> generate a report that shows me each department name followed by the names
> of the people who work in the department?

XSLT can certainly reference more than one input source, using the
document() function; then it's just a matter of writing expressions that
use data from one document to look up information in the other document.

There are probably examples on the XSLT FAQ website... but seriously,
once you know about the document() function it really isn't any harder
than if you were recombining data read from a single document.

The only tricky part, really, is deciding how you're going to tell the
stylesheet which two sources to look at. Common solutions are passing
one of the URIs in as a parameter, or having one hardcoded into the
stylesheet, or having a front-end document which the stylesheet obtains
both the actual URIs from.... Which of those solutions is best depends
on the environment you're performing this operation in. Note that all of
'em are extensible to more than 2 documents.

As to what to call it: Conceptually it's certainly a join or merge. The
former term is more likely to be recognized by DB and data-structure
folks, the latter is more familiar to folks coming to XML and XSLT from
the document-markup side of the world. I wouldn't get hung up on the
terminology; the clearest solution is probably to do exactly what you
did, provide a brief example of what you're trying to accomplish.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Joining XML files? Peter Flynn XML 0 07-13-2008 08:22 PM
Re: Joining XML files? Hermann Peifer XML 0 07-06-2008 04:53 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Joining Files DTDoyle Firefox 1 10-17-2005 02:48 AM
Joining News Attachments How? Ed Firefox 0 12-21-2004 03:00 AM