AB-xslt-110

Tests nodes are correctly returned in arrays/maps. (Thanks to Martin for the test's blueprint).

Test ab-xslt-110.xml is expected to pass.

It requires the following features: xslt-3.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:xslt version="3.0" template-name="start" name="xslt">
      <p:with-input port="source">
         <p:empty/>
      </p:with-input>
      <p:with-input port="stylesheet" expand-text="false">
         <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
            <xsl:output build-tree="no"/>
            <xsl:template name="start" as="array(processing-instruction())">
               <xsl:variable name="document">
                  <doc>
                     <one>
                        <xsl:processing-instruction name="pi" select="'target'"/>
                     </one>
                     <two>
                        <xsl:processing-instruction name="pi" select="'target'"/>
                     </two>
                  </doc>
               </xsl:variable>
               <xsl:sequence select="array{ $document/doc/*/processing-instruction() }"/>
            </xsl:template>
         </xsl:stylesheet>
      </p:with-input>
   </p:xslt>
   <p:identity xmlns:array="http://www.w3.org/2005/xpath-functions/array">
      <p:with-input>
         <result>
            <array-check>{. instance of array(*)}</array-check>
            <array-size-check>{array:size(.)}</array-size-check>
            <array-of-nodes-check>{. instance of array(node())}</array-of-nodes-check>
            <array-of-pi-check>{. instance of array(processing-instruction())}</array-of-pi-check>
            <array-item-is-pi-check>{every $item in .?* satisfies $item instance of processing-instruction()}</array-item-is-pi-check>
         </result>
      </p:with-input>
   </p:identity>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="result">The document root is not 'result'.</s:assert>
         <s:assert test="result/array-check/text()='true'">The value of array-check is not "true".</s:assert>
         <s:assert test="result/array-size-check/text()='2'">The value of array-size-check is not '2'.</s:assert>
         <s:assert test="result/array-of-nodes-check/text()='true'">The value of array-of-nodes-check is not "true".</s:assert>
         <s:assert test="result/array-of-pi-check/text()='true'">The value of array-of-pi-check is not "true".</s:assert>
         <s:assert test="result/array-item-is-pi-check/text()='true'">The value of array-item-is-pi-check is not "true".</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

05 Dec 2020, Achim Berndzen

Added tests to check nodes are correctly returned in arrays/maps.