Ne tests for xsl:function (spec change 26308)
authordebbie
Fri, 15 Aug 2014 14:41:27 +0100
changeset 615 d45896759bce
parent 614 3958edb74eba
child 616 94e24004aed9
Ne tests for xsl:function (spec change 26308)
tests/decl/function/_function-test-set.xml
tests/decl/function/function-0103.xsl
tests/decl/function/function-0104.xsl
tests/decl/function/function-0105.xsl
tests/decl/function/function-0106.xsl
tests/decl/function/function-0107.xsl
tests/decl/function/function-0108.xsl
tests/decl/function/function-0109.xsl
tests/decl/function/function-0110.xsl
tests/decl/function/function-0111.xsl
tests/decl/function/function-0112.xsl
tests/decl/function/function-0113.xsl
tests/decl/function/function-0114.xsl
tests/decl/function/function-0115.xsl
tests/decl/function/function-0116.xsl
tests/decl/function/function-0117.xsl
tests/decl/function/function-0118.xsl
tests/fn/snapshot/_snapshot-test-set.xml
tests/fn/snapshot/snapshot-0106.xsl
tests/fn/snapshot/snapshot-0107.xsl
--- a/tests/decl/function/_function-test-set.xml	Thu Aug 14 15:29:13 2014 +0100
+++ b/tests/decl/function/_function-test-set.xml	Fri Aug 15 14:41:27 2014 +0100
@@ -213,6 +213,246 @@
     <union>24</union></out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="function-0103">
+      <description>simple xsl:function, test override=" yes " accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0103.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0104">
+      <description>simple xsl:function, test override="no" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0104.xsl"/>
+      </test>
+      <result>
+         <assert>out</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0105">
+      <description>simple xsl:function, test override="true" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0105.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0106">
+      <description>simple xsl:function, test override="false" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0106.xsl"/>
+      </test>
+      <result>
+         <assert>out</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0107">
+      <description>simple xsl:function, test override="1" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0107.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0108">
+      <description>simple xsl:function, test override="0" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0108.xsl"/>
+      </test>
+      <result>
+         <assert>out</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0109">
+      <description>simple xsl:function, test override-extension-function="yes" and identity-sensitive="yes" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0109.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0110">
+      <description>simple xsl:function, test override-extension-function=" no " accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0110.xsl"/>
+      </test>
+      <result>
+         <assert>out</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0111">
+      <description>simple xsl:function, test override-extension-function="true" and identity-sensitive="true" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0111.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0112">
+      <description>simple xsl:function, test override-extension-function="false" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0112.xsl"/>
+      </test>
+      <result>
+         <assert>out</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0113">
+      <description>simple xsl:function, test override-extension-function="1" and identity-sensitive="1" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0113.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0114">
+      <description>simple xsl:function, test override-extension-function="0" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0114.xsl"/>
+      </test>
+      <result>
+         <assert>out</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0115">
+      <description>simple xsl:function, test override-extension-function=" " (not allowed)</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0115.xsl"/>
+      </test>
+      <result>
+         <error code="XTSE0020"/>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0116">
+      <description>simple xsl:function, test @override-extension-function="yes" and @override="true" accepted</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0116.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>17</out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0117">
+      <description>simple xsl:function, test @override-extension-function="1" and @override="no" rejected</description>
+      <created by="Debbie Lockett" on="2014-08-14"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0117.xsl"/>
+      </test>
+      <result>
+         <error code="XTSE0020"/>
+      </result>
+   </test-case>
+   
+   <test-case name="function-0118">
+      <description>simple xsl:function, test @identity-sensitive="Yes" (not allowed)</description>
+      <created by="Debbie Lockett" on="2014-08-15"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-0118.xsl"/>
+      </test>
+      <result>
+         <error code="XTSE0020"/>
+      </result>
+   </test-case>
 
    <test-case name="function-0201">
       <description>simple function, 2 args, one atomized</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0103.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override=" yes " accepted -->
+
+  <xsl:function name="app:count-elements" override=" yes ">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0104.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override="no" accepted -->
+
+  <xsl:function name="app:count-elements" override="no">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0105.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override="true" accepted -->
+
+  <xsl:function name="app:count-elements" override="true">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0106.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override="false" accepted -->
+
+  <xsl:function name="app:count-elements" override="false">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0107.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override="1" accepted -->
+
+  <xsl:function name="app:count-elements" override="1">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0108.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override="0" accepted -->
+
+  <xsl:function name="app:count-elements" override="0">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0109.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function="yes" and identity-sensitive="yes" accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function="yes" identity-sensitive="yes">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0110.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function=" no " accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function=" no ">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0111.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function="true" and identity-sensitive="true" accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function="true" identity-sensitive="true">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0112.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function="false" accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function="false">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0113.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function="1" and identity-sensitive="1" accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function="1" identity-sensitive="1">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0114.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function="0" accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function="0">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0115.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test override-extension-function=" " (not allowed) -->
+
+  <xsl:function name="app:count-elements" override-extension-function=" ">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0116.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test @override-extension-function="yes" and @override="true" accepted -->
+
+  <xsl:function name="app:count-elements" override-extension-function="yes" override="true">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0117.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, @override-extension-function="1" and @override="no" rejected -->
+
+  <xsl:function name="app:count-elements" override-extension-function="1" override="no">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-0118.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0"?> 
+
+<?spec xslt#stylesheet-functions?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+xmlns:app="http://app.com/" exclude-result-prefixes="app">
+
+  <!-- simple xsl:function, test with @identity-sensitive="Yes" (not allowed) -->
+
+  <xsl:function name="app:count-elements" identity-sensitive="Yes">
+    <xsl:param name="doc"/>
+    <xsl:sequence select="count($doc//*)"/>   
+</xsl:function>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:value-of select="app:count-elements(/)"/>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- a/tests/fn/snapshot/_snapshot-test-set.xml	Thu Aug 14 15:29:13 2014 +0100
+++ b/tests/fn/snapshot/_snapshot-test-set.xml	Fri Aug 15 14:41:27 2014 +0100
@@ -150,4 +150,34 @@
       </result>
    </test-case> 
    
+   <test-case name="snapshot-0106">
+      <description>Compare actual snapshot() results with the implementation in the spec; test identity-senstive="false" for xsl:function</description>
+      <created by="Debbie Lockett" on="2014-08-15"/>
+      <environment ref="snapshot-01"/>   
+      <test>
+         <stylesheet file="snapshot-0106.xsl"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/out</assert>
+            <assert>not(/out/wrong)</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="snapshot-0107">
+      <description>Compare actual snapshot() results with the implementation in the spec; test identity-senstive=" 0 " for xsl:function</description>
+      <created by="Debbie Lockett" on="2014-08-15"/>
+      <environment ref="snapshot-01"/>   
+      <test>
+         <stylesheet file="snapshot-0107.xsl"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/out</assert>
+            <assert>not(/out/wrong)</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
 </test-set>   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fn/snapshot/snapshot-0106.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,96 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+ xmlns:f="http://example.com/functions" 
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ exclude-result-prefixes="f xs">
+ 
+<!-- Test that the results of the fn:snapshot function are equivalent to the 
+ implementation given in the XSLT spec; test identity-senstive="false" for xsl:function -->
+ 
+<xsl:template match="/">
+ <out>
+  <xsl:for-each select="* (:descendant::node()/(. | @* | namespace::*) :)">
+    <xsl:if test="not(deep-equal(snapshot(.), f:snapshot(.)) 
+                       and deep-equal(snapshot(.)/root(), f:snapshot(.)/root()))"> 
+      <wrong node="{generate-id(.)}">
+        <actual><xsl:sequence select="snapshot(.)/root()"/></actual>
+        <expected><xsl:sequence select="f:snapshot(.)/root()"/></expected>
+      </wrong>
+    </xsl:if>
+  </xsl:for-each>
+ </out>
+</xsl:template> 
+ 
+
+
+<!-- Following functions are the implementation of fn:snapshot defined in the XSLT 3.0 spec -->
+
+  <xsl:function name="f:snapshot" as="node()?" identity-sensitive="false">
+  <xsl:param name="origin" as="node()?"/>
+  
+  <!-- create a copy of the tree containing the supplied node, retaining only
+       * the supplied node with its attributes and namespaces
+       * the ancestors of the supplied node with their attributes and namespaces
+       * the descendants of the supplied node with their attributes and namespaces
+       -->
+  <xsl:variable name="root-copy" as="node()">
+    <xsl:apply-templates select="root($origin)" mode="snapshot">
+      <xsl:with-param name="origin" select="$origin" tunnel="yes"/>
+    </xsl:apply-templates>
+  </xsl:variable>
+  
+  <!-- find and return the node in the copied tree that corresponds to the origin node
+       --> 
+  <xsl:sequence select="$root-copy/descendant-or-self::node()/(.|@*|namespace::*)
+      [f:corresponds(., $origin)]"/>
+</xsl:function>
+
+<xsl:template match="." mode="snapshot">
+  <xsl:param name="origin" as="node()" tunnel="yes"/>
+  <xsl:choose>
+    <xsl:when test=". is $origin">
+      <xsl:copy-of select="." validation="preserve"/>
+    </xsl:when>
+    <xsl:when test=". intersect $origin/ancestor::node()">
+      <xsl:copy validation="strip">
+        <xsl:copy-of select="@*" validation="preserve"/>
+        <xsl:apply-templates mode="snapshot"/>
+      </xsl:copy>
+    </xsl:when>
+    <xsl:otherwise/>
+  </xsl:choose>
+</xsl:template>
+
+<!-- f:corresponds compares two nodes and returns true if all the following are true:
+     * they are at the same depth in their respective trees
+     * they have the same name (or none)
+     * they have the same node kind
+     The tests on node name and node kind are needed only when the origin node is an
+     attribute or namespace.
+     -->
+<xsl:function name="f:corresponds" as="xs:boolean">
+  <xsl:param name="node1" as="node()"/>
+  <xsl:param name="node2" as="node()"/>
+  <xsl:sequence select="
+    count($node1/ancestor::node()) = count($node2/ancestor::node()) and
+    deep-equal(node-name($node1), node-name($node2)) and
+    f:node-kind($node1) = f:node-kind($node2)"/>    
+</xsl:function>
+
+<!-- f:node-kind returns a string identifying the node kind of the supplied node
+     -->
+<xsl:function name="f:node-kind" as="xs:string">
+  <xsl:param name="node" as="node()"/>
+  <xsl:choose>
+    <xsl:when test="$node instance of document-node()">D</xsl:when>
+    <xsl:when test="$node instance of element(*)">E</xsl:when>
+    <xsl:when test="$node instance of attribute(*)">A</xsl:when>
+    <xsl:when test="$node instance of text()">T</xsl:when>
+    <xsl:when test="$node instance of comment()">C</xsl:when>
+    <xsl:when test="$node instance of processing-instruction()">P</xsl:when>
+    <xsl:when test="$node instance of namespace-node()">N</xsl:when>
+  </xsl:choose>
+</xsl:function>
+
+
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fn/snapshot/snapshot-0107.xsl	Fri Aug 15 14:41:27 2014 +0100
@@ -0,0 +1,96 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+ xmlns:f="http://example.com/functions" 
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ exclude-result-prefixes="f xs">
+ 
+<!-- Test that the results of the fn:snapshot function are equivalent to the 
+ implementation given in the XSLT spec; test identity-senstive=" 0 " for xsl:function -->
+ 
+<xsl:template match="/">
+ <out>
+  <xsl:for-each select="* (:descendant::node()/(. | @* | namespace::*) :)">
+    <xsl:if test="not(deep-equal(snapshot(.), f:snapshot(.)) 
+                       and deep-equal(snapshot(.)/root(), f:snapshot(.)/root()))"> 
+      <wrong node="{generate-id(.)}">
+        <actual><xsl:sequence select="snapshot(.)/root()"/></actual>
+        <expected><xsl:sequence select="f:snapshot(.)/root()"/></expected>
+      </wrong>
+    </xsl:if>
+  </xsl:for-each>
+ </out>
+</xsl:template> 
+ 
+
+
+<!-- Following functions are the implementation of fn:snapshot defined in the XSLT 3.0 spec -->
+
+  <xsl:function name="f:snapshot" as="node()?" identity-sensitive=" 0 ">
+  <xsl:param name="origin" as="node()?"/>
+  
+  <!-- create a copy of the tree containing the supplied node, retaining only
+       * the supplied node with its attributes and namespaces
+       * the ancestors of the supplied node with their attributes and namespaces
+       * the descendants of the supplied node with their attributes and namespaces
+       -->
+  <xsl:variable name="root-copy" as="node()">
+    <xsl:apply-templates select="root($origin)" mode="snapshot">
+      <xsl:with-param name="origin" select="$origin" tunnel="yes"/>
+    </xsl:apply-templates>
+  </xsl:variable>
+  
+  <!-- find and return the node in the copied tree that corresponds to the origin node
+       --> 
+  <xsl:sequence select="$root-copy/descendant-or-self::node()/(.|@*|namespace::*)
+      [f:corresponds(., $origin)]"/>
+</xsl:function>
+
+<xsl:template match="." mode="snapshot">
+  <xsl:param name="origin" as="node()" tunnel="yes"/>
+  <xsl:choose>
+    <xsl:when test=". is $origin">
+      <xsl:copy-of select="." validation="preserve"/>
+    </xsl:when>
+    <xsl:when test=". intersect $origin/ancestor::node()">
+      <xsl:copy validation="strip">
+        <xsl:copy-of select="@*" validation="preserve"/>
+        <xsl:apply-templates mode="snapshot"/>
+      </xsl:copy>
+    </xsl:when>
+    <xsl:otherwise/>
+  </xsl:choose>
+</xsl:template>
+
+<!-- f:corresponds compares two nodes and returns true if all the following are true:
+     * they are at the same depth in their respective trees
+     * they have the same name (or none)
+     * they have the same node kind
+     The tests on node name and node kind are needed only when the origin node is an
+     attribute or namespace.
+     -->
+<xsl:function name="f:corresponds" as="xs:boolean">
+  <xsl:param name="node1" as="node()"/>
+  <xsl:param name="node2" as="node()"/>
+  <xsl:sequence select="
+    count($node1/ancestor::node()) = count($node2/ancestor::node()) and
+    deep-equal(node-name($node1), node-name($node2)) and
+    f:node-kind($node1) = f:node-kind($node2)"/>    
+</xsl:function>
+
+<!-- f:node-kind returns a string identifying the node kind of the supplied node
+     -->
+<xsl:function name="f:node-kind" as="xs:string">
+  <xsl:param name="node" as="node()"/>
+  <xsl:choose>
+    <xsl:when test="$node instance of document-node()">D</xsl:when>
+    <xsl:when test="$node instance of element(*)">E</xsl:when>
+    <xsl:when test="$node instance of attribute(*)">A</xsl:when>
+    <xsl:when test="$node instance of text()">T</xsl:when>
+    <xsl:when test="$node instance of comment()">C</xsl:when>
+    <xsl:when test="$node instance of processing-instruction()">P</xsl:when>
+    <xsl:when test="$node instance of namespace-node()">N</xsl:when>
+  </xsl:choose>
+</xsl:function>
+
+
+
+</xsl:stylesheet>
\ No newline at end of file