New/changed xsl:accept tests (spec changed since 2015 version)
authorMichael Kay <mike@saxonica.com>
Mon, 10 Jul 2017 22:43:24 +0100
changeset 1716 f26605cfc94f
parent 1715 b57b6910c021
child 1717 7af84915cce5
New/changed xsl:accept tests (spec changed since 2015 version)
tests/decl/accept/_accept-test-set.xml
tests/decl/accept/accept-009.xsl
tests/decl/accept/accept-010.xsl
tests/decl/accept/accept-011.xsl
tests/decl/accept/accept-012.xsl
tests/decl/accept/accept-040.xsl.xml
tests/decl/accept/accept-A.xsl
tests/decl/accept/accept-B.xsl
--- a/tests/decl/accept/_accept-test-set.xml	Mon Jul 10 22:42:03 2017 +0100
+++ b/tests/decl/accept/_accept-test-set.xml	Mon Jul 10 22:43:24 2017 +0100
@@ -139,6 +139,57 @@
       </result>
    </test-case>
    
+   <test-case name="accept-009">
+      <description>xsl:accept conflict resolution: last wildcard with same priority wins</description>
+      <created by="Michael Kay" on="2017-07-10"/>
+      <environment ref="accept-A"/>
+      <test>
+         <package file="accept-009.xsl" role="principal"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out foo="2"/>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="accept-010">
+      <description>xsl:accept conflict resolution: higher priority wins</description>
+      <created by="Michael Kay" on="2017-07-10"/>
+      <environment ref="accept-A"/>
+      <test>
+         <package file="accept-010.xsl" role="principal"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out foo="2"/>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="accept-011">
+      <description>xsl:accept: cannot accept final component as public</description>
+      <created by="Michael Kay" on="2017-07-10"/>
+      <environment ref="accept-A"/>
+      <test>
+         <package file="accept-011.xsl" role="principal"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <error code="XTSE3040"/>
+      </result>
+   </test-case>
+   
+   <test-case name="accept-012">
+      <description>xsl:accept: cannot accept private component as public</description>
+      <created by="Michael Kay" on="2017-07-10"/>
+      <environment ref="accept-A"/>
+      <test>
+         <package file="accept-012.xsl" role="principal"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <error code="XTSE3040"/>
+      </result>
+   </test-case>
    
    
    <test-case name="accept-020">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/accept/accept-009.xsl	Mon Jul 10 22:43:24 2017 +0100
@@ -0,0 +1,30 @@
+<!-- xsl:accept - reduce the visibility to hidden. Component becomes inaccessible -->
+
+<xsl:package
+  name="http://www.w3.org/xslt30tests/accept-003"  
+  package-version="1.0.0"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:p="http://www.w3.org/xslt30tests/accept-A"
+  exclude-result-prefixes="xs p">
+  
+  <xsl:use-package
+     name="http://www.w3.org/xslt30tests/accept-A"
+     package-version="1.0.0">
+     
+    <!-- Last matching wildcard (if equal priority) wins --> 
+     
+    <xsl:accept component="variable" names="*" visibility="hidden"/> 
+    <xsl:accept component="*" names="p:*" visibility="hidden"/>
+    <xsl:accept component="*" names="*:v2" visibility="private"/>
+ 
+         
+  </xsl:use-package>  
+  
+  <xsl:template name="main">
+    <out foo="{$p:v2}"/>
+  </xsl:template>  
+  
+
+</xsl:package>   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/accept/accept-010.xsl	Mon Jul 10 22:43:24 2017 +0100
@@ -0,0 +1,30 @@
+<!-- xsl:accept - reduce the visibility to hidden. Component becomes inaccessible -->
+
+<xsl:package
+  name="http://www.w3.org/xslt30tests/accept-003"  
+  package-version="1.0.0"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:p="http://www.w3.org/xslt30tests/accept-A"
+  exclude-result-prefixes="xs p">
+  
+  <xsl:use-package
+     name="http://www.w3.org/xslt30tests/accept-A"
+     package-version="1.0.0">
+     
+    <!-- Higher priority wildcard wins even if not last --> 
+        
+    <xsl:accept component="*" names="p:*" visibility="hidden"/>
+    <xsl:accept component="*" names="*:v2" visibility="private"/>
+    <xsl:accept component="variable" names="*" visibility="hidden"/> 
+ 
+         
+  </xsl:use-package>  
+  
+  <xsl:template name="main">
+    <out foo="{$p:v2}"/>
+  </xsl:template>  
+  
+
+</xsl:package>   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/accept/accept-011.xsl	Mon Jul 10 22:43:24 2017 +0100
@@ -0,0 +1,27 @@
+<!-- xsl:accept - reduce the visibility to hidden. Component becomes inaccessible -->
+
+<xsl:package
+  name="http://www.w3.org/xslt30tests/accept-003"  
+  package-version="1.0.0"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:p="http://www.w3.org/xslt30tests/accept-A"
+  exclude-result-prefixes="xs p">
+  
+  <xsl:use-package
+     name="http://www.w3.org/xslt30tests/accept-A"
+     package-version="1.0.0">
+     
+    <!-- Error: cannot accept final component as public --> 
+        
+    <xsl:accept component="function" names="p:f1" visibility="public"/>
+         
+  </xsl:use-package>  
+  
+  <xsl:template name="main">
+    <out foo="{$p:v2}"/>
+  </xsl:template>  
+  
+
+</xsl:package>   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/accept/accept-012.xsl	Mon Jul 10 22:43:24 2017 +0100
@@ -0,0 +1,28 @@
+<!-- xsl:accept - reduce the visibility to hidden. Component becomes inaccessible -->
+
+<xsl:package
+  name="http://www.w3.org/xslt30tests/accept-003"  
+  package-version="1.0.0"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:p="http://www.w3.org/xslt30tests/accept-A"
+  xmlns:q="http://www.w3.org/xslt30tests/accept-A-private"
+  exclude-result-prefixes="xs p">
+  
+  <xsl:use-package
+     name="http://www.w3.org/xslt30tests/accept-A"
+     package-version="1.0.0">
+     
+    <!-- Error: cannot accept private component as public --> 
+        
+    <xsl:accept component="function" names="q:f2" visibility="public"/>
+         
+  </xsl:use-package>  
+  
+  <xsl:template name="main">
+    <out foo="{q:f2()}"/>
+  </xsl:template>  
+  
+
+</xsl:package>   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/accept/accept-040.xsl.xml	Mon Jul 10 22:43:24 2017 +0100
@@ -0,0 +1,41 @@
+<!-- xsl:accept - OK to have an absent function that isn't called -->
+
+<xsl:package
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:C="http://www.w3.org/xslt30/tests/accept"
+  exclude-result-prefixes="xs C">
+  
+  <xsl:use-package
+     name="http://www.w3.org/xslt30tests/accept-C"
+     package-version="1.0.0">
+    
+    <xsl:override>
+      <xsl:variable name="v1" as="xs:integer" select="22"/>
+      
+      <xsl:template name="t1" as="xs:integer">
+        <xsl:param name="p1" as="xs:string"/>
+        <xsl:sequence select="22"/>
+      </xsl:template>
+      
+      <xsl:attribute-set name="a1">
+        <xsl:attribute name="a" select="22"/>
+      </xsl:attribute-set>    
+      
+    </xsl:override>
+    
+    <xsl:accept component="function" names="C:f1" visibility="absent"/>
+  </xsl:use-package>  
+  
+  
+  <xsl:template name="main">
+    <out xsl:use-attribute-sets="a1">
+      <xsl:call-template name="t1">
+        <xsl:with-param name="p1" select="string($v1)"/>
+      </xsl:call-template>
+    </out>
+  </xsl:template>  
+  
+
+</xsl:package>   
\ No newline at end of file
--- a/tests/decl/accept/accept-A.xsl	Mon Jul 10 22:42:03 2017 +0100
+++ b/tests/decl/accept/accept-A.xsl	Mon Jul 10 22:43:24 2017 +0100
@@ -23,6 +23,8 @@
   <xsl:expose component="attribute-set" names="p:*" visibility="final"/>
   <xsl:expose component="mode" names="p:*" visibility="final"/>
   
+  <xsl:expose component="*" names="q:*" visibility="private"/>
+  
   <xsl:variable name="v1" select="1"/>
   <xsl:variable name="p:v2" select="2"/>
   
--- a/tests/decl/accept/accept-B.xsl	Mon Jul 10 22:42:03 2017 +0100
+++ b/tests/decl/accept/accept-B.xsl	Mon Jul 10 22:43:24 2017 +0100
@@ -23,6 +23,8 @@
   <xsl:expose component="attribute-set" names="p:*" visibility="final"/>
   <xsl:expose component="mode" names="p:*" visibility="final"/>
   
+  <xsl:expose component="function" names="q:f3" visibility="private"/>
+  
   <xsl:variable name="v1" select="11"/>
   <xsl:variable name="p:v2" select="22"/>
   
@@ -32,6 +34,7 @@
   <xsl:function name="p:f1"><xsl:sequence select="11"/></xsl:function>
   <xsl:function name="p:f2"><xsl:sequence select="22"/></xsl:function>
   <xsl:function name="q:f2"><xsl:sequence select="33"/></xsl:function>
+  <xsl:function name="q:f3"><xsl:sequence select="44"/></xsl:function>
   
   <xsl:attribute-set name="a1">
     <xsl:attribute name="A" select="'AA'"/>