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:transfor m 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:attribut e 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:attribut e name="name">
<xsl:value-of select="local-name(..)"/>
</xsl:attribute>
<xsl:if test="current() ='option'">
<xsl:attribut e 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.
<metaInformatio n>
<scenarios ><scenario default="yes" name="Scenario1 " userelativepath s="yes"
externalpreview ="no" url="file:///p:/Avdelningar/1107TC/ProFrame demo
(TS)/demo form_data5.xml" htmlbaseurl="" outputurl=""
processortype=" internal" useresolver="ye s" profilemode="0" profiledepth=""
profilelength=" " urlprofilexml=" " commandline="" additionalpath= ""
additionalclass path="" postprocessorty pe="none" postprocesscomm andline=""
postprocessaddi tionalpath="" postprocessgene ratedext="" validateoutput= "no"
validator="inte rnal"
customvalidator =""/></scenarios><Mapp erMetaTag><Mapp erInfo
srcSchemaPathIs Relative="yes" srcSchemaInterp retAsXML="no" destSchemaPath= ""
destSchemaRoot= "" destSchemaPathI sRelative="yes"
destSchemaInter pretAsXML="no" ><SourceSchem a
srcSchemaPath=" file:///p:/Avdelningar/1107TC/ProFrame demo (TS)/demo
form_data4.xml" srcSchemaRoot=" PC" AssociatedInsta nce=""
loaderFunction= "document"
loaderFunctionU sesURI="no"/></MapperInfo><Map perBlockPositio n><template
match="/"></template></MapperBlockPosi tion><TemplateC ontext></TemplateContext ><MapperFilte r
side="source"></MapperFilter></MapperMetaTag>
</metaInformation >
-->
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:transfor m 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:attribut e 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:attribut e name="name">
<xsl:value-of select="local-name(..)"/>
</xsl:attribute>
<xsl:if test="current() ='option'">
<xsl:attribut e 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.
<metaInformatio n>
<scenarios ><scenario default="yes" name="Scenario1 " userelativepath s="yes"
externalpreview ="no" url="file:///p:/Avdelningar/1107TC/ProFrame demo
(TS)/demo form_data5.xml" htmlbaseurl="" outputurl=""
processortype=" internal" useresolver="ye s" profilemode="0" profiledepth=""
profilelength=" " urlprofilexml=" " commandline="" additionalpath= ""
additionalclass path="" postprocessorty pe="none" postprocesscomm andline=""
postprocessaddi tionalpath="" postprocessgene ratedext="" validateoutput= "no"
validator="inte rnal"
customvalidator =""/></scenarios><Mapp erMetaTag><Mapp erInfo
srcSchemaPathIs Relative="yes" srcSchemaInterp retAsXML="no" destSchemaPath= ""
destSchemaRoot= "" destSchemaPathI sRelative="yes"
destSchemaInter pretAsXML="no" ><SourceSchem a
srcSchemaPath=" file:///p:/Avdelningar/1107TC/ProFrame demo (TS)/demo
form_data4.xml" srcSchemaRoot=" PC" AssociatedInsta nce=""
loaderFunction= "document"
loaderFunctionU sesURI="no"/></MapperInfo><Map perBlockPositio n><template
match="/"></template></MapperBlockPosi tion><TemplateC ontext></TemplateContext ><MapperFilte r
side="source"></MapperFilter></MapperMetaTag>
</metaInformation >
-->
Comment