Bug #2944
closedUse of xsl:sequence within copy situations is node-destructive
100%
Description
When @$nodes instance of node()*@, then the following:
<a><xsl:sequence select="$nodes/></a>
<b><xsl:sequence select="$nodes/></b>
inserts $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.
Updated by Michael Kay about 8 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
<xsl:copy-of select="$x"/>
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.
Updated by Debbie Lockett about 8 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.
Updated by Debbie Lockett about 8 years ago
Various unit tests created for this bug (in combination with https://saxonica.plan.io/issues/3012#change-7416) for the JS unit testing framework in development.
Updated by Debbie Lockett almost 8 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 0.9.1
Bug fix applied in the Saxon-JS 0.9.1 beta release.
Updated by Community Admin over 7 years ago
- Fixed in JS Release set to Saxon-JS 0.9.1
- Applies to JS Branch 0.9 added
- Fix Committed on JS Branch 0.9 added
Please register to edit this issue
Also available in: Atom PDF Tracking page