Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
language: generic
env:
global:
# XSpec version
- XSPEC_VERSION=1.0.0
#- XSPEC_HOME=/tmp/schematron/xspec/
# full path to Saxon jar
- SAXON_CP=/tmp/schematron/saxon/saxon9he.jar
# Ant version used in oXygen
- ANT_VERSION=1.9.8
# full path to XML Resolver jar
- XML_RESOLVER_CP=/tmp/schematron/xml-resolver/resolver.jar
matrix:
# latest Saxon 9.8 version and full path to Jing jar
- SAXON_VERSION=9.8.0-7
JING_CP=/tmp/schematron/jing/jing.jar

before_install:
- unset _JAVA_OPTIONS

before_script:
# install XSpec
- curl -fsSL --create-dirs -o /tmp/schematron/xspec/xspec.zip https://github.com/xspec/xspec/archive/v${XSPEC_VERSION}.zip;
- unzip /tmp/schematron/xspec/xspec.zip -d /tmp/schematron/xspec;
- export XSPEC_HOME=/tmp/schematron/xspec/xspec-${XSPEC_VERSION};
# install Saxon
- curl -fsSL --create-dirs -o ${SAXON_CP} http://central.maven.org/maven2/net/sf/saxon/Saxon-HE/${SAXON_VERSION}/Saxon-HE-${SAXON_VERSION}.jar
# install Ant
- curl -fsSL --create-dirs -o /tmp/schematron/ant/ant.tar.gz http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz
- tar xf /tmp/schematron/ant/ant.tar.gz -C /tmp/schematron/ant;
- export PATH=/tmp/schematron/ant/apache-ant-${ANT_VERSION}/bin:{$PATH}
# install XML Resolver
- curl -fsSL --create-dirs -o ${XML_RESOLVER_CP} http://central.maven.org/maven2/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar

script:
- ant -version
#- cd trunk/schematron/test
#- ant -Dsaxon.jar=${SAXON_CP} -Dxspec.project.dir=${XSPEC_HOME}
#- ${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests.xspec
#- ${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests-xslt2.xspec
#- echo "Run XSpec from shell script"
#- ./run-xspec.sh
- echo "execute bats unit tests"
- bats --tap schematron.bats
22 changes: 22 additions & 0 deletions let/let-scope-01.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" defaultPhase="phase">
<let name="level0" value="'0'"/>
<phase id="phase">
<let name="level1" value="'1'"/>
<active pattern="pattern"/>
</phase>
<pattern id="pattern">
<let name="level2" value="'2'"/>
<rule context="/*">
<let name="level3" value="'3'"/>
<assert test="$level0 eq '0'" id="level0"/>
<assert test="$level1 eq '1'" id="level1"/>
<assert test="$level2 eq '2'" id="level2"/>
<assert test="$level3 eq '3'" id="level3"/>
</rule>
<rule context="element">
<assert test="$level0 eq '0'" id="level0a"/>
<assert test="$level1 eq '1'" id="level1a"/>
<assert test="$level2 eq '2'" id="level2a"/>
</rule>
</pattern>
</schema>
16 changes: 16 additions & 0 deletions let/let-scope-01.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="let-scope-01.sch">
<scenario label="Scope of let bindings">
<context>
<document xmlns="">
<element/>
</document>
</context>
<expect-not-assert id="level0"/>
<expect-not-assert id="level1"/>
<expect-not-assert id="level2"/>
<expect-not-assert id="level3"/>
<expect-not-assert id="level0a"/>
<expect-not-assert id="level1a"/>
<expect-not-assert id="level2a"/>
</scenario>
</description>
17 changes: 17 additions & 0 deletions name/svrl-name-01.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<pattern>
<rule context="/*">
<assert test="false()" id="A01">
<name/>
</assert>
</rule>
</pattern>
<pattern>
<rule context="/*">
<assert test="false()" id="A02">
<name path="@attr"/>
</assert>
</rule>
</pattern>
<properties/>
</schema>
14 changes: 14 additions & 0 deletions name/svrl-name-01.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="svrl-name-01.sch"
xmlns:svrl="http://purl.oclc.org/dsdl/svrl">
<scenario label="The name element">
<context>
<document xmlns="" attr="value"/>
</context>
<expect-assert id="A01"/>
<expect-assert id="A02"/>
<expect label="expands into the name of the context node if no @path is present"
test="/svrl:schematron-output/svrl:failed-assert[@id = 'A01']/svrl:text = 'document'"/>
<expect label="expands into the name value of evaluating the expression in @path"
test="/svrl:schematron-output/svrl:failed-assert[@id = 'A02']/svrl:text = 'value'"/>
</scenario>
</description>
13 changes: 13 additions & 0 deletions phase/phase-01.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<pattern>
<rule context="/">
<assert test="false()" id="A01"/>
</rule>
</pattern>
<pattern>
<rule context="/">
<assert test="false()" id="A02"/>
</rule>
</pattern>
<properties/>
</schema>
10 changes: 10 additions & 0 deletions phase/phase-01.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="phase-01.sch">
<param name="phase" select="'#ALL'"/>
<scenario label="Phase '#ALL' fires all patterns">
<context>
<document/>
</context>
<expect-assert id="A01"/>
<expect-assert id="A02"/>
</scenario>
</description>
16 changes: 16 additions & 0 deletions phase/phase-02.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" defaultPhase="default">
<phase id="default">
<active pattern="P01"/>
</phase>
<pattern id="P01">
<rule context="/">
<assert test="false()" id="A01"/>
</rule>
</pattern>
<pattern>
<rule context="/">
<assert test="false()" id="A02"/>
</rule>
</pattern>
<properties/>
</schema>
10 changes: 10 additions & 0 deletions phase/phase-02.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="phase-02.sch">
<param name="phase" select="'#DEFAULT'"/>
<scenario label="Phase '#DEFAULT' executes the default phase">
<context>
<document/>
</context>
<expect-assert id="A01"/>
<expect-not-assert id="A02"/>
</scenario>
</description>
16 changes: 16 additions & 0 deletions phase/phase-03.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" defaultPhase="default">
<phase id="default">
<active pattern="P02"/>
</phase>
<pattern id="P01">
<rule context="/">
<assert test="false()" id="A01"/>
</rule>
</pattern>
<pattern id="P02">
<rule context="/">
<assert test="false()" id="A02"/>
</rule>
</pattern>
<properties/>
</schema>
9 changes: 9 additions & 0 deletions phase/phase-03.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="phase-03.sch">
<scenario label="No phase uses @defaultPhase">
<context>
<document/>
</context>
<expect-not-assert id="A01"/>
<expect-assert id="A02"/>
</scenario>
</description>
16 changes: 16 additions & 0 deletions phase/phase-04.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<phase id="default">
<active pattern="P02"/>
</phase>
<pattern id="P01">
<rule context="/">
<assert test="false()" id="A01"/>
</rule>
</pattern>
<pattern id="P02">
<rule context="/">
<assert test="false()" id="A02"/>
</rule>
</pattern>
<properties/>
</schema>
9 changes: 9 additions & 0 deletions phase/phase-04.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="phase-04.sch">
<scenario label="No phase and no @defaultPhase fires all patterns">
<context>
<document/>
</context>
<expect-assert id="A01"/>
<expect-assert id="A02"/>
</scenario>
</description>
22 changes: 22 additions & 0 deletions rule/rule-context-01.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<pattern>
<rule context="processing-instruction('foobar')">
<assert test="false()" id="assert-processing-instruction"/>
</rule>
</pattern>
<pattern>
<rule context="comment()">
<assert test="false()" id="assert-comment"/>
</rule>
</pattern>
<pattern>
<rule context="@foobar">
<assert test="false()" id="assert-attribute"/>
</rule>
</pattern>
<pattern>
<rule context="text()">
<assert test="false()" id="assert-text"/>
</rule>
</pattern>
</schema>
31 changes: 31 additions & 0 deletions rule/rule-context-01.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="rule-context-01.sch">
<scenario label="Rule context processing-instruction()">
<context>
<foobar xmlns="">
<?foobar ?>
</foobar>
</context>
<expect-assert id="assert-processing-instruction"/>
</scenario>
<scenario label="Rule context comment()">
<context>
<foobar xmlns="">
<!-- Foobar -->
</foobar>
</context>
<expect-assert id="assert-comment"/>
</scenario>
<scenario label="Rule context attribute">
<context>
<foobar xmlns="" foobar="foobar">
</foobar>
</context>
<expect-assert id="assert-attribute"/>
</scenario>
<scenario label="Rule context text()">
<context>
<foobar xmlns="" foobar="foobar">text</foobar>
</context>
<expect-assert id="assert-text"/>
</scenario>
</description>
16 changes: 16 additions & 0 deletions rule/rule-order-01.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<pattern>
<rule context="/">
<assert test="true()" id="A01"/>
</rule>
<rule context="/*">
<assert test="true()" id="A02"/>
</rule>
<rule context="/*">
<assert test="false()" id="A03"/>
</rule>
<rule context="/*">
<assert test="true()" id="A04"/>
</rule>
</pattern>
</schema>
11 changes: 11 additions & 0 deletions rule/rule-order-01.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<description xmlns="http://www.jenitennison.com/xslt/xspec" schematron="rule-order-01.sch">
<scenario label="Order of rules">
<context>
<document xmlns=""/>
</context>
<expect-not-assert id="A01"/>
<expect-not-assert id="A02"/>
<expect-not-assert id="A03"/>
<expect-not-assert id="A04"/>
</scenario>
</description>
4 changes: 4 additions & 0 deletions run-xspec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests.xspec
${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests-xslt2.xspec
Loading