-
Notifications
You must be signed in to change notification settings - Fork 4
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 #781 from ndw/test-644
Test the updates to p:filter
- Loading branch information
Showing
1 changed file
with
56 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,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>p:filter 012 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-24</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Proposed test.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:filter that returns a constant.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<p:output port="result"/> | ||
<p:option name="select" as="xs:string?" select="'chapter'"/> | ||
<p:variable name="eq" select="'='"/> | ||
|
||
<p:identity> | ||
<p:with-input> | ||
<book> | ||
<chapter>Hello, world.</chapter> | ||
<appendix>Goodbye, world.</appendix> | ||
</book> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:filter select="count(/book/*[local-name(.) {$eq} '{$select}'])"/> | ||
|
||
<p:cast-content-type content-type="application/xml"/> | ||
</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:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="fn:number">The result root is not a number.</s:assert> | ||
<s:assert test="string(.) = '1'">The result is not 1.</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |