[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: MERGING 2 XML DOCS WITH dom4j parser

Subject: Re: MERGING 2 XML DOCS WITH dom4j parser
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 21 Mar 2002 01:45:49 -0700 (MST)
dom4j merge xml
Lea Allison wrote:
> does anyone know how I can merge two XML files together (one on top of the
> other) using the dom4j parser so that my xsl transformation will read it as
> a single XML document?

Is it really necessary to do it at the XML parsing level? There is a
requirement that an XML document contain just a single element at the top
level, so it is impossible to create a well-formed document that is the
composite of two other well-formed documents, unless you wrap the whole thing
in a dummy element. I don't think this is really what you want.

If all you want to do is use 2 source documents in your transformation, use
XSLT's document function. For example, to get the union of root nodes from the
main source tree and another doc:

  <xsl:variable name="bothDocs" select="/|document('otherdoc.xml')"/>

Then you can refer to $bothDocs/path/to/some/nodes. The initial slash
is the root node of the main source tree; "|" means union of two node-sets, 
and the document() call returns the root node of otherdoc.xml.

You can, of course, use the document() function separately to access
just that document's node tree.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.