label-elements 003 (AB)

Testing p:label-elements.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:output port="result"/>
   <p:input port="source">
      <doc xml:base="http://example.com/base/">
         <chap xml:base="http://example.com/base/chaps/">
            <para>...</para>
         </chap>
         <chap>
            <para>...</para>
         </chap>
      </doc>
   </p:input>
   <p:label-elements label='concat("http://foo.com/", $p:index)'
                     attribute="xml:base" match="chap"/>
</p:declare-step>

Result

<doc xmlns:t="http://xproc.org/ns/testsuite/3.0"
     xml:base="http://example.com/base/">
   <chap xml:base="http://foo.com/1">
      <para>...</para>
   </chap>
   <chap xml:base="http://foo.com/2">
      <para>...</para>
   </chap>
</doc>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="doc">The document root is not 'doc'</s:assert>
         <s:assert test="base-uri(doc)='http://example.com/base/'">The base-uri of doc is not 'http://example.com/base/'.</s:assert>
         <s:assert test="doc/@xml:base='http://example.com/base/'">doc/@xml:base is not 'http://example.com/base/'.</s:assert>
         <s:assert test="doc/chap[1]">Root element does not have a child 'chap'.</s:assert>
         <s:assert test="base-uri(doc/chap[1])='http://foo.com/1'">The base-uri of chap[1] is not 'http://foo.com/1'.</s:assert>
         <s:assert test="doc/chap[1]/@xml:base='http://foo.com/1'">The @xml:base of chap[1] is not 'http://foo.com/1'.</s:assert>
         <s:assert test="doc/chap[1]/para/text()='...'">Element 'chap[1]' does not have a para child with '...'.</s:assert>
         <s:assert test="doc/chap[2]">Root element does not have two children 'chap'.</s:assert>
         <s:assert test="base-uri(doc/chap[2])='http://foo.com/2'">The base-uri of chap[2] is not 'http://foo.com/2'.</s:assert>
         <s:assert test="doc/chap[2]/@xml:base='http://foo.com/2'">The @xml:base of chap[2] is not 'http://foo.com/2'.</s:assert>
         <s:assert test="doc/chap[2]/para/text()='...'">Element 'chap[2]' does not have a para child with '...'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
04 May 2019, Achim Berndzen
Ported test from 1.0 test suite