Fix schema validation problems in tests
authorMichael Kay <mike@saxonica.com>
Fri, 08 Aug 2014 12:23:59 +0100
changeset 590 3d243483f707
parent 589 027ab344cfa4
child 591 9e5ff3068934
Fix schema validation problems in tests
admin/catalog-schema.xsd
tests/decl/accumulator/_accumulator-test-set.xml
tests/fn/json-to-xml/_json-to-xml-test-set.xml
tests/misc/catalog/schema-for-xslt30.xsd
tests/strm/si-iterate/_si-iterate-test-set.xml
--- a/admin/catalog-schema.xsd	Tue Aug 05 18:11:28 2014 +0100
+++ b/admin/catalog-schema.xsd	Fri Aug 08 12:23:59 2014 +0100
@@ -242,6 +242,7 @@
             <xs:attribute name="select" type="xs:string" use="optional"/>
             <xs:attribute name="as" type="xs:string" use="optional"/>
             <xs:attribute name="source" type="xs:string" use="optional"/>
+            <xs:attribute name="static" type="yesNoType" use="optional"/>
         </xs:complexType>
     </xs:element>
 
@@ -2037,6 +2038,13 @@
             <xs:enumeration value="skip"/>
         </xs:restriction>
     </xs:simpleType>
+    
+    <xs:simpleType name="yesNoType">
+        <xs:restriction base="xs:normalizedString">
+            <xs:enumeration value="yes"/>
+            <xs:enumeration value="no"/>
+        </xs:restriction>
+    </xs:simpleType>
 
 
     <xs:attributeGroup name="valueAttr">
--- a/tests/decl/accumulator/_accumulator-test-set.xml	Tue Aug 05 18:11:28 2014 +0100
+++ b/tests/decl/accumulator/_accumulator-test-set.xml	Fri Aug 08 12:23:59 2014 +0100
@@ -548,8 +548,8 @@
       </dependencies>
       <test>
          <stylesheet file="accumulator-032.xsl"/>
+         <param name="streamable" static="yes" select="'no'"/>
          <initial-template name="main"/>
-         <param name="streamable" static="yes" select="'no'"/>
       </test>
       <result>
          <assert>/o = '21'</assert>
@@ -564,8 +564,8 @@
       </dependencies>
       <test>
          <stylesheet file="accumulator-032.xsl"/>
+         <param name="streamable" static="yes" select="'no'"/>
          <initial-template name="main"/>
-         <param name="streamable" static="yes" select="'no'"/>
       </test>
       <result>
          <assert>/o = '21'</assert>
--- a/tests/fn/json-to-xml/_json-to-xml-test-set.xml	Tue Aug 05 18:11:28 2014 +0100
+++ b/tests/fn/json-to-xml/_json-to-xml-test-set.xml	Fri Aug 08 12:23:59 2014 +0100
@@ -17,7 +17,7 @@
     <!-- It would be helpful to assert schema-awareness on the stylesheet in a shared environment
     Sadly 'dependencies' aren't appropriate and just adding 'schema' doesn't mean the same thing -->
     <environment name="json-to-xml-typed">
-        <namespace prefix="j" uri="http://www.w3.org/2013/XSL/json"/>
+        <!--<namespace prefix="j" uri="http://www.w3.org/2013/XSL/json"/>-->
         <!-- <schema uri="http://www.w3.org/2013/XSL/json" file="schema-for-json.xsd">
             <description>JSON XML representation schema</description>
             <created by="John Lumley" on="2013-10-03"/>
@@ -194,7 +194,6 @@
         </test>
         <result>
             <all-of>
-                <assert-count>1</assert-count>
                 <assert>* instance of element(Q{http://www.w3.org/2013/XSL/json}string)</assert>
                 <assert>. = 'Data with " within it'</assert>
                 <any-of>
@@ -217,7 +216,6 @@
         </test>
         <result>
             <all-of>
-                <assert-count>1</assert-count>
                 <assert>* instance of element(Q{http://www.w3.org/2013/XSL/json}string)</assert>
                 <assert>. = 'Data with " within it'</assert>
                 <assert>*/@key eq 'Key " with quote'</assert>
@@ -241,7 +239,6 @@
         </test>
         <result>
             <all-of>
-                <assert-count>1</assert-count>
                 <assert>* instance of element(Q{http://www.w3.org/2013/XSL/json}string)</assert>
                 <assert>. = 'Data with \" within it'</assert>
                 <assert>*/@escaped eq "true"</assert>
@@ -261,7 +258,6 @@
         </test>
         <result>
             <all-of>
-                <assert-count>1</assert-count>
                 <assert>* instance of element(Q{http://www.w3.org/2013/XSL/json}string)</assert>
                 <assert>. = 'Data with \" within it'</assert>
                 <assert>*/@key eq 'Key \" with quote'</assert>
--- a/tests/misc/catalog/schema-for-xslt30.xsd	Tue Aug 05 18:11:28 2014 +0100
+++ b/tests/misc/catalog/schema-for-xslt30.xsd	Fri Aug 08 12:23:59 2014 +0100
@@ -244,12 +244,14 @@
           </xs:sequence>
           <xs:attribute name="name" type="xsl:EQName" />
           <xs:attribute name="post-descent" type="xsl:EQName" />
+          <xs:attribute name="applies-to" type="xsl:pattern"/>
           <xs:attribute name="initial-value" type="xsl:expression"/>
           <xs:attribute name="as" type="xsl:sequence-type"/>
           <xs:attribute name="visibility" type="xsl:visibility-type"/>
           <xs:attribute name="streamable" type="xsl:yes-or-no"/>
           <xs:attribute name="_name" type="xs:string" />
           <xs:attribute name="_post-descent" type="xs:string" />
+          <xs:attribute name="_applies-to" type="xs:string"/> 
           <xs:attribute name="_initial-value" type="xs:string"/>
           <xs:attribute name="_as" type="xs:string"/>
           <xs:attribute name="_visibility" type="xs:string"/>
@@ -261,8 +263,8 @@
 
   <xs:element name="accumulator-rule">
     <xs:complexType>
-      <xs:complexContent>
-        <xs:extension base="xsl:element-only-versioned-element-type">
+      <xs:complexContent mixed="true">
+        <xs:extension base="xsl:sequence-constructor-or-select">
           <xs:sequence/>
           <xs:attribute name="match" type="xsl:pattern"/>
           <xs:attribute name="phase">
@@ -273,12 +275,9 @@
               </xs:restriction>           
             </xs:simpleType>
           </xs:attribute>
-          <xs:attribute name="select" type="xsl:expression"/>
           <xs:attribute name="_match" type="xs:string"/>
           <xs:attribute name="_phase" type="xs:string"/>
-          <xs:attribute name="_select" type="xs:string"/>
           <xs:assert test="exists(@match | @_match)"/>
-          <xs:assert test="exists(@select | @_select)"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -771,10 +770,19 @@
     <xs:complexType>
       <xs:complexContent mixed="true">
         <xs:extension base="xsl:versioned-element-type">
-          <xs:choice minOccurs="1" maxOccurs="unbounded">
-            <xs:element ref="xsl:sequence"/>
-            <xs:element ref="xsl:fallback"/>
-          </xs:choice>
+          <xs:sequence>
+            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:choice>
+              <xs:sequence minOccurs="0" maxOccurs="unbounded">
+                <xs:element ref="xsl:sequence"/>
+                <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
+              </xs:sequence>
+              <xs:sequence>
+                <xs:element ref="xsl:for-each-group"/>
+                <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
+              </xs:sequence>
+            </xs:choice>
+          </xs:sequence>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -830,6 +838,30 @@
       </xs:complexContent>
     </xs:complexType>
   </xs:element>
+  
+  <xs:element name="global-context-item">
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:extension base="xsl:element-only-versioned-element-type">
+          <xs:attribute name="as" type="xsl:item-type"/>
+          <xs:attribute name="use">
+            <xs:simpleType>
+              <xs:restriction base="xs:token">
+                <xs:enumeration value="required"/>
+                <xs:enumeration value="optional"/>
+                <xs:enumeration value="prohibited"/>
+              </xs:restriction>
+            </xs:simpleType>
+          </xs:attribute>
+          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
+          <xs:attribute name="_as" type="xs:string"/>
+          <xs:attribute name="_use" type="xs:string"/>
+          <xs:attribute name="_streamable" type="xs:string"/>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  
 
   <xs:element name="if" substitutionGroup="xsl:instruction">
     <xs:complexType>
@@ -1095,6 +1127,8 @@
           <xs:attribute name="_result-prefix" type="xs:string"/>
           <xs:assert test="exists(@stylesheet-prefix | @_stylesheet-prefix)"/>
           <xs:assert test="exists(@result-prefix | @_result-prefix)"/>
+          <xs:assert test="every $prefix in (@stylesheet-prefix, @result-prefix)[. ne '#default']
+            satisfies $prefix = in-scope-prefixes(.)"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -1180,6 +1214,7 @@
       <xs:complexContent mixed="true">
         <xs:extension base="xsl:generic-element-type">
           <xs:attribute name="name" type="xsl:EQName"/>
+          <xs:attribute name="recoverable" type="xsl:yes-or-no"/>
           <xs:attribute name="method" type="xsl:method"/>
           <xs:attribute name="byte-order-mark" type="xsl:yes-or-no"/>
           <xs:attribute name="cdata-section-elements" type="xsl:EQNames"/>
@@ -1286,12 +1321,9 @@
             <xs:choice minOccurs="0" maxOccurs="unbounded">
               <xs:element ref="xsl:use-package"/>
               <xs:element ref="xsl:expose"/>
+              <xs:element ref="xsl:transform"/>
+              <xs:element ref="xsl:global-context-item"/>
             </xs:choice>  
-            <xs:element ref="xsl:transform" minOccurs="1" maxOccurs="1"/>
-            <xs:choice minOccurs="0" maxOccurs="unbounded">
-              <xs:element ref="xsl:use-package"/>
-              <xs:element ref="xsl:expose"/>
-            </xs:choice>
           </xs:sequence>
           <xs:attribute name="name" type="xs:anyURI"/>
           <xs:attribute name="package-version" type="xs:string"/>
@@ -1351,7 +1383,7 @@
               </xs:annotation>
             </xs:assert>
           <xs:assert test="if (normalize-space(@static) = 'yes')
-                           then empty((*,text())) and exists(@select)
+                           then empty((*,text()))
                            else true()">
             <xs:annotation>
               <xs:documentation>
@@ -1422,6 +1454,7 @@
           <xs:attribute name="href" type="xsl:avt"/>
           <xs:attribute name="type" type="xsl:EQName"/>
           <xs:attribute name="validation" type="xsl:validation-type"/>
+          <xs:attribute name="recoverable" type="xsl:avt"/>
           <xs:attribute name="method" type="xsl:avt"/>
           <xs:attribute name="byte-order-mark" type="xsl:avt"/>
           <xs:attribute name="cdata-section-elements" type="xsl:avt"/>
@@ -1693,6 +1726,19 @@
               </xs:documentation>
             </xs:annotation>
           </xs:assert>
+          <xs:assert test="every $prefix in (@exclude-result-prefixes[not(. = '#all')], @extension-element-prefixes)
+            satisfies ((if ($prefix = '#default') then '' else $prefix) = in-scope-prefixes(.))">
+            <xs:annotation>
+              <xs:documentation>
+                <p>XTSE0808: It is a static error if a namespace prefix is used within the [xsl:]exclude-result-prefixes 
+                  attribute and there is no namespace binding in scope for that prefix.
+                </p>
+                <p>XTSE0809: It is a static error if the value #default is used within the [xsl:]exclude-result-prefixes 
+                  attribute and the parent element of the [xsl:]exclude-result-prefixes attribute has no default namespace.
+                </p>
+              </xs:documentation>
+            </xs:annotation>
+          </xs:assert>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -2215,6 +2261,10 @@
     <xs:restriction base="xs:token">
       <xs:enumeration value="yes"/>
       <xs:enumeration value="no"/>
+      <xs:enumeration value="true"/>
+      <xs:enumeration value="false"/>
+      <xs:enumeration value="1"/>
+      <xs:enumeration value="0"/>
       <xs:enumeration value="strict"/>
       <xs:enumeration value="lax"/>
       <xs:enumeration value="unspecified"/>
@@ -2278,21 +2328,30 @@
 
   <xs:simpleType name="yes-or-no">
     <xs:annotation>
-      <xs:documentation> One of the values "yes" or "no". </xs:documentation>
+      <xs:documentation> One of the values "yes" or "no": the values "true" or "false", or "1" or "0" are accepted as synonyms. </xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:token">
       <xs:enumeration value="yes"/>
       <xs:enumeration value="no"/>
+      <xs:enumeration value="true"/>
+      <xs:enumeration value="false"/>
+      <xs:enumeration value="1"/>
+      <xs:enumeration value="0"/>
     </xs:restriction>
   </xs:simpleType>
 
   <xs:simpleType name="yes-or-no-or-omit">
     <xs:annotation>
-      <xs:documentation> One of the values "yes" or "no" or "omit". </xs:documentation>
+      <xs:documentation> One of the values "yes" or "no" or "omit". 
+        The values "true" or "false", or "1" or "0" are accepted as synonyms of "yes" and "no" respectively.</xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:token">
       <xs:enumeration value="yes"/>
       <xs:enumeration value="no"/>
+      <xs:enumeration value="true"/>
+      <xs:enumeration value="false"/>
+      <xs:enumeration value="1"/>
+      <xs:enumeration value="0"/>
       <xs:enumeration value="omit"/>
     </xs:restriction>
   </xs:simpleType>
--- a/tests/strm/si-iterate/_si-iterate-test-set.xml	Tue Aug 05 18:11:28 2014 +0100
+++ b/tests/strm/si-iterate/_si-iterate-test-set.xml	Fri Aug 08 12:23:59 2014 +0100
@@ -282,7 +282,13 @@
          <initial-template name="main"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<tba/>]]></assert-xml>
+         <all-of>
+            <assert>/elements/e[@name="gml:pos"]/@count="4070"</assert>
+            <assert>/elements/e[@name="bldg:Building"]/@count="14"</assert>
+            <assert>/elements/e[@name="cityObjectMember"]/@count="15"</assert>
+            <assert>/elements/e[@name="app:TexCoordList"]/@count="295"</assert>
+            <assert>/elements/e[@name="bldg:boundedBy"]/@count="812"</assert>
+         </all-of>
       </result>
    </test-case>
    
@@ -295,7 +301,18 @@
          <initial-template name="main"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<tba/>]]></assert-xml>
+         <all-of>
+            <assert>/elements/e[1][@name="CityModel" and @count="1"]</assert>
+            <assert>/elements/e[2][@name="app:Appearance" and @count="1"]</assert>
+            <assert>/elements/e[3][@name="app:GeoreferencedTexture" and @count="1"]</assert>
+            <assert>/elements/e[4][@name="app:ParameterizedTexture" and @count="295"]</assert>
+            <assert>/elements/e[5][@name="app:TexCoordList" and @count="295"]</assert>
+            <assert>/elements/e[6][@name="app:X3DMaterial" and @count="2"]</assert>
+            <assert>/elements/e[7][@name="app:appearanceMember" and @count="1"]</assert>
+            <assert>/elements/e[8][@name="app:borderColor" and @count="295"]</assert>
+            <assert>/elements/e[9][@name="app:diffuseColor" and @count="2"]</assert>
+            <assert>/elements/e[10][@name="app:imageURI" and @count="296"]</assert>
+         </all-of>
       </result>
    </test-case>