|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: MERGING 2 XML DOCS WITH dom4j parser
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








