469,649 Members | 1,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

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 5450
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by TomislaW | last post: by
4 posts views Thread by eksamor | last post: by
3 posts views Thread by lisa.bogart | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.