AB-xslt-052

Tests that stylesheet's uri is used as output base-uri if no other is found. (3.0)

Test ab-xslt-052.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">
      <p:with-input port="source">
         <p:empty/>
      </p:with-input>
      <p:with-input port="stylesheet" xml:base="http://xproc-test/doc.xml">
         <p:inline>
            <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
               <xsl:output method="xml" indent="true" encoding="UTF-8"/>
               <xsl:template name="start">
                  <doc/>
                  <xsl:result-document href="doc1.xml">
                     <doc1/>
                  </xsl:result-document>
               </xsl:template>
            </xsl:stylesheet>
         </p:inline>
      </p:with-input>
   </p:xslt>
   <p:variable name="uri1" select="base-uri(.)"/>
   <p:variable name="uri2" select="base-uri(.)" pipe="secondary"/>
   <p:variable name="prop-uri1" select="p:document-property(.,'base-uri')"/>
   <p:variable name="prop-uri2" select="p:document-property(.,'base-uri')" pipe="secondary"/>
   <p:identity>
      <p:with-input>
         <result>
            <primary-uri>{$uri1}</primary-uri>
            <secondary-uri>{$uri2}</secondary-uri>
            <primary-docprop>{$prop-uri1}</primary-docprop>
            <secondary-docprop>{$prop-uri2}</secondary-docprop>
         </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/primary-uri/text()='http://xproc-test/doc.xml'">URI is not 'http://xproc-test/doc.xml'.</s:assert>
         <s:assert test="result/secondary-uri/text()='http://xproc-test/doc1.xml'">URI is not 'http://xproc-test/doc1.xml'.</s:assert>
         <s:assert test="result/primary-docprop/text()='http://xproc-test/doc.xml'">URI is not 'http://xproc-test/doc.xml'.</s:assert>
         <s:assert test="result/secondary-docprop/text()='http://xproc-test/doc1.xml'">URI is not 'http://xproc-test/doc1.xml'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

20 Oct 2019, Achim Berndzen

Fixed test by setting document's base uri instead of root element's base uri.

20 Oct 2019, Achim Berndzen

Fixed test by setting document's base uri instead of root element's base uri.

06 Aug 2019, Achim Berndzen

Added feature xslt-serialization to test.

04 Aug 2019, Achim Berndzen

Initial commit