Use of xsl:sequence within copy situations is node-destructive
When @$nodes instance of node()*@, then the following:
<a><xsl:sequence select="$nodes/></a> <b><xsl:sequence select="$nodes/></b>
$nodes only into the second element - within Dom node-insertion removes nodes from any trees they were in previously. With
xsl:copy-of the behaviour is as expected.
#1 Updated by Michael Kay about 2 years ago
Clearly this can be fixed by creating a copy of the node before appending it.
It would be nice, however, to avoid doing a double copy in the case of
One way to achieve this would be to rewrite xsl:copy-of appearing within an element constructor as xsl:sequence at compile time (under appropriate circumstances) - which might be beneficial generally. In fact, I have a feeling we have started doing this for streaming purposes.
#2 Updated by Debbie Lockett almost 2 years ago
- Status changed from New to Resolved
- Found in version set to 0.9
Fixes in makeComplexContent method of Expr.js. When adding an element to a parent, we can't just append an element directly. In the browser, for HTML elements, these should be copies of the original elements (constructed using DU.copyItem). Otherwise, use the Document.importNode method.
Please register to edit this issue