#408 Adding documents to a document

Michael Kay

When the sequence constructor generating the children
of a new document node itself contains a document node,
and there are elements following that document node,
then the tree that is constructed is malformed, and the
elements appear not to be there (they are not selected
when following the child axis from the containing
document node). For example, with

<xsl:variable name="x">
<xsl:copy-of select="document('abc.xml')"/>

the variable $x will appear to contain a copy of the
document abc.xml, but no xyz element.

The problem could also appear in XQuery, though it's
less likely. This bug first appeared in Saxon 8.5.

Circumvention: copy the children of the document node,
not the document node itself, thus:

<xsl:variable name="x">
<xsl:copy-of select="document('abc.xml')/node()"/>

Michael Kay


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks