473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

XML Transform Problem

I am trying to transform an xml document using an xsl
document into HTML.

I am getting the following error:

"There are multiple root elements in the output XML."

So I had the contents of the loaded xml document written
out on screen - copied it and placed the contents in a
physical file and saved it. I then created a simple HTML
page with javascript and loaded the xml doc and the xsl
doc I've been using - and javascript with the XMLDOM
object it transforms just fine.

I've ran both the xml and xsl documents in a browser and
they are well formed.

I am baffled. Any clues what is going on?

Thanks

Nov 11 '05 #1
4 5741
B Johnson wrote:
I am trying to transform an xml document using an xsl
document into HTML.

I am getting the following error:

"There are multiple root elements in the output XML."


Sounds like you are transforming to XmlWriter or XmlReader, both of which
ensure XML document is wellformed (aka has the only root element). Transform
to TextWriter or directly to Stream instead.
Alternatively fix up your stylesheet, because multiple root elements in html
is not good thing either.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
* B Johnson wrote in microsoft.public.dotnet.xml:
I am trying to transform an xml document using an xsl
document into HTML.

I am getting the following error:

"There are multiple root elements in the output XML." I am baffled. Any clues what is going on?


Add a template like

<xsl:template match = '/'>
<root>
<xsl:apply-templates />
</root>
</xsl:template>

and have a look at the output.
Nov 11 '05 #3
I changed to using a stream. That worked fine for the
first transformation. But the succeeding transformation,
which is supposed to output HTML tags is failing with the
same error ("There are multiple root elements in the
output XML.").

All the HTML tags fall under one root node which is a div
tag.

Perhaps I'm not understanding what a root element is.

One thing I do notice is that the html is similar to this:

<div>
<table>
<tr>
<td>Test</td>
</tr>
</table>
<table>
<tr>
<td>Test</td>
</tr>
</table>
</div>

So there are children under the DIV element who are on the
same level (ie. table tags).

Any help would be very appreciated.
-----Original Message-----
B Johnson wrote:
I am trying to transform an xml document using an xsl
document into HTML.

I am getting the following error:

"There are multiple root elements in the output XML."
Sounds like you are transforming to XmlWriter or

XmlReader, both of whichensure XML document is wellformed (aka has the only root element). Transformto TextWriter or directly to Stream instead.
Alternatively fix up your stylesheet, because multiple root elements in htmlis not good thing either.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

.

Nov 11 '05 #4
B Johnson wrote:
I changed to using a stream. That worked fine for the
first transformation. But the succeeding transformation,
which is supposed to output HTML tags is failing with the
same error ("There are multiple root elements in the
output XML.").


What's "succeeding transformation"?

Above exception is thrown by XSLT engine when outputted document has
more than one root element (outermost element) and:
1) output method is xml, and
2) you have either doctype-system="ddd" or standalone="yes"
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #5

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

Similar topics

4
by: Luther Baker | last post by:
My team is using the FO library to generate PDFs. We are also required to use https. The XSL transform page fed into javax.xml.transform.Transformer starts with <?xml version="1.0"?>...
2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
8
by: Luther Miller | last post by:
I am using the XML tranform functionality in .NET to transform data in a DataSet into XMLSS using an XSLT file I have created. There are about 100 columns and only about 120 rows in the data...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
3
by: b0yce | last post by:
Hi Group, I think I have found a problem with the <xsl:element> when being transformed by the .NET xmlTransform class. When using XmlSpy for development and debugging, the <xsl:number>...
3
by: Jason S | last post by:
Hello Group, I am just about tearing my hair out with this one and thought someone may have some insight. I have a transform that wasn't working so I grabbed the nearest debugger (xselerator)...
3
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty...
1
by: steve | last post by:
I am trying to create an XSLT Transform but keep getting the same problem. Overload resolution failed because no accessible 'Transform' can be called with these arguments. I create a reference...
4
by: Dean Card | last post by:
Okay, so here is the situation. I have need to do some on-the-fly image creation. I have everything working great except for the last part of it, applying a perspective type transform to the...
19
by: Taras_96 | last post by:
Hi all, A poster at http://bytes.com/forum/thread60652.html implies that using strtoupper in transform doesn't work because ctype.h may define strtoupper as a macro: "The problem is that most...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...

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.