473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating XML fragment to DOM node using XSL

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 rot 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
Jul 20 '05 #1
3 2133
If you're interested in a JDOM solution, let me know.

There's no point of my cooking up a solution if it is of no interest to you.
Jul 20 '05 #2
gi************* ******@yahoo.co m (GIMME) wrote in message news:<3f******* *************** ****@posting.go ogle.com>...
If you're interested in a JDOM solution, let me know.

There's no point of my cooking up a solution if it is of no interest to you.


Thanx for the interest, but I *really* need to be able to do this with XSLT...

Thanx anyway.

--Steve
Jul 20 '05 #3
I'm puzzled by what you mean when you say you need use XSLT.

Do you mean that you need a command line solution and that
you can't write a JAVA program to do the work?

XSLT transforms are easy with JDOM.

With JDOM you can go back and forth between JDOM
Documents and W3C Documents with one method call.

Go to http://www.jdom.org/docs/apidocs/index.html and look
at DOMBuilder and DOMOutputter. Look at JDOMResult if you
want to see how to do a transform.

If you want an example where I :

1. read an xslt file,
2. read an xml
3. read an xml
4. Do a transform on one and two.
5. Combine the result with 3.
6. Return a single org.w3c.dom.Doc ument

let me know. That's what you wanted. Right?
sd******@tampab ay.rr.com (Steve Dussinger) wrote in message news:<c0******* *************** ****@posting.go ogle.com>...
gi************* ******@yahoo.co m (GIMME) wrote in message news:<3f******* *************** ****@posting.go ogle.com>...
If you're interested in a JDOM solution, let me know.

There's no point of my cooking up a solution if it is of no interest to you.


Thanx for the interest, but I *really* need to be able to do this with XSLT...

Thanx anyway.

--Steve

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
2138
by: flupke | last post by:
Hi, i create my GUIs mainly via wxGlade. However when you start of to program and want to do some rearranging to the gui, wxglade overwrites your file and you've got to put your own code back in. I think i can work around that (at least a bit) by making a second file that imports the gui generated by wxglade and make classes that extend the original ones. For instance i could have a class MainForm that extends the wxFrame
1
1753
by: QuantDev | last post by:
Hi NG, I would need to validate an XML fragment against a type defined within an XSD (which defines many other things). What is the correct way of achieving this? QD2004
2
2401
by: Rick Strahl [MVP] | last post by:
Hi all, I need a reality check <g>... I have the following XML fragment: <event sitename="West Wind Demo Link"> <url>http://rasnotebook/wconnect/testpage.wwd?Test2</url> <time>11/17/2003 7:32:39 pm</time>
2
2027
by: Joe Gass | last post by:
Hi I have a query that uses for xml auto I'd like to load this into an xmldocument with an xmlreader e.g. Dim xr As XmlReader xmlDoc = New XmlDocument xr = oCom.ExecuteXmlReader If xr.Read Then xmlDoc.Load(xr)
1
2312
by: Wallace | last post by:
Hi all, I have a problem on validating a xml fragment using a single namespace schema which spread across multiple schema files using include in the master schema file. No matter how I change the xml fragment (to include default namespace xmlns='urn:xxx:yy' and any other namespace it may have), I still get the same error. 'urn:xxx:yy:Header' element is not declared. An error occurred at , (1, 2).
1
2606
by: Rajarshi | last post by:
Hi, I'm using ElementTree for some RSS processing. The point where I face a problem is that within an <item></itemI need to add another child node (in addition to <linketc) which is a well-formed XML document (Chemical Markup Language to be precise). So my code looks like: import cElementTree as ET c = open('x.cml').readlines()
7
3661
by: Jan Eliasen | last post by:
Hi I have some C# code that loops through an XMLDocument and needs to apply an XSLT stylesheet to each node in the XML document. My (simplified) code looks like this: XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(filename); XmlNodeList nodeliste =
2
9420
by: Shimon Sim | last post by:
Hi I keep getting error : WriteStartDocument cannot be called on writers created with ConformanceLevel.Fragment. The code that I have is very simple. SimpleClass c = new SimpleClass();
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.