473,414 Members | 1,876 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,414 software developers and data experts.

XmlException "Root element is missing" on XslCompiledTransform.Load method

When I try to load my xslt i get an xml exception with the message "Root
element is missing". The stylesheet works when I preview it in stylus
studio, but apparently not in my application. Any ideas what may be wrong?

The stylesheet:

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="PC"/>
</xsl:template>

<xsl:template match="PC">
<xsl:element name="pcf:PC" namespace="http://www.protang.se/ProFrame">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates select="type"/>
<xsl:apply-templates select="*/@name"/>
</xsl:element>
</xsl:template>

<xsl:template match="type">
<xsl:copy>
<xsl:copy-of select="node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="@name">
<xsl:element name="{.}">
<xsl:attribute name="name">
<xsl:value-of select="local-name(..)"/>
</xsl:attribute>
<xsl:if test="current()='option'">
<xsl:attribute name="present">
<xsl:value-of select="../@present"/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="../node()"/>
</xsl:element>
</xsl:template>

</xsl:transform>
<!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software
Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes"
externalpreview="no" url="file:///p:/Avdelningar/1107TC/ProFrame demo
(TS)/demo form_data5.xml" htmlbaseurl="" outputurl=""
processortype="internal" useresolver="yes" profilemode="0" profiledepth=""
profilelength="" urlprofilexml="" commandline="" additionalpath=""
additionalclasspath="" postprocessortype="none" postprocesscommandline=""
postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no"
validator="internal"
customvalidator=""/></scenarios><MapperMetaTag><MapperInfo
srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath=""
destSchemaRoot="" destSchemaPathIsRelative="yes"
destSchemaInterpretAsXML="no" ><SourceSchema
srcSchemaPath="file:///p:/Avdelningar/1107TC/ProFrame demo (TS)/demo
form_data4.xml" srcSchemaRoot="PC" AssociatedInstance=""
loaderFunction="document"
loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template
match="/"></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter
side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->

Nov 20 '06 #1
1 5713
Hrm, sorry, I was mistaken, the xmlexception doesn't come from the load
method. Messed up my try/catch blocks...

"Tomas" <to*************@yahoo.comwrote in message
news:98**********************************@microsof t.com...
When I try to load my xslt i get an xml exception with the message "Root
element is missing". The stylesheet works when I preview it in stylus
studio, but apparently not in my application. Any ideas what may be wrong?

The stylesheet:

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="PC"/>
</xsl:template>

<xsl:template match="PC">
<xsl:element name="pcf:PC" namespace="http://www.protang.se/ProFrame">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:apply-templates select="type"/>
<xsl:apply-templates select="*/@name"/>
</xsl:element>
</xsl:template>

<xsl:template match="type">
<xsl:copy>
<xsl:copy-of select="node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="@name">
<xsl:element name="{.}">
<xsl:attribute name="name">
<xsl:value-of select="local-name(..)"/>
</xsl:attribute>
<xsl:if test="current()='option'">
<xsl:attribute name="present">
<xsl:value-of select="../@present"/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="../node()"/>
</xsl:element>
</xsl:template>

</xsl:transform>
<!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software
Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1"
userelativepaths="yes" externalpreview="no"
url="file:///p:/Avdelningar/1107TC/ProFrame demo (TS)/demo form_data5.xml"
htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes"
profilemode="0" profiledepth="" profilelength="" urlprofilexml=""
commandline="" additionalpath="" additionalclasspath=""
postprocessortype="none" postprocesscommandline=""
postprocessadditionalpath="" postprocessgeneratedext=""
validateoutput="no" validator="internal"
customvalidator=""/></scenarios><MapperMetaTag><MapperInfo
srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no"
destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes"
destSchemaInterpretAsXML="no" ><SourceSchema
srcSchemaPath="file:///p:/Avdelningar/1107TC/ProFrame demo (TS)/demo
form_data4.xml" srcSchemaRoot="PC" AssociatedInstance=""
loaderFunction="document"
loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template
match="/"></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter
side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->
Nov 20 '06 #2

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

Similar topics

0
by: ReignMan | last post by:
I'm running JDK 1.4.0_01, Xalan2.5.1 and Tomcat 4.1.27. XSL transformations work, yet when running in debug mode (Eclipse IDE), I get the following: 990S2html.xsl:3:80: Element type...
3
by: Jonathan | last post by:
Hi all: I originally posted this in an HTML forum, but have realized that the solution may (a) require a server-side change or (b) be non-existent. In any case, since the page I'm dealing with is...
5
by: TomislaW | last post by:
What is asp.net equivalent for Application("Root") in asp?
2
by: drisso | last post by:
Hello, I have searched that error on these message boards, msdn and crystaldecisions.com. I found tutorials that showed how to export a crystal report to pdf, but like many others I am getting...
4
by: eksamor | last post by:
I have a simple linked list: struct element { struct element *next; int start; }; struct list { struct element *head;
2
by: tony | last post by:
XslCompiledTransform xslt = new XslCompiledTransform(); ASCIIEncoding encodeToByteArray = new ASCIIEncoding(); MemoryStream inputStream = new MemoryStream(); MemoryStream outputStream = new...
3
by: lisa.bogart | last post by:
I am getting a "Root element is missing" error when I try to load a stream into and XmlDocument. Can anyone help me with what I am doing wrong??? Dim xmlTextWriter As XmlTextWriter = Nothing...
11
by: MC | last post by:
I have a couple of customers who are using a program that deserializes an XML file, and on some files, the program fails to see the content of the file -- treats it as zero length and reports "root...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...
0
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...

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.