ab-doc-props-012

Tests context item for document-properties on p:document, dynamic href

Test is expected to pass.

The pipeline

<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" name="main" version="3.0">
   <p:output port="result"/>
   <p:identity name="producer">
      <p:with-input>
         <doc a="1" path="../documents/ab-doc.xml"/>
      </p:with-input>
   </p:identity>
   <p:identity name="id">
      <p:with-input port="source">
         <p:document document-properties="map { 'a': xs:integer(/doc/@a) }"
                     href="{/doc/@path}"/>
      </p:with-input>
   </p:identity>
   <p:cast-content-type content-type="application/xml">
      <p:with-input port="source"
                    select="p:document-properties(.)"/>
   </p:cast-content-type>
</p:declare-step>

Result

<map xmlns="http://www.w3.org/2005/xpath-functions"
     xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <string key="content-type">application/xml</string>
   <number key="a">1</number>
   <string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/ab-doc.xml</string>
</map>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:ns prefix="j"
         uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="j:map">The pipeline root is not “map”.</s:assert>
         <s:assert test="j:map/j:number[@key='a']">Element does not has an attribute 'key' with value 'a'.</s:assert>
         <s:assert test="j:map/j:number/text() = '1'">The property value is not 1</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

14 Dec 2019, Achim Berndzen
Fixed test by declaring prefix "xs".
20 Nov 2019, Achim Berndzen
Changed test from p:document-properties-document() to p:document-properties()
30 Dec 2018, Achim Berndzen
Test added