Re: Joining XML files?

Discussion in 'XML' started by Joseph J. Kesselman, Jul 1, 2008.

  1. 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.
     
    Joseph J. Kesselman, Jul 1, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stuart
    Replies:
    3
    Views:
    465
    Joe Smith
    Aug 19, 2004
  2. JHenstay
    Replies:
    3
    Views:
    570
    osmium
    Jan 11, 2004
  3. mosscliffe

    Joining Big Files

    mosscliffe, Aug 25, 2007, in forum: Python
    Replies:
    7
    Views:
    466
    vasudevram
    Aug 31, 2007
  4. Hermann Peifer

    Re: Joining XML files?

    Hermann Peifer, Jul 6, 2008, in forum: XML
    Replies:
    0
    Views:
    712
    Hermann Peifer
    Jul 6, 2008
  5. Peter Flynn

    Re: Joining XML files?

    Peter Flynn, Jul 13, 2008, in forum: XML
    Replies:
    0
    Views:
    505
    Peter Flynn
    Jul 13, 2008
Loading...

Share This Page