Jen Jiang wrote:
I kept getting "...Only one top level element is
allowed in an XML document. Error processing resource"
even though I have checked many times that there is
only one top level element which is <xsl:stylesheet>
Can someone help? Here's the xslt file.
The problem then is not with your XSL file but your XML file... I'm not
sure what processor you are using but the "sound" of the error is much
more like that of what a XML parser will display when parsing a badly
formed XML document. You need to reduce the number of top level
elements before your transformation will work... so, for example, if
your XML looks like this:
<?xml version="1.0" encoding="utf-8"?>
<elements>
<element/>
</elements>
<elements>
<element/>
</elements>
You would need to either add a top level "wrapper" like this:
<?xml version="1.0" encoding="utf-8"?>
<elements>
<elements>
<element/>
</elements>
<elements>
<element/>
</elements>
</elements>
or, if possible to do without changing the structural meaning of your
document, merge the "element" children into on "elements" parent:
<?xml version="1.0" encoding="utf-8"?>
<elements>
<element/>
<element/>
</elements>
Of course I am speaking hypothetically and your XML file obviously
doesnt look like this....
Hope this helps!
<M:D/>