AB-xslt-121

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

Test ab-xslt-121.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="map(xs:string, document-node())">
                     <xsl:variable name="document">
                        <doc xmlns=""/>
                     </xsl:variable>
                     <xsl:sequence select="map{'one' : $document, 'two' : $document }"/>
                  </xsl:template>
               </xsl:stylesheet>
            </p:with-input>
         </p:xslt>
         <p:identity>
            <p:with-input>
               <result xmlns="">
                  <map-check>{. instance of map(*)}</map-check>
                  <map-size-check>{map:size(.)}</map-size-check>
                  <map-of-nodes-check>{. instance of map(xs:string, node())}</map-of-nodes-check>
                  <map-of-document-check>{. instance of map(xs:string, document-node())}</map-of-document-check>
                  <map-item-is-document-check>{every $item in .?* satisfies $item instance of document-node()}</map-item-is-document-check> 
               </result>
            </p:with-input>
         </p:identity>
      </p:declare-step>
   
MorganaXProc passing XML Calabash failing

Schematron validation


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

Revision history

05 Dec 2020, Achim Berndzen

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