I have an application where I create an xml fragment using
an XslTransform object. However, if I use the following
output method,
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="no" omit-xml-declaration="yes" standalone="no" />
some of my transforms fail with the following exception:
System.Xml.Xsl.XsltException: There are multiple root
elements in the output XML.
This seems like non-conformant behavior because the XSLT
spec [0] specifies that an XML Process must output the
result tree as a "well-formed XML external general parsed
entity." A well-formed external general parsed entity
(EGPE) may contain multiple top-level elements and is not
subject to the single root-element restriction. The formal
definition of an EPGE is found in the XML Specification
[1].
Is there a workaround for this behavior as this means that
a transform cannot output an XML fragment. Creating a root
element involves adding unnessary complexity and
performance costs to my application.
John Meyer
Senior Software Engineer
Clinician Support Technology
1 Wells Avenue, Suite 201
Newton, MA 02459
www.cstlink.com
[0]
http://www.w3.org/TR/xslt#section-XML-Output-Method
[1]
http://www.w3.org/TR/REC-xml#NT-extParsedEnt