comp.text.xml
[Top] [All Lists]

Re: Joining XML files?

Subject: Re: Joining XML files?
From: "rhino"
Date: Tue, 1 Jul 2008 18:09:45 -0400
Newsgroups: comp.text.xml


"Joseph J. Kesselman" <keshlam-nospam@xxxxxxxxxxx> wrote in message 
news:486a9058$1@xxxxxxxxxxx
> 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.

Thank you once again, Joseph! This definitely gets me going in the right 
direction.

I was counting on something like this being possible for the project I am 
designing. The fact that it is possible, and apparently pretty routine, is 
VERY helpful in planning what I need to do next. (After I work out a couple 
of examples of joins/merges, that is!)

I really appreciate your assistance with my questions today!

--
Rhino



<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy