#325 Document node in content of element node

v8.3
closed
Michael Kay
5
2012-10-08
2005-03-08
Michael Kay
No

When a document node is constructed as the entire
content of an element constructor, the element gets
wrapped in a document node, which is returned as the
result of the expression.

For example, the result of the XQuery expression

{ doc('bib.xml') }

wraps the contents of bib.xml inside an element as
requested, but returns a document node with as a
child, rather than a parentless e element.

The problem manifested itself in XQuery but the code is
common to XSLT.

Source fix: in
net.sf.saxon.event.ComplexContentOutputter, at line 78,
change the startDocument() method to read:

public void startDocument(int properties) throws

XPathException {
if (pendingStartTag != -1) {
startContent();
} else {
receiver.startDocument(properties);
}
previousAtomic = false;
}

Michael Kay

Discussion