This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23785 - [xslt 3.0] snapshot() implementation does not copy document node
Summary: [xslt 3.0] snapshot() implementation does not copy document node
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-11 00:28 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2013-11-11 00:28:54 UTC
Although the narrative description of the snapshot() function indicates that a documetn node at the root of the source tree should be copied, the XSLT specimen implementation of the function leaves the result with no document node at its root. This is because the template rule

<xsl:template match="node()" mode="snapshot">

does not apply to document nodes (only to child nodes(), and the built-in template for document nodes does a "shallow skip", that is, it does not create a document node in the result tree.

Similar problems occur when the argument to snapshot() is a parentless attribute or namespace node: the node is not matched and is therefore not copied.

Possible fixes are either (a) to change match="node()" to match=".", or (b) to add on-no-match="shallow-copy" to the mode declaration.
Comment 1 Michael Kay 2013-11-12 09:50:17 UTC
I have fixed this by changing the template rule to say match=".". I have created test cases that test the supplied stylesheet.