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

Re: Generating XML fragment to DOM node using XSL

Subject: Re: Generating XML fragment to DOM node using XSL
From: Tim Meals <tim@xxxxxxxxxxxx>
Date: Tue, 16 Dec 2003 11:42:57 -0800
tim meals
Steve --

Xalan's right.  An XML document may have only one root node.  If I'm
dealing with the DOM, I either keep a handle to the root node, or
retrieve it from the document, and append to it.  Not having Javadocs
open, here's what it would look like off the top of my head:

// Get the root node, assuming "doc" is a Document
Node root = doc.getDocumentElement();
root.append( new Element( "RootsChild" ) );

Of course, you can add Text nodes, attributes, etc. in here too.

Best of luck,
Tim

On Tue, 2003-12-16 at 11:25, Steve Dussinger wrote:
> Hi All:
> 
> I am attempting to use an XSL stylesheet to take data from an existing
> DOM document, and place it into a different existing DOM document.
> 
> The problem I'm having is that I get the following exception from
> Xalan-J (version 2.5.2), because I am not generating a single root
> node from my stylesheet:
> 
> "Can't have more than one root on a DOM!"
> 
> Now I understand that I can't create more than one root node on a DOM
> document, but since I'm generating these nodes into an already
> existing document, I assumed that this would not be an issue. I can
> generate a single root node as part of my transform, and all works
> fine, but the resulting data as placed into my destination document is
> screwed due to the addition of a new node.
> 
> Is there some switch setting or something that I need to use to make
> this work? I'm fervently hoping that this is not something that "just
> can't be done using XSLT", and that I've just missed something in the
> docs...
> 
> Any help greatly appreciated...
> 
> Thanx,
>    Steve Dussinger
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
-- 
/**
 * Tim Meals
 * Applications Developer
 *
 * @email   tim@xxxxxxxxxxxx
 */


 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.