-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #686 from ndw/nw-add-xml-base
Tests for p:add-xml-base
- Loading branch information
Showing
5 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:add-xml-base 001 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-04-29</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:add-xml-base.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test p:add-xml-base.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:add-xml-base> | ||
<p:with-input href="../documents/doc-with-entities.xml"/> | ||
</p:add-xml-base> | ||
|
||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="book">Root element is not 'book'.</s:assert> | ||
<s:assert test="ends-with(book/@xml:base, '/documents/doc-with-entities.xml')" | ||
>Document element base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="empty(book/preface/@xml:base)" | ||
>Preface should not have an xml:base attribute</s:assert> | ||
<s:assert test="book/chapter[@label='1']/@xml:base = 'subdir/chap1.xml'" | ||
>First chapter has wrong xml:base</s:assert> | ||
<s:assert test="book/chapter[@label='2']/@xml:base = 'chap2.xml'" | ||
>Second chapter has wrong xml:base</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:add-xml-base 002 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-04-29</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:add-xml-base.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test p:add-xml-base with all=true.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:add-xml-base all="true" relative="false"> | ||
<p:with-input href="../documents/doc-with-entities.xml"/> | ||
</p:add-xml-base> | ||
|
||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="book">Root element is not 'book'.</s:assert> | ||
<s:assert test="ends-with(book/@xml:base, '/documents/doc-with-entities.xml')" | ||
>Document element base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="ends-with(book/preface/@xml:base, '/documents/doc-with-entities.xml')" | ||
>Preface element base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="ends-with(book/chapter[@label='1']/@xml:base, | ||
'/documents/subdir/chap1.xml')" | ||
>First chapter base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="ends-with(book/chapter[@label='2']/@xml:base, | ||
'/documents/chap2.xml')" | ||
>Second chapter base URI doesn’t have the correct suffix</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:add-xml-base 003 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-04-29</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:add-xml-base.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test p:add-xml-base with relative=false.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:add-xml-base relative="false"> | ||
<p:with-input href="../documents/doc-with-entities.xml"/> | ||
</p:add-xml-base> | ||
|
||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="book">Root element is not 'book'.</s:assert> | ||
<s:assert test="ends-with(book/@xml:base, '/documents/doc-with-entities.xml')" | ||
>Document element base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="empty(book/preface/@xml:base)" | ||
>Preface should not have an xml:base attribute</s:assert> | ||
<s:assert test="ends-with(book/chapter[@label='1']/@xml:base, | ||
'/documents/subdir/chap1.xml')" | ||
>First chapter base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="ends-with(book/chapter[@label='2']/@xml:base, | ||
'/documents/chap2.xml')" | ||
>Second chapter base URI doesn’t have the correct suffix</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="fail" code="err:XC0058"> | ||
<t:info> | ||
<t:title>p:add-xml-base 004 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-04-29</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:add-xml-base.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test p:add-xml-base with all=true and relative=true.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:add-xml-base relative="true" all="true"> | ||
<p:with-input href="../documents/doc-with-entities.xml"/> | ||
</p:add-xml-base> | ||
|
||
</p:declare-step> | ||
</t:pipeline> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:add-xml-base 005 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-04-29</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:add-xml-base.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test p:add-xml-base where the scheme changes.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
version="3.0"> | ||
<p:output port="result"/> | ||
|
||
<p:identity> | ||
<p:with-input href="../documents/doc-with-entities.xml"/> | ||
</p:identity> | ||
|
||
<p:set-attributes | ||
attributes="map {'xml:base': 'https://tests.xproc.org/documents/book.xml'}"/> | ||
|
||
<p:add-xml-base/> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="book">Root element is not 'book'.</s:assert> | ||
<s:assert test="book/@xml:base = 'https://tests.xproc.org/documents/book.xml'"> | ||
>Document element base URI is incorrect</s:assert> | ||
<s:assert test="empty(book/preface/@xml:base)" | ||
>Preface should not have an xml:base attribute</s:assert> | ||
<s:assert test="ends-with(book/chapter[@label='1']/@xml:base, | ||
'/documents/subdir/chap1.xml')" | ||
>First chapter base URI doesn’t have the correct suffix</s:assert> | ||
<s:assert test="ends-with(book/chapter[@label='2']/@xml:base, | ||
'/documents/chap2.xml')" | ||
>Second chapter base URI doesn’t have the correct suffix</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |