Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow context in named templates #76

Open
wants to merge 107 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
07c0c60
PR-76 issue #66 allow context in named templates
cirulls Feb 21, 2016
26a4292
Merge pull request #1 from cirulls/develop
Feb 21, 2016
b0b3001
expath#40 fix code coverage
Aug 10, 2016
91be55e
Merge branch 'develop'
Aug 10, 2016
4a26210
add Travis CI configuration
Aug 11, 2016
c2fdcad
add sudo required
Aug 11, 2016
daee7d5
install bats from GitHub
Aug 11, 2016
070cde7
# This is a combination of 4 commits.
Aug 14, 2016
3c40268
implement JUnit report (#2)
Aug 14, 2016
feb001c
replace saxon:serialize() with fn:serialize #81
Aug 17, 2016
07fdde6
add support for Saxon-9-1-0-8 (Saxon-B) #79
Aug 17, 2016
bc936b7
rename Saxon B jar file as per standard convention (#79)
Aug 17, 2016
df4959b
run tests with Travis CI (#5)
Aug 11, 2016
7e7199b
update link to Travis status page
Aug 21, 2016
6dc9376
add documentation
Aug 21, 2016
954a5ea
merge feature/junit into develop
Aug 21, 2016
0c7a0a0
Merge branch 'develop'
Aug 21, 2016
08cd006
update Travis config for master
Aug 21, 2016
4d82109
merge branch feature/saxon-b
Aug 21, 2016
1eb4b0c
Merge branch 'develop'
Aug 21, 2016
1a4377e
add XSLT 3.0 support #9 (#10)
Aug 29, 2016
cd47860
Merge branch 'develop'
Aug 29, 2016
116c49c
initial commit for bats test #12
Sep 29, 2016
65d9fc2
update Travis configuration #12
Sep 29, 2016
2b21942
test failing test #12
Sep 29, 2016
be28008
run only bats tests
Sep 29, 2016
7295cba
review bats test suite
Sep 29, 2016
8a41236
set TEST_DIR
Sep 29, 2016
86daf71
modify .travis
Sep 29, 2016
7e821e9
remove export in test without TEST_DIR
Sep 29, 2016
48b3dda
test failing tests
Sep 29, 2016
704b149
run XSpec test suite #12
Sep 29, 2016
46924d1
Fixed TEST_DIR management (#13)
c4s4 Sep 29, 2016
fab22d7
add output when test fails
Sep 29, 2016
7b0af25
update Travis configuration
Sep 29, 2016
f870574
override TEST_DIR when set and add bats test (#12 #13)
Sep 29, 2016
706b4e6
fix typo
Sep 29, 2016
53c2b7a
Merge branch 'develop'
Sep 29, 2016
7f3fef3
Fixed TEST_DIR management for winwdows (#14)
c4s4 Oct 17, 2016
63e1495
print message with location of HTML report (#16)
Oct 17, 2016
fdbcf4c
Bugfix/issue67 (#17)
Oct 30, 2016
7303f0d
Fix travis configuration #19
Dec 3, 2016
86e9bbf
use lazy evaluation to fix data type error (#24)
Dec 10, 2016
dcf41fd
reinstate copyright notes #23
Dec 10, 2016
8931b37
force to return the string value of node to support other data types …
Dec 12, 2016
670fcfe
retrieve saxon from maven repo (#34)
Dec 23, 2016
4449512
runner script for XSpec test suite does not detect compiling issues (…
Dec 27, 2016
5a44674
Fix regression bug introduced in v0.4.0-RC (#38)
Jan 1, 2017
70812b3
Revamp xspec.bat (#28)
AirQuick Jan 3, 2017
fe09541
Run tests on AppVeyor (#41)
AirQuick Jan 4, 2017
67461a0
test/xspec-junit.xspec fails with Saxon 9.6.0.10 (#40)
AirQuick Jan 4, 2017
5d6459b
Test with Saxon n and n-0.1 (#43)
AirQuick Jan 5, 2017
1a92c65
remove -j option in tests #39 (#49)
Jan 8, 2017
2a7057b
Run tests in Travis for both Saxon HE 9.7.0-14 and 9.6.0-7 (#45)
Jan 8, 2017
187f157
Always provide xs:boolean in $impl:successful expression (#48)
AirQuick Jan 8, 2017
ba5f97c
add bats test issue #46 / pr #48 (#51)
Jan 8, 2017
a6bb235
remove old references to xspec.googlecode.com #56
Jan 13, 2017
33684b7
remove old references to google repos #56 (#66)
Jan 14, 2017
82a3d49
Remove output and add directories to .gitignore (#65)
Jan 14, 2017
441eae6
Add tests for issue #46 / pr #48 for Windows (#54)
AirQuick Jan 14, 2017
5aa7644
update README and LICENSE files #52 (#53)
Jan 15, 2017
f2db6e4
Run tests with both Saxon 9.6.0-7 and 9.6.0-10 (#68)
tofi86 Jan 16, 2017
9b94529
Report all the basic types and valid numeric expressions (#58)
AirQuick Jan 19, 2017
01c7e25
Keep type annotations in $impl:test-items (#63)
AirQuick Feb 1, 2017
72a4c71
Run tests with Saxon 9.7.0-15 (#77)
AirQuick Feb 14, 2017
ad6b041
Revert harnesses to v0.3.0 and add UTF-8 encoding #74 #72 (#76)
Feb 16, 2017
bae9ce1
Consolidate cleanup tasks in batch script(#73)
AirQuick Mar 4, 2017
cd1908a
Highlight the link target (#79)
AirQuick Mar 4, 2017
ef2d44c
Run XProc test on AppVeyor (#86)
AirQuick Mar 7, 2017
f4811a5
Align Travis configuration with AppVeyor in #86 (#96)
Mar 7, 2017
a5ceb3a
Get the URLs back, adapted.
fgeorges Mar 7, 2017
a93e273
Fix indent.
fgeorges Mar 7, 2017
388c62e
Revive @assert and @context.
fgeorges Mar 7, 2017
74c9f0c
Merge branch 'master' of github.com:xspec/xspec
fgeorges Mar 7, 2017
8946ab5
revert to commit f4811a5 as tests are failing on master #97 (#101)
Mar 15, 2017
74312e1
add XProc harness for Saxon from v0.4.0 (#108)
Mar 15, 2017
2f71caa
Display result.log on test failure (#110)
AirQuick Mar 29, 2017
359b721
Update Saxon versions (#116)
AirQuick Apr 8, 2017
e99b5a2
Make XProc testing command lines more portable (#98)
AirQuick Apr 8, 2017
120b331
Separate common tests (for XSLT and XQuery) from generate-tests-utils…
AirQuick Apr 9, 2017
0ef7b8c
Added documentation for attributes in RNG schema (#115)
raducoravu Apr 10, 2017
cb4b235
Migrate test:tests to test/*.xspec (#118)
AirQuick Apr 10, 2017
701bd34
Stop using functx namespace (#104)
AirQuick Apr 16, 2017
a2b8e59
Do not copy unused namespaces from format utils to output (#91)
AirQuick Apr 16, 2017
9f28df6
xspec.bat (Windows) fails when path contains parentheses
AirQuick Apr 16, 2017
4e99c1d
Escape apostrophe in URI (#119)
Apr 17, 2017
942e26f
Run tests with XML Calabash 1.1.16-97 (#123)
AirQuick Apr 20, 2017
1101540
add checks for saxon script + test (#124)
Apr 22, 2017
6b6d07b
add Schematron support (#105)
vincentml May 4, 2017
e318391
Add documentation for Schematron support (#129)
May 25, 2017
436ceb0
add XProc harness for BaseX standalone (review #103) (#136)
Jun 10, 2017
c25a849
From pull request #129 discussion: suppress warning message and clean…
vincentml Jun 26, 2017
a602c4b
Allow Schematron XSLTs to be provided externally (#133)
vincentml Jun 26, 2017
a032c19
End-to-end test for XSpec itself (#81)
AirQuick Aug 29, 2017
73aa6f9
Add TODO comments for focus/pending tests in #4 (#61)
AirQuick Aug 30, 2017
cc3a18b
Run tests with latest Saxon HE 9.7 maintenance release (9.7.0.20) (#146)
AirQuick Aug 31, 2017
9608693
Add end-to-end tests for testing failing and pending functionalities
AirQuick Oct 1, 2017
5f2cf8c
Remove JAVA_OPTIONS message from output in Travis (#148)
Oct 1, 2017
4031674
Replace regression tests for #50 and #55 as end-to-end tests (#145)
AirQuick Oct 1, 2017
7205f22
Balisage improvements to Schematron support (#149)
vincentml Nov 6, 2017
78f63a6
Run tests with Saxon 9.8.0.7, 9.7.0.21 and 9.7.0.19 (#157)
AirQuick Dec 28, 2017
c76d4fd
Improvements to HTML report (#135)
vincentml Jan 7, 2018
ffd5eda
Add tests for CSS inline (#159)
Jan 24, 2018
63cf95d
Add Ant build support for Schematron (#160)
Feb 4, 2018
c9fdb91
Add a pom file to publish XSpec as a Maven artifact (#156)
cmarchand Mar 18, 2018
b5707e9
Include path to the test source files in all report formats (#188)
vincentml Apr 2, 2018
0e21fca
Enhance coverage-report.xsl to be able to specify css location (#194)
cmarchand Apr 9, 2018
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
Prev Previous commit
Next Next commit
add Schematron support (#105)
* closes #75
vincentml authored and Sandro Cirulli committed May 4, 2017
commit 6b6d07bdc2ece86b3085b6c921f81e0804d81214
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
target/
.idea/
*.iml
test/xspec/*
tutorial/xspec/*
test/result.log
**/xspec/*
*-result.html
*-report.html
81 changes: 79 additions & 2 deletions bin/xspec.bat
Original file line number Diff line number Diff line change
@@ -47,11 +47,12 @@ rem ##
call :win_echo %1
echo:
)
echo Usage: xspec [-t^|-q^|-c^|-j^|-h] filename [coverage]
echo Usage: xspec [-t^|-q^|-s^|-c^|-j^|-h] filename [coverage]
echo:
echo filename the XSpec document
echo -t test an XSLT stylesheet (the default)
echo -q test an XQuery module (mutually exclusive with -t)
echo -q test an XQuery module (mutually exclusive with -t and -s)
echo -s test a Schematron module (mutually exclusive with -t and -q)
echo -c output test coverage report
echo -j output JUnit report
echo -h display this help message
@@ -102,6 +103,8 @@ rem ##
:win_reset_options
set XSLT=
set XQUERY=
set SCHEMATRON=
set SCH_PARAMS=
set COVERAGE=
set JUNIT=
set WIN_HELP=
@@ -120,6 +123,8 @@ rem ##
set XSLT=1
) else if "%WIN_ARGV%"=="-q" (
set XQUERY=1
) else if "%WIN_ARGV%"=="-s" (
set SCHEMATRON=1
) else if "%WIN_ARGV%"=="-c" (
set COVERAGE=1
) else if "%WIN_ARGV%"=="-j" (
@@ -147,6 +152,56 @@ rem ##
call :win_get_options %1 %2 %3 %4 %5 %6 %7 %8 %9
goto :EOF


:schematron_compile
echo Setting up Schematron...

rem # get URI to Schematron file and phase/parameters from the XSpec file
call :xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; iri-to-uri(concat(replace(document-uri(/), '(.*)/.*$', '$1'), '/', /*[local-name() = 'description']/@schematron))" ^
-s:"%XSPEC%" >"%TEST_DIR%\%TARGET_FILE_NAME%-var.txt" ^
|| ( call :die "Error getting Schematron location" & goto :win_main_error_exit )
set /P SCH=<"%TEST_DIR%\%TARGET_FILE_NAME%-var.txt"

call :xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; declare function local:escape($v) { let $w := if (matches($v,codepoints-to-string((91,92,115,34,93)))) then codepoints-to-string(34) else '' return concat($w, replace($v,codepoints-to-string(34),codepoints-to-string((34,34))), $w)}; string-join(for $p in /*/*[local-name() = 'param'] return if ($p/@select) then concat('?',$p/@name,'=',local:escape($p/@select)) else concat($p/@name,'=',local:escape($p/string())),' ')" ^
-s:"%XSPEC%" >"%TEST_DIR%\%TARGET_FILE_NAME%-var.txt" ^
|| ( call :die "Error getting Schematron phase and parameters" & goto :win_main_error_exit )
set /P SCH_PARAMS=<"%TEST_DIR%\%TARGET_FILE_NAME%-var.txt"
echo Paramaters: %SCH_PARAMS%
set SCHUT=%XSPEC%-compiled.xspec
set SCH_COMPILED=%TEST_DIR%\%TARGET_FILE_NAME%-sch-compiled.xsl
set SCH_COMPILED=%SCH_COMPILED:\=/%

echo:
echo Compiling the Schematron...
call :xslt -o:"%TEST_DIR%\%TARGET_FILE_NAME%-sch-temp1.xml" -s:"%SCH%" ^
-xsl:"%XSPEC_HOME%\src\schematron\iso-schematron\iso_dsdl_include.xsl" ^
|| ( call :die "Error compiling the Schematron on step 1" & goto :win_main_error_exit )
call :xslt -o:"%TEST_DIR%\%TARGET_FILE_NAME%-sch-temp2.xml" -s:"%TEST_DIR%\%TARGET_FILE_NAME%-sch-temp1.xml" ^
-xsl:"%XSPEC_HOME%\src\schematron\iso-schematron\iso_abstract_expand.xsl" ^
|| ( call :die "Error compiling the Schematron on step 2" & goto :win_main_error_exit )
call :xslt -o:"%SCH_COMPILED%" -s:"%TEST_DIR%\%TARGET_FILE_NAME%-sch-temp2.xml" ^
-xsl:"%XSPEC_HOME%\src\schematron\iso-schematron\iso_svrl_for_xslt2.xsl" ^
%SCH_PARAMS% ^
|| ( call :die "Error compiling the Schematron on step 3" & goto :win_main_error_exit )

rem use XQuery to get full URI to compiled Schematron
call :xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; iri-to-uri(document-uri(/))" ^
-s:"%SCH_COMPILED%" >"%TEST_DIR%\%TARGET_FILE_NAME%-var.txt" ^
|| ( call :die "Error getting compiled Schematron location" & goto :win_main_error_exit )
set /P SCH_COMPILED=<"%TEST_DIR%\%TARGET_FILE_NAME%-var.txt"

echo:
echo Compiling the Schematron tests...
set TEST_DIR_URI=file:///%TEST_DIR:\=/%
call :xslt -o:"%SCHUT%" -s:"%XSPEC%" ^
-xsl:"%XSPEC_HOME%\src\schematron\schut-to-xspec.xsl" ^
stylesheet="%SCH_COMPILED%" ^
test_dir="%TEST_DIR_URI%" ^
|| ( call :die "Error compiling the Schematron tests" & goto :win_main_error_exit )
set XSPEC=%SCHUT%
echo:
goto :EOF

:win_echo
rem
rem Prints a message removing its surrounding quotes (")
@@ -266,6 +321,24 @@ rem
call :win_reset_options
call :win_get_options %*

rem
rem # Schematron
rem # XSLT
rem
if defined SCHEMATRON if defined XSLT (
call :usage "-s and -t are mutually exclusive"
exit /b 1
)

rem
rem # Schematron
rem # XQuery
rem
if defined SCHEMATRON if defined XQUERY (
call :usage "-s and -q are mutually exclusive"
exit /b 1
)

rem
rem # XSLT
rem # XQuery
@@ -379,6 +452,8 @@ rem ## compile the suite #######################################################
rem ##
rem

if defined SCHEMATRON call :schematron_compile || goto :win_main_error_exit

if defined XSLT (
set COMPILE_SHEET=generate-xspec-tests.xsl
) else (
@@ -512,6 +587,8 @@ if defined COVERAGE (
rem %OPEN% "%HTML%"
)

if defined SCHEMATRON del "%SCHUT%"

echo Done.
exit /b

62 changes: 59 additions & 3 deletions bin/xspec.sh
Original file line number Diff line number Diff line change
@@ -36,11 +36,12 @@ usage() {
echo "$1"
echo;
fi
echo "Usage: xspec [-t|-q|-c|-j|-h] filename [coverage]"
echo "Usage: xspec [-t|-q|-s|-c|-j|-h] filename [coverage]"
echo
echo " filename the XSpec document"
echo " -t test an XSLT stylesheet (the default)"
echo " -q test an XQuery module (mutually exclusive with -t)"
echo " -q test an XQuery module (mutually exclusive with -t and -s)"
echo " -s test a Schematron module (mutually exclusive with -t and -q)"
echo " -c output test coverage report"
echo " -j output JUnit report"
echo " -h display this help message"
@@ -158,14 +159,33 @@ while echo "$1" | grep -- ^- >/dev/null 2>&1; do
usage "-t and -q are mutually exclusive"
exit 1
fi
if test -n "$SCHEMATRON"; then
usage "-s and -t are mutually exclusive"
exit 1
fi
XSLT=1;;
# XQuery
-q)
if test -n "$XSLT"; then
usage "-t and -q are mutually exclusive"
exit 1
fi
if test -n "$SCHEMATRON"; then
usage "-s and -q are mutually exclusive"
exit 1
fi
XQUERY=1;;
# Schematron
-s)
if test -n "$XQUERY"; then
usage "-s and -q are mutually exclusive"
exit 1
fi
if test -n "$XSLT"; then
usage "-s and -t are mutually exclusive"
exit 1
fi
SCHEMATRON=1;;
# Coverage
-c)
if [[ ${SAXON_CP} != *"saxon9pe"* && ${SAXON_CP} != *"saxon9ee"* ]]; then
@@ -228,7 +248,7 @@ if [ -z "$TEST_DIR" ]
then
TEST_DIR=$(dirname "$XSPEC")/xspec
fi
TARGET_FILE_NAME=$(basename "$XSPEC" | sed 's:\...*$::')
TARGET_FILE_NAME=$(basename "$XSPEC" | sed 's:\.[^.]*$::')

if test -n "$XSLT"; then
COMPILED=$TEST_DIR/$TARGET_FILE_NAME.xsl
@@ -252,6 +272,38 @@ fi
## compile the suite #########################################################
##

if test -n "$SCHEMATRON"; then
echo "Setting up Schematron..."

# get URI to Schematron file and phase/parameters from the XSpec file
# Need to escape for sh in XQuery: dollar sign as \$
xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; iri-to-uri(concat(replace(document-uri(/), '(.*)/.*\$', '\$1'), '/', /*[local-name() = 'description']/@schematron))" -s:"$XSPEC" >"$TEST_DIR/$TARGET_FILE_NAME-var.txt" || die "Error getting Schematron location"
SCH=`cat "$TEST_DIR/$TARGET_FILE_NAME-var.txt"`

xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; declare function local:escape(\$v) { let \$w := if (matches(\$v,codepoints-to-string((91,92,115,93)))) then codepoints-to-string(34) else '' return concat(\$w, replace(\$v,codepoints-to-string((40,91,36,92,92,96,93,41)),codepoints-to-string((92,92,36,49))), \$w)}; string-join(for \$p in /*/*[local-name() = 'param'] return if (\$p/@select) then concat('?',\$p/@name,'=',local:escape(\$p/@select)) else concat(\$p/@name,'=',local:escape(\$p/string())),' ')" -s:"$XSPEC" >"$TEST_DIR/$TARGET_FILE_NAME-var.txt" || die "Error getting Schematron phase and parameters"
SCH_PARAMS=`cat "$TEST_DIR/$TARGET_FILE_NAME-var.txt"`
echo Parameters: $SCH_PARAMS
SCHUT=$XSPEC-compiled.xspec
SCH_COMPILED=$TEST_DIR/$TARGET_FILE_NAME-sch-compiled.xsl

echo
echo "Compiling the Schematron..."
xslt -o:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp1.xml" -s:"$SCH" -xsl:"$XSPEC_HOME/src/schematron/iso-schematron/iso_dsdl_include.xsl" || die "Error compiling the Schematron on step 1"
xslt -o:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp2.xml" -s:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp1.xml" -xsl:"$XSPEC_HOME/src/schematron/iso-schematron/iso_abstract_expand.xsl" || die "Error compiling the Schematron on step 2"
xslt -o:"$SCH_COMPILED" -s:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp2.xml" -xsl:"$XSPEC_HOME/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl" $SCH_PARAMS || die "Error compiling the Schematron on step 3"

# use XQuery to get full URI to compiled Schematron
xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; iri-to-uri(document-uri(/))" -s:"$SCH_COMPILED" >"$TEST_DIR/$TARGET_FILE_NAME-var.txt" || die "Error getting compiled Schematron location"
SCH_COMPILED=`cat "$TEST_DIR/$TARGET_FILE_NAME-var.txt"`

echo
echo "Compiling the Schematron tests..."
xslt -o:"$SCHUT" -s:"$XSPEC" -xsl:"$XSPEC_HOME/src/schematron/schut-to-xspec.xsl" stylesheet="$SCH_COMPILED" || die "Error compiling the Schematron tests"
XSPEC=$SCHUT

echo
fi

if test -n "$XSLT"; then
COMPILE_SHEET=generate-xspec-tests.xsl
else
@@ -325,4 +377,8 @@ else
#$OPEN "$HTML"
fi

if test -n "$SCHEMATRON"; then
rm "$SCHUT"
fi

echo "Done."
1 change: 1 addition & 0 deletions src/compiler/generate-xspec-tests.xsl
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@
<xsl:apply-templates select="." mode="x:copy-namespaces" />
<import href="{$stylesheet-uri}" />
<import href="{resolve-uri('generate-tests-utils.xsl', static-base-uri())}"/>
<import href="{resolve-uri('../schematron/sch-location-compare.xsl', static-base-uri())}"/>
<!-- This namespace alias is used for when the testing process needs to test
the generation of XSLT! -->
<namespace-alias stylesheet-prefix="__x" result-prefix="xsl" />
74 changes: 72 additions & 2 deletions src/schemas/xspec.rnc
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ description =
attribute query-at { xs:anyURI }?,
attribute version { xs:NMTOKEN }?,
attribute preserve-space { xs:NMTOKENS }?,
attribute schematron { xs:anyURI }?,
(global-param | import | scenario | pending)+ }

import =
@@ -40,7 +41,7 @@ pending =
##
## An optional label attribute can be used to describe why the scenario or
## assertion should not be tested.
element pending { common-attributes, label?, (scenario | assertion)* }
element pending { common-attributes, label?, (scenario | assertion | schematron-assertion)* }

scenario =
## A scenario defines the environment in which a piece of processing takes place.
@@ -58,7 +59,8 @@ scenario =
label,
( matching-scenario |
function-scenario |
named-scenario ) }
named-scenario |
schematron-scenario ) }

common-scenario-attributes = common-attributes,
## Anything which has the @pending attribute will remain untested, but will be
@@ -212,3 +214,71 @@ common-attributes = attribute xml:* { text }*

any-content = mixed { any-element* }
any-element = element * { attribute * { text }*, any-content }

schematron-scenario = context?,
like*,
(pending | schematron-assertion)*,
(pending |
element scenario { common-scenario-attributes,
label, schematron-scenario })*

schematron-assertion =
expect-assert | expect-not-assert |
expect-report | expect-not-report |
expect-valid

expect-valid =
## In a Schematron test, verify that the Schematron is executed and the XML
## that is provided as context passes validation.
##
## In the Schematron an <assert> or <report> can have a <role> attribute
## specifying that it is a warning or informational message and these are
## considered to be allowed for a passing validation.
element expect-valid { empty }

expect-assert =
## In a Schematron test, verify that an <assert> is thrown.
##
## The attributes id, role, and location can be used in combination to
## identify a specific <assert>.
element expect-assert {
schematron-common-expect
}
expect-report =
## In a Schematron test, verify that a <report> is thrown.
##
## The attributes id, role, and location can be used in combination to
## identify a specific <report>.
element expect-report {
schematron-common-expect
}

expect-not-assert =
## In a Schematron test, verify that an <assert> is not thrown.
##
## The attributes id, role, and location can be used in combination to
## identify a specific <assert>.
element expect-not-assert {
schematron-common-expect
}
expect-not-report =
## In a Schematron test, verify that a <report> is not thrown.
##
## The attributes id, role, and location can be used in combination to
## identify a specific <report>.
element expect-not-report {
schematron-common-expect
}

schematron-common-expect =
## Identify a specific <assert> or <report> using its id attribute or
## the id attribute of the parent <rule>.
attribute id { xs:NCName }?,
## Match a specific role attribute value of an <assert> or <report> or
## the parent <rule>. Role attribute values are often used to specify
## 'error', 'fatal', 'warn', 'warning', 'info', 'information'.
attribute role { text }?,
## XPath of a location in the context XML that the <assert> or <report>
## is expected to find. Namespace prefixes that are defined in Schematron
## using ns elements can be used.
attribute location { xpath }?
313 changes: 313 additions & 0 deletions src/schematron/iso-schematron/iso_abstract_expand.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,313 @@
<?xml version="1.0" encoding="UTF-8"?><?xar XSLT?>

<!--
OVERVIEW - iso_abstract_expand.xsl
This is a preprocessor for ISO Schematron, which implements abstract patterns.
It also
* extracts a particular schema using an ID, where there are multiple
schemas, such as when they are embedded in the same NVDL script
* allows parameter substitution inside @context, @test, @select, @path
* experimentally, allows parameter recognition and substitution inside
text (NOTE: to be removed, for compataibility with other implementations,
please do not use this)
This should be used after iso-dsdl-include.xsl and before the skeleton or
meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1.
Each kind of inclusion can be turned off (or on) on the command line.
-->

<!--
Open Source Initiative OSI - The MIT License:Licensing
[OSI Approved License]
This source code was previously available under the zlib/libpng license.
Attribution is polite.
The MIT License
Copyright (c) 2004-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<!--
VERSION INFORMATION
2013-09-19 RJ
* Allow macro expansion in @path attributes, eg. for sch:name/@path
2010-07-10 RJ
* Move to MIT license
2008-09-18 RJ
* move out param test from iso:schema template to work with XSLT 1. (Noah Fontes)
2008-07-29 RJ
* Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl
* Put everything in private namespace
* Rewrite replace_substring named template so that copyright is clear
2008-07-24 RJ
* correct abstract patterns so for correct names: param/@name and
param/@value
2007-01-12 RJ
* Use ISO namespace
* Use pattern/@id not pattern/@name
* Add Oliver Becker's suggests from old Schematron-love-in list for <copy>
* Add XT -ism?
2003 RJ
* Original written for old namespace
* http://www.topologi.com/resources/iso-pre-pro.xsl
-->
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:nvdl="http://purl.oclc.org/dsdl/nvdl"

xmlns:iae="http://www.schematron.com/namespace/iae"

>

<xslt:param name="schema-id"></xslt:param>


<!-- Driver for the mode -->
<xsl:template match="/">
<xsl:apply-templates select="." mode="iae:go" />
</xsl:template>


<!-- ================================================================================== -->
<!-- Normal processing rules -->
<!-- ================================================================================== -->
<!-- Output only the selected schema -->
<xslt:template match="iso:schema" >
<xsl:if test="string-length($schema-id) =0 or @id= $schema-id ">
<xslt:copy>
<xslt:copy-of select="@*" />
<xslt:apply-templates mode="iae:go" />
</xslt:copy>
</xsl:if>
</xslt:template>


<!-- Strip out any foreign elements above the Schematron schema .
-->
<xslt:template match="*[not(ancestor-or-self::iso:*)]" mode="iae:go" >
<xslt:apply-templates mode="iae:go" />
</xslt:template>


<!-- ================================================================================== -->
<!-- Handle Schematron abstract pattern preprocessing -->
<!-- abstract-to-real calls
do-pattern calls
macro-expand calls
multi-macro-expand
replace-substring -->
<!-- ================================================================================== -->

<!--
Abstract patterns allow you to say, for example
<pattern name="htmlTable" is-a="table">
<param name="row" value="html:tr"/>
<param name="cell" value="html:td" />
<param name="table" value="html:table" />
</pattern>
For a good introduction, see Uche Ogbujii's article for IBM DeveloperWorks
"Discover the flexibility of Schematron abstract patterns"
http://www-128.ibm.com/developerworks/xml/library/x-stron.html
However, note that ISO Schematron uses @name and @value attributes on
the iso:param element, and @id not @name on the pattern element.
-->

<!-- Suppress declarations of abstract patterns -->
<xslt:template match="iso:pattern[@abstract='true']" mode="iae:go" >
<xslt:comment>Suppressed abstract pattern <xslt:value-of select="@id"/> was here</xslt:comment>
</xslt:template>


<!-- Suppress uses of abstract patterns -->
<xslt:template match="iso:pattern[@is-a]" mode="iae:go" >

<xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>

<xslt:call-template name="iae:abstract-to-real" >
<xslt:with-param name="caller" select="@id" />
<xslt:with-param name="is-a" select="@is-a" />
</xslt:call-template>

</xslt:template>



<!-- output everything else unchanged -->
<xslt:template match="*" priority="-1" mode="iae:go" >
<xslt:copy>
<xslt:copy-of select="@*" />
<xslt:apply-templates mode="iae:go"/>
</xslt:copy>
</xslt:template>

<!-- Templates for macro expansion of abstract patterns -->
<!-- Sets up the initial conditions for the recursive call -->
<xslt:template name="iae:macro-expand">
<xslt:param name="caller"/>
<xslt:param name="text" />
<xslt:call-template name="iae:multi-macro-expand">
<xslt:with-param name="caller" select="$caller"/>
<xslt:with-param name="text" select="$text"/>
<xslt:with-param name="paramNumber" select="1"/>
</xslt:call-template>

</xslt:template>

<!-- Template to replace the current parameter and then
recurse to replace subsequent parameters. -->

<xslt:template name="iae:multi-macro-expand">
<xslt:param name="caller"/>
<xslt:param name="text" />
<xslt:param name="paramNumber" />


<xslt:choose>
<xslt:when test="//iso:pattern[@id=$caller]/iso:param[ $paramNumber]">

<xslt:call-template name="iae:multi-macro-expand">
<xslt:with-param name="caller" select="$caller"/>
<xslt:with-param name="paramNumber" select="$paramNumber + 1"/>
<xslt:with-param name="text" >
<xslt:call-template name="iae:replace-substring">
<xslt:with-param name="original" select="$text"/>
<xslt:with-param name="substring"
select="concat('$', //iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@name)"/>
<xslt:with-param name="replacement"
select="//iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@value"/>
</xslt:call-template>
</xslt:with-param>
</xslt:call-template>
</xslt:when>
<xslt:otherwise><xslt:value-of select="$text" /></xslt:otherwise>

</xslt:choose>
</xslt:template>


<!-- generate the real pattern from an abstract pattern + parameters-->
<xslt:template name="iae:abstract-to-real" >
<xslt:param name="caller"/>
<xslt:param name="is-a" />
<xslt:for-each select="//iso:pattern[@id= $is-a]">
<xslt:copy>

<xslt:choose>
<xslt:when test=" string-length( $caller ) = 0">
<xslt:attribute name="id"><xslt:value-of select="concat( generate-id(.) , $is-a)" /></xslt:attribute>
</xslt:when>
<xslt:otherwise>
<xslt:attribute name="id"><xslt:value-of select="$caller" /></xslt:attribute>
</xslt:otherwise>
</xslt:choose>

<xslt:apply-templates select="*|text()" mode="iae:do-pattern" >
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:apply-templates>

</xslt:copy>
</xslt:for-each>
</xslt:template>


<!-- Generate a non-abstract pattern -->
<xslt:template mode="iae:do-pattern" match="*">
<xslt:param name="caller"/>
<xslt:copy>
<xslt:for-each select="@*[name()='test' or name()='context' or name()='select' or name()='path' ]">
<xslt:attribute name="{name()}">
<xslt:call-template name="iae:macro-expand">
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:call-template>
</xslt:attribute>
</xslt:for-each>
<xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select'][name()!='path']" />
<xsl:for-each select="node()">
<xsl:choose>
<!-- Experiment: replace macros in text as well, to allow parameterized assertions
and so on, without having to have spurious <iso:value-of> calls and multiple
delimiting.
NOTE: THIS FUNCTIONALITY WILL BE REMOVED IN THE FUTURE -->
<xsl:when test="self::text()">
<xslt:call-template name="iae:macro-expand">
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:call-template>
</xsl:when>
<xsl:otherwise>
<xslt:apply-templates select="." mode="iae:do-pattern">
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xslt:copy>
</xslt:template>

<!-- UTILITIES -->
<!-- Simple version of replace-substring function -->
<xslt:template name="iae:replace-substring">
<xslt:param name="original" />
<xslt:param name="substring" />
<xslt:param name="replacement" select="''"/>

<xsl:choose>
<xsl:when test="not($original)" />
<xsl:when test="not(string($substring))">
<xsl:value-of select="$original" />
</xsl:when>
<xsl:when test="contains($original, $substring)">
<xsl:variable name="before" select="substring-before($original, $substring)" />
<xsl:variable name="after" select="substring-after($original, $substring)" />

<xsl:value-of select="$before" />
<xsl:value-of select="$replacement" />
<!-- recursion -->
<xsl:call-template name="iae:replace-substring">
<xsl:with-param name="original" select="$after" />
<xsl:with-param name="substring" select="$substring" />
<xsl:with-param name="replacement" select="$replacement" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- no substitution -->
<xsl:value-of select="$original" />
</xsl:otherwise>
</xsl:choose>
</xslt:template>



</xslt:stylesheet>
1,519 changes: 1,519 additions & 0 deletions src/schematron/iso-schematron/iso_dsdl_include.xsl

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions src/schematron/iso-schematron/iso_schematron_message.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" ?><?xar XSLT?>
<!-- Implementation for the Schematron XML Schema Language.
Generates simple text output messages using XSLT1 engine
-->
<!--
Open Source Initiative OSI - The MIT License:Licensing
[OSI Approved License]
This source code was previously available under the zlib/libpng license.
Attribution is polite.
The MIT License
Copyright (c) 2000-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<!-- Schematron message -->

<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">

<xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>

<xsl:template name="process-prolog">
<axsl:output method="text" />
</xsl:template>

<!-- use default rule for process-root: copy contens / ignore title -->
<!-- use default rule for process-pattern: ignore name and see -->
<!-- use default rule for process-name: output name -->
<!-- use default rule for process-assert and process-report:
call process-message -->

<xsl:template name="process-message">
<xsl:param name="pattern" />
<xsl:param name="role" />
<axsl:message>
<xsl:apply-templates mode="text"
/> (<xsl:value-of select="$pattern" />
<xsl:if test="$role"> / <xsl:value-of select="$role" />
</xsl:if>)</axsl:message>
</xsl:template>

</xsl:stylesheet>
64 changes: 64 additions & 0 deletions src/schematron/iso-schematron/iso_schematron_message_xslt2.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" ?><?xar XSLT?>
<!-- Implementation for the Schematron XML Schema Language.
Generates simple text output messages using XSLT2 engine
-->
<!--
Open Source Initiative OSI - The MIT License:Licensing
[OSI Approved License]
This source code was previously available under the zlib/libpng license.
Attribution is polite.
The MIT License
Copyright (c) 2000-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<!-- Schematron message -->

<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">

<xsl:import href="iso_schematron_skeleton_for_saxon.xsl"/>

<xsl:template name="process-prolog">
<axsl:output method="text" />
</xsl:template>

<!-- use default rule for process-root: copy contens / ignore title -->
<!-- use default rule for process-pattern: ignore name and see -->
<!-- use default rule for process-name: output name -->
<!-- use default rule for process-assert and process-report:
call process-message -->

<xsl:template name="process-message">
<xsl:param name="pattern" />
<xsl:param name="role" />
<axsl:message>
<xsl:apply-templates mode="text"
/> (<xsl:value-of select="$pattern" />
<xsl:if test="$role"> / <xsl:value-of select="$role" />
</xsl:if>)</axsl:message>
</xsl:template>

</xsl:stylesheet>
2,306 changes: 2,306 additions & 0 deletions src/schematron/iso-schematron/iso_schematron_skeleton_for_saxon.xsl

Large diffs are not rendered by default.

1,851 changes: 1,851 additions & 0 deletions src/schematron/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl

Large diffs are not rendered by default.

614 changes: 614 additions & 0 deletions src/schematron/iso-schematron/iso_svrl_for_xslt1.xsl

Large diffs are not rendered by default.

692 changes: 692 additions & 0 deletions src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions src/schematron/iso-schematron/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<h1>ISO SCHEMATRON 2010</h1>

XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist.

2010-04-21

Two distributions are available. One is for XSLT1 engines.
The other is for XSLT2 engines, such as SAXON 9.


This version of Schematron splits the process into a pipeline of several different XSLT stages.

1) First, preprocess your Schematron schema with iso_dsdl_include.xsl.
This is a macro processor to assemble the schema from various parts.
If your schema is not in separate parts, you can skip this stage.
This stage also generates error messages for some common XPath syntax problems.

2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl.
This is a macro processor to convert abstract patterns to real patterns.
If your schema does not use abstract patterns, you can skip this
stage.

3) Third, compile the Schematron schema into an XSLT script.
This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl
(which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl)
However, other "meta-styleseets" are also in common use; the principle of operation is the same.
If your schema uses Schematron phases, supply these as command line/invocation parameters
to this process.

4) Fourth, run the script generated by stage 3 against the document being validated.
If you are using the SVRL script, then the output of validation will be an XML document.
If your schema uses Schematron parameters, supply these as command line/invocation parameters
to this process.


The XSLT2 distribution also features several next generation features,
such as validating multiple documents. See the source code for details.

Schematron assertions can be written in any language, of course; the file
sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton
in English, and this can be used as template to localize the skeleton's
error messages. Note that typically programming errors in Schematron are XPath
errors, which requires localized messages from the XSLT engine.

ANT
---
To give an example of how to process a document, here is a sample ANT task.

<target name="schematron-compile-test" >

<!-- expand inclusions -->
<xslt basedir="test/schematron"
style="iso_dsdl_include.xsl" in="test.sch" out="test1.sch">
<classpath>
<pathelement location="${lib.dir}/saxon9.jar"/>
</classpath>
</xslt>

<!-- expand abstract patterns -->
<xslt basedir="test/schematron"
style="iso_abstract_expand.xsl" in="test1.sch" out="test2.sch">
<classpath>
<pathelement location="${lib.dir}/saxon9.jar"/>
</classpath>
</xslt>



<!-- compile it -->
<xslt basedir="test/schematron"
style="iso_svrl_for_xslt2.xsl" in="test2.sch" out="test.xsl">
<classpath>
<pathelement location="${lib.dir}/saxon9.jar"/>
</classpath>
</xslt>

<!-- validate -->
<xslt basedir="test/schematron"
style="test.xsl" in="instance.xml" out="instance.svrlt">
<classpath>
<pathelement location="${lib.dir}/saxon9.jar"/>
</classpath>
</xslt>
</target>

EXTRACTION SCHEMATRON FROM XSD OR RELAX NG

The following files allow extracting of embedded schematron patterns
in XML Schemas or RELAX NG schemas. For details, see the at
article http://www.topologi.com/resources/schtrn_xsd_paper.html

The following files are provided:
ExtractSchFromRNG.xsl Generate a Schematron schema from patterns
embedded in a RELAX NG schema. The schema uses XSLT1.
ExtractSchFromXSD.xsl Generate a Schematron schema from patterns
embedded in a W3C XML Schemas schema. The schema uses XSLT1.

ExtractSchFromRNG-2.xsl Generate a Schematron schema from patterns
embedded in a RELAX NG schema. The schema uses XSLT2.
ExtractSchFromXSD-2.xsl Generate a Schematron schema from patterns
embedded in a W3C XML Schemas schema. The schema uses XSLT2.
56 changes: 56 additions & 0 deletions src/schematron/iso-schematron/sch-messages-cs.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<xhtml:div class="ErrorMessages" xml:lang="cs"
xmlns:xhtml="http://www.w3.org/1999/xhtml" >
<!-- Obsahuje-li chybové hlášení dynamické informace, je rozděleno
do sekcí "a" a "b". Různé jazyky tak mohou dynamické informace
umístit s ohledem na svá gramatická pravidla. -->
<xhtml:p id="sch-message-1-cs">Chyba ve schématu: nalezeny elementy Schematronu ve starém i novém jmenném prostoru</xhtml:p>
<xhtml:p id="sch-message-2-cs">Chyba ve schématu: v atributu queryBinding použijte 'xslt'</xhtml:p>
<xhtml:p id="sch-message-3a-cs">Porucha: Tato implementace ISO Schematronu nefunguje se schématy, která používají dotazovací jazyk</xhtml:p>
<xhtml:p id="sch-message-3b-cs"/>
<xhtml:p id="sch-message-4a-cs">Fázová chyba: fáze jménem </xhtml:p>
<xhtml:p id="sch-message-4b-cs"> není definována.</xhtml:p>
<xhtml:p id="sch-message-5-cs">Chybný markup: v elementu &lt;active> chybí atribut pattern</xhtml:p>
<xhtml:p id="sch-message-6a-cs">Chybný odkaz: vzor "</xhtml:p>
<xhtml:p id="sch-message-6b-cs">" byl aktivován, ne však deklarován</xhtml:p>
<xhtml:p id="sch-message-7-cs">Chybný markup: v elementu &lt;assert> chybí atribut test</xhtml:p>
<xhtml:p id="sch-message-8-cs">Chybný markup: v elementu &lt;report> chybí atribut test</xhtml:p>
<xhtml:p id="sch-message-9-cs">Chybný markup: v elementu &lt;diagnostic> chybí atribut id</xhtml:p>
<xhtml:p id="sch-message-10-cs">Chybný markup: v elementu &lt;extends> chybí atribut rule</xhtml:p>
<xhtml:p id="sch-message-11a-cs">Chybný odkaz: abstraktní pravidlo "</xhtml:p>
<xhtml:p id="sch-message-11b-cs">" není definováno, ačkoli se na ně odkazuje</xhtml:p>
<xhtml:p id="sch-message-12-cs">Chybný markup: v elementu &lt;key> chybí atribut name</xhtml:p>
<xhtml:p id="sch-message-13-cs">Chybný markup: v elementu &lt;key> chybí atribut path nebo use</xhtml:p>
<xhtml:p id="sch-message-14-cs">Chybný markup: v elementu &lt;key> chybí atribut path nebo use</xhtml:p>
<xhtml:p id="sch-message-15-cs">Chyba ve schématu: element &lt;key> není ve jmenném prostoru ISO Schematronu. Použijte jmenný prostor XSLT.</xhtml:p>
<xhtml:p id="sch-message-16-cs">Chybný markup: v elementu &lt;function> chybí atribut name</xhtml:p>
<xhtml:p id="sch-message-17-cs">Chyba ve schématu: element &lt;function> není ve jmenném prostoru ISO Schematronu. Použijte jmenný prostor XSLT.</xhtml:p>
<xhtml:p id="sch-message-18-cs">Chyba ve schématu: direktiva &lt;include> má prázdný atribut href</xhtml:p>
<xhtml:p id="sch-message-19-cs">Chyba: Nesprávné URL v direktivě &lt;include></xhtml:p>
<xhtml:p id="sch-message-20a-cs">Chyba: Nelze otevřít vkládaný soubor </xhtml:p>
<xhtml:p id="sch-message-20b-cs" />
<xhtml:p id="sch-message-21-cs">Chyba ve schématu: &lt;include> používejte ke vkládání fragmentů, ne celého schématu</xhtml:p>
<xhtml:p id="sch-message-22-cs">Chyba ve schématu: Schémata XSD lze importovat pouze pokud používáte dotazovací jazyk "xslt2"</xhtml:p>
<xhtml:p id="sch-message-23-cs">Chyba ve schématu: element &lt;import-schema> není ve jmenném prostoru ISO Schematronu. Použijte jmenný prostor XSLT.</xhtml:p>
<xhtml:p id="sch-message-24-cs">Varování: S dotazovacím jazykem "xpath" by se neměly používat proměnné</xhtml:p>
<xhtml:p id="sch-message-25-cs">Varování: S dotazovacím jazykem "xpath2" by se neměly používat proměnné</xhtml:p>
<xhtml:p id="sch-message-26-cs">Chybný markup: v elementu &lt;ns> chybí atribut uri</xhtml:p>
<xhtml:p id="sch-message-27-cs">Chybný markup: v elementu &lt;ns> chybí atribut prefix</xhtml:p>
<xhtml:p id="sch-message-28-cs">Chyba v implementaci schématu: toto schéma obsahuje abstraktní vzory, které však již měly být předchozím zpracováním odstraněny</xhtml:p>
<xhtml:p id="sch-message-29-cs">Chybný markup: v elementu &lt;phase> chybí atribut id</xhtml:p>
<xhtml:p id="sch-message-30-cs">Chybný markup: v elementu &lt;rule> chybí atribut context</xhtml:p>
<xhtml:p id="sch-message-31-cs">Chybný markup: v abstraktním pravidlu chybí atribut id</xhtml:p>
<xhtml:p id="sch-message-32-cs">Chybný markup: (2) Abstraktní pravidlo nesmí mít atribut context</xhtml:p>
<xhtml:p id="sch-message-33-cs">Chybný markup: Abstraktní pravidlo nesmí mít atribut context</xhtml:p>
<xhtml:p id="sch-message-34-cs">Chybný markup: v elementu &lt;value-of> chybí atribut select</xhtml:p>
<xhtml:p id="sch-message-35a-cs">Varování: </xhtml:p>
<xhtml:p id="sch-message-35b-cs"> nesmí obsahovat žádné podelementy</xhtml:p>
<xhtml:p id="sch-message-36a-cs">Chybný odkaz: Diagnostika "</xhtml:p>
<xhtml:p id="sch-message-36b-cs">" nebyla deklarována, ačkoli se na ni odkazuje</xhtml:p>
<xhtml:p id="sch-message-37a-cs">Chyba: procesor </xhtml:p>
<xhtml:p id="sch-message-37b-cs"> nepodporuje použití jmenného prostoru XSLT s jiným prefixem než "xsl"</xhtml:p>
<xhtml:p id="sch-message-38a-cs">Chyba: neznámý element </xhtml:p>
<xhtml:p id="sch-message-38b-cs"> ve jmenném prostoru ISO Schematronu: zkontrolujte, je-li správně zapsán</xhtml:p>
<xhtml:p id="sch-message-39a-cs">Varování: neznámý element
</xhtml:p>
<xhtml:p id="sch-message-39b-cs" />
</xhtml:div>
55 changes: 55 additions & 0 deletions src/schematron/iso-schematron/sch-messages-de.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<xhtml:div class="ErrorMessages" xml:lang="de" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!-- Where the error message contains dynamic information, the message has been split into an "a" and a "b" section.
This has been done even when the English does not require it, in order to accomodate different language grammars
that might position the dynamic information differently.
-->
<xhtml:p id="sch-message-1-de">Fehler im Schema: Schematron Elemente sowohl im alten als auch neuen Namensraum gefunden</xhtml:p>
<xhtml:p id="sch-message-2-de">Fehler im Schema: Nutzen Sie 'xslt' als Wert für das 'queryBinding'-Attribut</xhtml:p>
<xhtml:p id="sch-message-3a-de">Fehler: Diese Implementierung von ISO Schematron unterstützt keine Schemas, welche die Query Language </xhtml:p>
<xhtml:p id="sch-message-3b-de">nutzen</xhtml:p>
<xhtml:p id="sch-message-4a-de">Phasenfehler: Es gibt keine Phase mit Namen </xhtml:p>
<xhtml:p id="sch-message-4b-de"/>
<xhtml:p id="sch-message-5-de">Fehler in der Annotation: Kein Attribut 'pattern' in &lt;active></xhtml:p>
<xhtml:p id="sch-message-6a-de">Referenzierungsfehler: Der Ausdruck "</xhtml:p>
<xhtml:p id="sch-message-6b-de">" wurde aktiviert, ist aber nicht deklariert</xhtml:p>
<xhtml:p id="sch-message-7-de">Fehler in der Annotation: Kein Attribut 'test' in &lt;assert</xhtml:p>
<xhtml:p id="sch-message-8-de">Fehler in der Annotation: Kein Attribut 'test' in &lt;report></xhtml:p>
<xhtml:p id="sch-message-9-de">Fehler in der Annotation: Kein Attribut 'id' in &lt;diagnostic></xhtml:p>
<xhtml:p id="sch-message-10-de">Fehler in der Annotation: Kein Attribut 'rule' in &lt;extends></xhtml:p>
<xhtml:p id="sch-message-11a-de">Referenzierungsfehler: Die abstrakte Regel "</xhtml:p>
<xhtml:p id="sch-message-11b-de">" wurde referenziert, ist aber nicht deklariert</xhtml:p>
<xhtml:p id="sch-message-12-de">Fehler in der Annotation: Kein Attribut 'name' in &lt;key></xhtml:p>
<xhtml:p id="sch-message-13-de">Fehler in der Annotation: Kein Attribut 'path' oder 'use' in &lt;key></xhtml:p>
<xhtml:p id="sch-message-14-de">Fehler in der Annotation: Kein Attribut 'path' oder 'use' in &lt;key></xhtml:p>
<xhtml:p id="sch-message-15-de">Fehler im Schema: Das Element &lt;key> ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum.</xhtml:p>
<xhtml:p id="sch-message-16-de">Fehler in der Annotation: Kein Attribut 'name' in &lt;function></xhtml:p>
<xhtml:p id="sch-message-17-de">Fehler im Schema: Das Element &lt;function> ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum.</xhtml:p>
<xhtml:p id="sch-message-18-de">Fehler im Schema: Leeres Attribut 'href' für &lt;include> Anweisung.</xhtml:p>
<xhtml:p id="sch-message-19-de">Fehler: Ungültige URL in &lt;include></xhtml:p>
<xhtml:p id="sch-message-20a-de">Kann die referenzierte Datei nicht öffnen: </xhtml:p>
<xhtml:p id="sch-message-20b-de"/>
<xhtml:p id="sch-message-21-de">Fehler im Schema: &lt;include> darf nur zur Einbettung von Schemafragmenten genutzt werden, nicht für ganze Schemata</xhtml:p>
<xhtml:p id="sch-message-22-de">Fehler im Schema: XSD Schemata dürfen nur importiert werden, wenn das 'xslt2' Query Language Binding genutzt wird</xhtml:p>
<xhtml:p id="sch-message-23-de">Fehler im Schema: Das Element &lt;import-schema> ist im ISO Schematron-Namensraum nicht vorhanden. Benutzen Sie den XSLT-Namensraum.</xhtml:p>
<xhtml:p id="sch-message-24-de">Warnung: Variablen sollten nicht zusammen mit dem 'xpath' Query Language Binding genutzt werden.</xhtml:p>
<xhtml:p id="sch-message-25-de">Warnung: Variablen sollten nicht zusammen mit dem 'xpath2' Query Language Binding genutzt werden.</xhtml:p>
<xhtml:p id="sch-message-26-de">Fehler in der Annotation: Fehlendes Attribut 'uri' in &lt;ns></xhtml:p>
<xhtml:p id="sch-message-27-de">Fehler in der Annotation: Fehlendes Attribut 'prefix' in &lt;ns></xhtml:p>
<xhtml:p id="sch-message-28-de">Fehler bei der Schemaimplementierung: Dieses Schema enthält abstrakte Mustervergleiche, die bereits vorverarbeitet sein sollten.</xhtml:p>
<xhtml:p id="sch-message-29-de">Fehler in der Annotation: Fehlendes Attribut 'id' in &lt;phase></xhtml:p>
<xhtml:p id="sch-message-30-de">Fehler in der Annotation: Fehlendes Attribut 'context' in &lt;rule></xhtml:p>
<xhtml:p id="sch-message-31-de">Fehler in der Annotation: Fehlendes Attribut 'id' an abstrakter &lt;rule></xhtml:p>
<xhtml:p id="sch-message-32-de">Fehler in der Annotation: (2) Kontext-Attribut an abstrakter &lt;rule></xhtml:p>
<xhtml:p id="sch-message-33-de">Fehler in der Annotation: Attribut 'context' an abstrakter &lt;rule></xhtml:p>
<xhtml:p id="sch-message-34-de">Fehler in der Annotation: Fehlendes Attribut 'select' in &lt;value-of></xhtml:p>
<xhtml:p id="sch-message-35a-de">Warnung: </xhtml:p>
<xhtml:p id="sch-message-35b-de"> darf keine Kindelemente beinhalten</xhtml:p>
<xhtml:p id="sch-message-36a-de">Referenzierungsfehler: Ein &lt;diagnostic>-Element "</xhtml:p>
<xhtml:p id="sch-message-36b-de">" wurde referenziert, ist aber nicht deklariert</xhtml:p>
<xhtml:p id="sch-message-37a-de">Der Gebrauch des XSLT-Namensraums mit einem anderen Präfix als 'xsl' in Schematron-Regeln wird von diesem Prozessor nicht unterstützt:</xhtml:p>
<xhtml:p id="sch-message-37b-de"/>
<xhtml:p id="sch-message-38a-de">Fehler: Unbekanntes Element im ISO Schematron-Namensraum: Überprüfen Sie die Schreibweise (inkl. Groß- und Kleinschreibung)</xhtml:p>
<xhtml:p id="sch-message-38b-de"/>
<xhtml:p id="sch-message-39a-de">Warnung: Unbekanntes Element </xhtml:p>
<xhtml:p id="sch-message-39b-de"/>
</xhtml:div>
57 changes: 57 additions & 0 deletions src/schematron/iso-schematron/sch-messages-en.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

<xhtml:div class="ErrorMessages" xml:lang="en"
xmlns:xhtml="http://www.w3.org/1999/xhtml" >
<!-- Where the error message contains dynamic information, the message has been split into an "a" and a "b" section.
This has been done even when the English does not require it, in order to accomodate different language grammars
that might position the dynamic information differently.
-->
<xhtml:p id="sch-message-1-en">Schema error: Schematron elements in old and new namespaces found</xhtml:p>
<xhtml:p id="sch-message-2-en">Schema error: in the queryBinding attribute, use 'xslt'</xhtml:p>
<xhtml:p id="sch-message-3a-en">Fail: This implementation of ISO Schematron does not work with schemas using the query language </xhtml:p>
<xhtml:p id="sch-message-3b-en"/>
<xhtml:p id="sch-message-4a-en">Phase Error: no phase has been defined with name </xhtml:p>
<xhtml:p id="sch-message-4b-en" />
<xhtml:p id="sch-message-5-en">Markup Error: no pattern attribute in &lt;active></xhtml:p>
<xhtml:p id="sch-message-6a-en">Reference Error: the pattern "</xhtml:p>
<xhtml:p id="sch-message-6b-en">" has been activated but is not declared</xhtml:p>
<xhtml:p id="sch-message-7-en">Markup Error: no test attribute in &lt;assert></xhtml:p>
<xhtml:p id="sch-message-8-en">Markup Error: no test attribute in &lt;report></xhtml:p>
<xhtml:p id="sch-message-9-en">Markup Error: no id attribute in &lt;diagnostic></xhtml:p>
<xhtml:p id="sch-message-10-en">Markup Error: no rule attribute in &lt;extends></xhtml:p>
<xhtml:p id="sch-message-11a-en">Reference Error: the abstract rule "</xhtml:p>
<xhtml:p id="sch-message-11b-en">" has been referenced but is not declared</xhtml:p>
<xhtml:p id="sch-message-12-en">Markup Error: no name attribute in &lt;key></xhtml:p>
<xhtml:p id="sch-message-13-en">Markup Error: no path or use attribute in &lt;key></xhtml:p>
<xhtml:p id="sch-message-14-en">Markup Error: no path or use attribute in &lt;key></xhtml:p>
<xhtml:p id="sch-message-15-en">Schema error: The &lt;key> element is not in the ISO Schematron namespace. Use the XSLT namespace.</xhtml:p>
<xhtml:p id="sch-message-16-en">Markup Error: no name attribute in &lt;function></xhtml:p>
<xhtml:p id="sch-message-17-en">Schema error: The &lt;function> element is not in the ISO Schematron namespace. Use the XSLT namespace.</xhtml:p>
<xhtml:p id="sch-message-18-en">Schema error: Empty href attribute for &lt;include> directive.</xhtml:p>
<xhtml:p id="sch-message-19-en">Error: Impossible URL in Schematron &lt;include></xhtml:p>
<xhtml:p id="sch-message-20a-en">Error: Unable to open referenced included file: </xhtml:p>
<xhtml:p id="sch-message-20b-en" />
<xhtml:p id="sch-message-21-en">Schema error: Use &lt;include> to include fragments, not a whole schema</xhtml:p>
<xhtml:p id="sch-message-22-en">Schema error: XSD schemas may only be imported if you are using the 'xslt2' query language binding</xhtml:p>
<xhtml:p id="sch-message-23-en">Schema error: The &lt;import-schema> element is not available in the ISO Schematron namespace. Use the XSLT namespace.</xhtml:p>
<xhtml:p id="sch-message-24-en">Warning: Variables should not be used with the "xpath" query language binding.</xhtml:p>
<xhtml:p id="sch-message-25-en">Warning: Variables should not be used with the "xpath2" query language binding.</xhtml:p>
<xhtml:p id="sch-message-26-en">Markup Error: no uri attribute in &lt;ns></xhtml:p>
<xhtml:p id="sch-message-27-en">Markup Error: no prefix attribute in &lt;ns></xhtml:p>
<xhtml:p id="sch-message-28-en">Schema implementation error: This schema has abstract patterns, yet they are supposed to be preprocessed out already</xhtml:p>
<xhtml:p id="sch-message-29-en">Markup Error: no id attribute in &lt;phase></xhtml:p>
<xhtml:p id="sch-message-30-en">Markup Error: no context attribute in &lt;rule></xhtml:p>
<xhtml:p id="sch-message-31-en">Markup Error: no id attribute on abstract &lt;rule></xhtml:p>
<xhtml:p id="sch-message-32-en">Markup Error: (2) context attribute on abstract &lt;rule></xhtml:p>
<xhtml:p id="sch-message-33-en">Markup Error: context attribute on abstract &lt;rule></xhtml:p>
<xhtml:p id="sch-message-34-en">Markup Error: no select attribute in &lt;value-of></xhtml:p>
<xhtml:p id="sch-message-35a-en">Warning: </xhtml:p>
<xhtml:p id="sch-message-35b-en"> must not contain any child elements</xhtml:p>
<xhtml:p id="sch-message-36a-en">Reference error: A diagnostic "</xhtml:p>
<xhtml:p id="sch-message-36b-en">" has been referenced but is not declared</xhtml:p>
<xhtml:p id="sch-message-37a-en">Warning: Using the XSLT namespace with a prefix other than "xsl" in Schematron rules is not supported in this processor:</xhtml:p>
<xhtml:p id="sch-message-37b-en" />
<xhtml:p id="sch-message-38a-en">Error: unrecognized element in ISO Schematron namespace: check spelling and capitalization</xhtml:p>
<xhtml:p id="sch-message-38b-en" />
<xhtml:p id="sch-message-39a-en">Warning: unrecognized element </xhtml:p>
<xhtml:p id="sch-message-39b-en" />
</xhtml:div>
54 changes: 54 additions & 0 deletions src/schematron/iso-schematron/sch-messages-fr.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<xhtml:div class="ErrorMessages" xml:lang="fr" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!-- Where the error message contains dynamic information, the message has been split into an "a" and a "b" section.
This has been done even when the English does not require it, in order to accomodate different language grammars
that might position the dynamic information differently.
-->
<xhtml:p id="sch-message-1-fr">Erreur de schema: éléments Schematron à la fois dans l'ancien et le nouveau namespace</xhtml:p>
<xhtml:p id="sch-message-2-fr">Erreur de schema: utilisez 'xslt' dans l'attribut queryBinding</xhtml:p>
<xhtml:p id="sch-message-3a-fr">Échec: Cette implémentation de Schematron ISO ne fonctionne pas avec des schemas utilisant le langage de query </xhtml:p>
<xhtml:p id="sch-message-3b-fr"/>
<xhtml:p id="sch-message-4a-fr">Erreur de phase: aucune phase n'a été définie avec le nom </xhtml:p>
<xhtml:p id="sch-message-4b-fr"/>
<xhtml:p id="sch-message-5-fr">Erreur de balisage: pas d'attribut pattern dans &lt;active></xhtml:p>
<xhtml:p id="sch-message-6a-fr">Erreur de référence: le pattern "</xhtml:p>
<xhtml:p id="sch-message-6b-fr">" a été activé mais n'a pas été décalaré</xhtml:p>
<xhtml:p id="sch-message-7-fr">Erreur de balisage: pas d'attribut test dans &lt;assert></xhtml:p>
<xhtml:p id="sch-message-8-fr">Erreur de balisage: pas d'attribut test dans &lt;report></xhtml:p>
<xhtml:p id="sch-message-9-fr">Erreur de balisage: pas d'attribut id dans &lt;diagnostic></xhtml:p>
<xhtml:p id="sch-message-10-fr">Erreur de balisage: pas d'attribut rule dans &lt;extends></xhtml:p>
<xhtml:p id="sch-message-11a-fr">Erreur de référence: la règle abstraite "</xhtml:p>
<xhtml:p id="sch-message-11b-fr">" a été référencée mais pas déclarée</xhtml:p>
<xhtml:p id="sch-message-12-fr">Erreur de balisage: pas d'attribut name dans &lt;key></xhtml:p>
<xhtml:p id="sch-message-13-fr">Erreur de balisage: pas d'attribut path ou use dans &lt;key></xhtml:p>
<xhtml:p id="sch-message-15-fr">Erreur de schema: L'élément key n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT.</xhtml:p>
<xhtml:p id="sch-message-16-fr">Erreur de balisage: pas d'attribut name dans &lt;function></xhtml:p>
<xhtml:p id="sch-message-17-fr">Erreur de schema: L'élément function n'est pas dans le namespace Schematron ISO. Utilisez le namespace XSLT.</xhtml:p>
<xhtml:p id="sch-message-18-fr">Erreur de schema: Attribut href vide sur a directive include.</xhtml:p>
<xhtml:p id="sch-message-19-fr">Erreur: URL impossible dans la directive include de Schematron</xhtml:p>
<xhtml:p id="sch-message-20a-fr">Impossible d'ouvrir le fichier référencé pour l'inclusion: </xhtml:p>
<xhtml:p id="sch-message-20b-fr"/>
<xhtml:p id="sch-message-21-fr">Erreur de schema: Utilisez include pour inclure des fragments et non un schema entier</xhtml:p>
<xhtml:p id="sch-message-22-fr">Erreur de schema: Les schema XSD peuvent être importés seulement si vous utilisez the langage de query 'xslt2'</xhtml:p>
<xhtml:p id="sch-message-23-fr">Erreur de schema: L'élément import-schema n'est pas disponible dans le namespace Schematron ISO. Utilisez le namespace XSLT.</xhtml:p>
<xhtml:p id="sch-message-24-fr">Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath".</xhtml:p>
<xhtml:p id="sch-message-24-fr">Avertissement: Des variables ne devraient pas être utiliées avec le langage de query "xpath2".</xhtml:p>
<xhtml:p id="sch-message-26-fr">Erreur de balisage: pas d'attribut uri dans &lt;ns></xhtml:p>
<xhtml:p id="sch-message-27-fr">Erreur de balisage: pas d'attribut prefix dans &lt;ns></xhtml:p>
<xhtml:p id="sch-message-28-fr">Erreur d'implémentation de schema: Ce schema des patterns abstraits, bien qu'ils sont supposés avoir été préprocessés précédemment</xhtml:p>
<xhtml:p id="sch-message-29-fr">Erreur de balisage: pas d'attribut id dans &lt;phase></xhtml:p>
<xhtml:p id="sch-message-30-fr">Erreur de balisage: pas d'attribut context dans &lt;rule></xhtml:p>
<xhtml:p id="sch-message-31-fr">Erreur de balisage: pas d'attribut id dans &lt;rule></xhtml:p>
<xhtml:p id="sch-message-32-fr">Erreur de balisage: (2) attribut context dans une &lt;rule> abstraite</xhtml:p>
<xhtml:p id="sch-message-33-fr">Erreur de balisage: attribut context dans une &lt;rule> abstraite</xhtml:p>
<xhtml:p id="sch-message-34-fr">Erreur de balisage: pas d'attribut select dans &lt;value-of></xhtml:p>
<xhtml:p id="sch-message-35a-fr">Avertissement: </xhtml:p>
<xhtml:p id="sch-message-35b-fr"> ne peut contenir aucun élément enfant</xhtml:p>
<xhtml:p id="sch-message-36a-fr">Erreur de référence: Un diagnostique "</xhtml:p>
<xhtml:p id="sch-message-36b-fr">" a été référencé mais n'est pas déclaré</xhtml:p>
<xhtml:p id="sch-message-37a-fr">Utiliser the namespace XSLT avec un autre préfixe que "xsl" dans les rules Schematron n'est pas supporté par ce processor:</xhtml:p>
<xhtml:p id="sch-message-37b-fr"/>
<xhtml:p id="sch-message-38a-fr">Erreur: élément inconnu dans le namespace Schematron ISO: vérifiez l'orthographe et la casse</xhtml:p>
<xhtml:p id="sch-message-38b-fr"/>
<xhtml:p id="sch-message-39a-fr">Avertissement: élément inconnu</xhtml:p>
<xhtml:p id="sch-message-39b-fr"/>
</xhtml:div>
53 changes: 53 additions & 0 deletions src/schematron/iso-schematron/sch-messages-ja.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<xhtml:div class="ErrorMessages" xml:lang="ja"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!--エラーメセージは動的な情報が含まれている場合、メセージは "a" と "b" のセクションに分割されています。英語が異なる動的情報の可能がある時、別の言語の文法を収容するために、それを必要しない時にも行われている。-->
<xhtml:p id="sch-message-1-ja">スキーマエラー:古い名前空間と新しい名前空間にはSchematron 要素が見つかりました。</xhtml:p>
<xhtml:p id="sch-message-2-ja">スキーマエラー:検索結合属性では、 'xslt'を使用する。</xhtml:p>
<xhtml:p id="sch-message-3a-ja">失敗: ISO Schematron の 実行 は、スキーマが検索言語を使用してできない。</xhtml:p>
<xhtml:p id="sch-message-3b-ja"/>
<xhtml:p id="sch-message-4a-ja">フェーズ エラー: フェーズは名前で定義されていない。</xhtml:p>
<xhtml:p id="sch-message-4b-ja"/>
<xhtml:p id="sch-message-5-ja">マークアップエラー: &lt;active>にはパターンの属性がない</xhtml:p>
<xhtml:p id="sch-message-6a-ja">参照エラー: パターン が "</xhtml:p>
<xhtml:p id="sch-message-6b-ja">" 活性化されているが宣言されていない。</xhtml:p>
<xhtml:p id="sch-message-7-ja">マークアップエラー: &lt;assert> にはtestの属性がない</xhtml:p>
<xhtml:p id="sch-message-8-ja">マークアップエラー: &lt;report> にはtestの属性がない</xhtml:p>
<xhtml:p id="sch-message-9-ja">マークアップエラー: &lt;diagnostic> にはidの属性がない  </xhtml:p>
<xhtml:p id="sch-message-10-ja">マークアップエラー:  &lt;extends> にはruleの属性がない</xhtml:p>
<xhtml:p id="sch-message-11a-ja">参照エラー: 抽象的な規則が "</xhtml:p>
<xhtml:p id="sch-message-11b-ja">" 参照されているが宣言されていない。</xhtml:p>
<xhtml:p id="sch-message-12-ja">マークアップエラー: &lt;key>にはnameの属性がない</xhtml:p>
<xhtml:p id="sch-message-13-ja">マークアップエラー: &lt;key>にはpath か 又は useの 属性がない</xhtml:p>
<xhtml:p id="sch-message-14-ja">マークアップエラー:  &lt;key>には path か 又は useの 属性がない</xhtml:p>
<xhtml:p id="sch-message-15-ja">スキーマエラー: &lt;key> の要素はISO Schematronの 名前空間にはない. XSLTの名前空間を使用する。</xhtml:p>
<xhtml:p id="sch-message-16-ja">マークアップエラー: &lt;function>にはnameの属性がない</xhtml:p>
<xhtml:p id="sch-message-17-ja">スキーマエラー: &lt;function> の要素はISO Schematronの 名前空間にはない. XSLTの名前空間を使用する。</xhtml:p>
<xhtml:p id="sch-message-18-ja">スキーマエラー: &lt;include>のために空hrefの属性がある。</xhtml:p>
<xhtml:p id="sch-message-19-ja">エラー: Schematron &lt;include>には不可能なURL がある</xhtml:p>
<xhtml:p id="sch-message-20a-ja">エラー: 参照したファイルが含まれて、開けない : </xhtml:p>
<xhtml:p id="sch-message-20b-ja"/>
<xhtml:p id="sch-message-21-ja">スキーマエラー:全体のスキーマではなく、フラグメントを含む &lt;include> を使用する。</xhtml:p>
<xhtml:p id="sch-message-22-ja">スキーマエラー: 'xslt2'の検索言語結合を使用している場合はXSDスキーマのみ読み込みできる。</xhtml:p>
<xhtml:p id="sch-message-23-ja">スキーマエラー:ISO Schematron の名前空間には &lt;import-schema>の要素は無効です。 XSLTの 名前空間を使用する。</xhtml:p>
<xhtml:p id="sch-message-24-ja">注意: 変数は、"xpath" 検索言語結合を使用すべきではない。</xhtml:p>
<xhtml:p id="sch-message-25-ja">注意: 変数は、"xpath" 検索言語結合を使用すべきではない。</xhtml:p>
<xhtml:p id="sch-message-26-ja">マークアップエラー: &lt;ns>にはuriの属性がない</xhtml:p>
<xhtml:p id="sch-message-27-ja">マークアップエラー: &lt;ns>にはprefixの属性がない</xhtml:p>
<xhtml:p id="sch-message-28-ja">スキーマ実行 エラー: このスキーマは抽象的なパターンを持って、まだすでに前加工されることになっている。</xhtml:p>
<xhtml:p id="sch-message-29-ja">マークアップエラー: &lt;phase>にはidの属性がない</xhtml:p>
<xhtml:p id="sch-message-30-ja">マークアップエラー: &lt;rule>にはcontextの要素がない</xhtml:p>
<xhtml:p id="sch-message-31-ja">マークアップエラー: 抽象的な &lt;rule>にはid属性がない。</xhtml:p>
<xhtml:p id="sch-message-32-ja">マークアップエラー: (2) 抽象的な &lt;rule>にはcontext属性がない。</xhtml:p>
<xhtml:p id="sch-message-33-ja">マークアップエラー: 抽象的な &lt;rule>にはcontext属性がない。</xhtml:p>
<xhtml:p id="sch-message-34-ja">マークアップエラー: &lt;value-of>には selectの属性がない</xhtml:p>
<xhtml:p id="sch-message-35a-ja">注意: </xhtml:p>
<xhtml:p id="sch-message-35b-ja"> 子要素が含まれなくてはならない</xhtml:p>
<xhtml:p id="sch-message-36a-ja">参照エラー: 診断は "</xhtml:p>
<xhtml:p id="sch-message-36b-ja">" 参照されているが宣言されていない。</xhtml:p>
<xhtml:p id="sch-message-37a-ja">注意: Schematron規則で"xsl"以外の接頭辞 XSLT 名前空間を使用することは、このプロセサーで サーポトしていない。</xhtml:p>
<xhtml:p id="sch-message-37b-ja"/>
<xhtml:p id="sch-message-38a-ja">エラー: ISO Schematron 名前空間に不明な要素がある: 綴り字と大文字使用を確認する</xhtml:p>
<xhtml:p id="sch-message-38b-ja"/>
<xhtml:p id="sch-message-39a-ja">注意: 不明な要素</xhtml:p>
<xhtml:p id="sch-message-39b-ja"/>
</xhtml:div>
58 changes: 58 additions & 0 deletions src/schematron/iso-schematron/sch-messages-nl.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<xhtml:div class="ErrorMessages" xml:lang="nl" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!-- Where the error message contains dynamic information, the message has been split into an "a" and a "b" section.
This has been done even when the English does not require it, in order to accomodate different language grammars
that might position the dynamic information differently.
-->
<xhtml:p id="sch-message-1-nl">Schema fout: er werden Schematron elementen uit de oude en nieuwe
namespace gevonden</xhtml:p>
<xhtml:p id="sch-message-2-nl">Schema fout: gebruik 'xslt' in het queryBinding attribute</xhtml:p>
<xhtml:p id="sch-message-3a-nl">Faling: Deze implementatie van ISO Schematron werkt niet met
schemas die gebruik maken van de query language </xhtml:p>
<xhtml:p id="sch-message-3b-nl"/>
<xhtml:p id="sch-message-4a-nl">Fase fout: er is geen 'phase' gedefinieerd met naam </xhtml:p>
<xhtml:p id="sch-message-4b-nl"/>
<xhtml:p id="sch-message-5-nl">Markup fout: er is geen 'pattern' attribuut in &lt;active></xhtml:p>
<xhtml:p id="sch-message-6a-nl">Referentie fout: het 'pattern' "</xhtml:p>
<xhtml:p id="sch-message-6b-nl">" is geactiveerd maar niet gedeclareerd</xhtml:p>
<xhtml:p id="sch-message-7-nl">Markup fout: er is geen 'test' attribuut in &lt;assert</xhtml:p>
<xhtml:p id="sch-message-8-nl">Markup fout: er is geen 'test' attribuut in &lt;report></xhtml:p>
<xhtml:p id="sch-message-9-nl">Markup fout: er is geen 'id' attribuut in &lt;diagnostic></xhtml:p>
<xhtml:p id="sch-message-10-nl">Markup fout: er is geen 'rule' attribuut in &lt;extends></xhtml:p>
<xhtml:p id="sch-message-11a-nl">Referentie fout: de abstracte regel "</xhtml:p>
<xhtml:p id="sch-message-11b-nl">" werd gerefereerd maar niet gedeclareerd</xhtml:p>
<xhtml:p id="sch-message-12-nl">Markup fout: er is geen 'name' attribuut in &lt;key></xhtml:p>
<xhtml:p id="sch-message-13-nl">Markup fout: er is geen 'path' of 'use' attribuut in &lt;key></xhtml:p>
<xhtml:p id="sch-message-14-nl">Markup fout: er is geen 'path' of 'use' attribuut in &lt;key></xhtml:p>
<xhtml:p id="sch-message-15-nl">Schema fout: Het 'key' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace.</xhtml:p>
<xhtml:p id="sch-message-16-nl">Markup fout: er is geen 'name' attribuut in &lt;function></xhtml:p>
<xhtml:p id="sch-message-17-nl">Schema fout: Het 'function' element zit niet in de ISO Schematron namespace. Gebruik de XSLT namespace.</xhtml:p>
<xhtml:p id="sch-message-18-nl">Schema fout: Leeg 'href=' attribuut bij de include opdracht.</xhtml:p>
<xhtml:p id="sch-message-19-nl">Fout: Onmogelijke URL gebruikt bij de Schematron include</xhtml:p>
<xhtml:p id="sch-message-20a-nl">Kan de gerefereerde 'include' file niet openen: </xhtml:p>
<xhtml:p id="sch-message-20b-nl"/>
<xhtml:p id="sch-message-21-nl">Schema fout: Gebruik include om fragmenten op te nemen, niet een volledig schema</xhtml:p>
<xhtml:p id="sch-message-22-nl">Schema fout: XSD schemas kunnen enkel geïmporteerd worden indien de 'xslt2' query language binding gebruikt is</xhtml:p>
<xhtml:p id="sch-message-23-nl">Schema fout: Het 'import-schema' element is niet beschikbaar in the ISO Schematron namespace. Gebruik de XSLT namespace.</xhtml:p>
<xhtml:p id="sch-message-24-nl">Waarschuwing: Variabelen niet gebruiken met de "xpath" query language binding.</xhtml:p>
<xhtml:p id="sch-message-25-nl">Waarschuwing: Variabelen niet gebruiken met de "xpath2" query language binding.</xhtml:p>
<xhtml:p id="sch-message-26-nl">Markup fout: er is geen 'uri' attribute in &lt;ns></xhtml:p>
<xhtml:p id="sch-message-27-nl">Markup fout: er is geen 'prefix' attribute in &lt;ns></xhtml:p>
<xhtml:p id="sch-message-28-nl">Schema implementatie fout: Dit schema heeft abstracte patronen, die al gepreprocessed zouden moeten zijn</xhtml:p>
<xhtml:p id="sch-message-29-nl">Markup fout: er is geen 'id' attribuut in &lt;phase></xhtml:p>
<xhtml:p id="sch-message-30-nl">Markup fout: er is geen 'context' attribuut in &lt;rule></xhtml:p>
<xhtml:p id="sch-message-31-nl">Markup fout: er is geen 'id' attribuut op abstracte &lt;rule></xhtml:p>
<xhtml:p id="sch-message-32-nl">Markup fout: (2) context attributen op abstracte &lt;rule></xhtml:p>
<xhtml:p id="sch-message-33-nl">Markup fout: context attribuut op abstracte &lt;rule></xhtml:p>
<xhtml:p id="sch-message-34-nl">Markup fout: er is geen 'select' attribute in &lt;value-of></xhtml:p>
<xhtml:p id="sch-message-35a-nl">Waarschuwing: </xhtml:p>
<xhtml:p id="sch-message-35b-nl"> mag geen kind elementen bevatten</xhtml:p>
<xhtml:p id="sch-message-36a-nl">Referentie fout: Een diagnostic "</xhtml:p>
<xhtml:p id="sch-message-36b-nl">" werd gerefereerd maar is niet gedeclareerd.</xhtml:p>
<xhtml:p id="sch-message-37a-nl">Het gebruik van de XSLT namespace met een prefix verschillend
van "xsl" in Schematron regels wordt niet ondersteund in deze processor:</xhtml:p>
<xhtml:p id="sch-message-37b-nl"/>
<xhtml:p id="sch-message-38a-nl">Fout: een niet herkend element in de ISO Schematron namespace: check spelling en hoofdlettergebruik</xhtml:p>
<xhtml:p id="sch-message-38b-nl"/>
<xhtml:p id="sch-message-39a-nl">Waarschuwing: een niet herkend element </xhtml:p>
<xhtml:p id="sch-message-39b-nl"/>
</xhtml:div>
723 changes: 723 additions & 0 deletions src/schematron/iso-schematron/schematron-skeleton-api.htm

Large diffs are not rendered by default.

139 changes: 139 additions & 0 deletions src/schematron/sch-location-compare.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:x="http://www.jenitennison.com/xslt/xspec" version="2.0">

<!-- function x:schematron-location-compare
This function is used in Schematron tests to compare
an expected @location XPath in a test scenario with
a SVRL @location XPath in Schematron output.
If the Schematron uses XPath 1.0 the SVRL location XPath has all namespaced
elements use a wildcard namespace, so only the element name can be matched.
If XPath 1.0 is detected then namespace prefixes are removed from the comparison.
Parameters:
expect-location : @location from x:expect-assert or x:expect-report
svrl-location : @location from svrl:failed-assert or svrl:successful-report
namespaces : elements that contain namespace definitions in attributes @uri and @prefix
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<sch:ns uri="http://example.com/ns1" prefix="ex1"/>
-->
<xsl:function name="x:schematron-location-compare" as="xs:boolean">
<xsl:param name="expect-location" as="xs:string?"/>
<xsl:param name="svrl-location" as="xs:string?"/>
<xsl:param name="namespaces" as="element()*"/>
<xsl:variable name="svrl-expand1"
select="
x:schematron-location-expand-xpath1(
x:schematron-location-expand-attributes($svrl-location, $namespaces))"/>
<xsl:variable name="svrl-expand2" select="x:schematron-location-expand-xpath2($svrl-expand1, $namespaces)"/>
<xsl:variable name="expect-expand"
select="
x:schematron-location-expand-xpath1-expect(
x:schematron-location-expand-attributes($expect-location, $namespaces), $svrl-location, $namespaces)"/>
<!--xsl:variable name="expect-parts" select="tokenize($expect-expand, '/')[.]"/>
<xsl:variable name="svrl-parts" select="tokenize($svrl-expand2, '/')[.]"/-->
<xsl:sequence select="
($expect-location = $svrl-location) or
(replace($svrl-expand2, '^/|\[1\]', '') = replace($expect-expand, '^/|\[1\]', ''))
"/>
<!-- (: every $i in (1 to max((count($svrl-parts),count($expect-parts)))) satisfies
replace($expect-parts[$i], '\[1\]$', '') = replace($svrl-parts[$i], '\[1\]$', '') :) -->
</xsl:function>

<!-- function x:schematron-location-expand-xpath2
This function is used in Schematron tests to reformat XPath location attribute values
from the format Schematron produces for XPath 2.0 to human friendly XPath
using namespace prefixes defined in Schematron ns elements.
The XPath 2.0 format produced by Schematron is:
*:name[namespace-uri()='http://example.com/ns1']
-->
<xsl:function name="x:schematron-location-expand-xpath2" as="xs:string">
<xsl:param name="location" as="xs:string?"/>
<xsl:param name="namespaces" as="element()*"/>
<xsl:choose>
<xsl:when test="$namespaces">
<xsl:variable name="match"
select="concat('\*:([^\[]+)\[namespace\-uri\(\)=', codepoints-to-string(39), replace($namespaces[1]/@uri, '([\.\\\?\*\+\|\^\$\{\}\(\)\[\]])', '\\$1'), codepoints-to-string(39), '\]')"/>
<xsl:variable name="replace" select="concat($namespaces[1]/@prefix, ':$1')"/>
<xsl:value-of
select="x:schematron-location-expand-xpath2(replace($location, $match, $replace), subsequence($namespaces, 2))"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$location"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

<!-- function x:schematron-location-expand-xpath1
This function is used in Schematron tests to reformat XPath location attribute values
from the format Schematron produces for XPath 1.0 to human friendly XPath.
Namespace URIs are not available so effectively the XPath does not recognize namespaces.
The XPath 1.0 format produced by Schematron is:
*[local-name()='name']
-->
<xsl:function name="x:schematron-location-expand-xpath1" as="xs:string">
<xsl:param name="location" as="xs:string?"/>
<xsl:variable name="match"
select="concat('\*\[local-name\(\)=', codepoints-to-string(39), '([^', codepoints-to-string(39), ']+)', codepoints-to-string(39), '\]')"/>
<xsl:value-of select="replace($location, $match, '$1')"/>
</xsl:function>

<!-- function schematron-location-expand-xpath1-expect
-->
<xsl:function name="x:schematron-location-expand-xpath1-expect" as="xs:string">
<xsl:param name="expect-location" as="xs:string?"/>
<xsl:param name="svrl-location" as="xs:string?"/>
<xsl:param name="namespaces" as="element()*"/>
<xsl:value-of
select="
if ($namespaces and contains($svrl-location, '*[local-name()=')) then
replace($expect-location, concat('(', string-join(for $prefix in $namespaces/@prefix
return
concat($prefix, ':'), '|'), ')'), '')
else
$expect-location"
/>
</xsl:function>

<!-- function schematron-location-expand-attributes
This function reformats namespaced attribute nodes in XPath to use the
namespace prefix defined in the Schematron.
The XPath format produced by Schematron for XPath 1 and 2, which is also
produced by oXygen's Copy XPath function, is:
@*[namespace-uri()='http://example.com/ns2' and local-name()='type']
-->
<xsl:function name="x:schematron-location-expand-attributes" as="xs:string">
<xsl:param name="location" as="xs:string?"/>
<xsl:param name="namespaces" as="element()*"/>
<xsl:choose>
<xsl:when test="$namespaces">
<xsl:variable name="match"
select="concat('@\*\[namespace-uri\(\)=', codepoints-to-string(39), replace($namespaces[1]/@uri, '([\.\\\?\*\+\|\^\$\{\}\(\)\[\]])', '\\$1'), codepoints-to-string(39), ' and local-name\(\)=', codepoints-to-string(39), '([^', codepoints-to-string(39), ']+)', codepoints-to-string(39), '\]')"/>
<xsl:variable name="replace" select="concat('@', $namespaces[1]/@prefix, ':$1')"/>
<xsl:value-of
select="x:schematron-location-expand-attributes(replace($location, $match, $replace), subsequence($namespaces, 2))"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$location"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>


</xsl:stylesheet>
154 changes: 154 additions & 0 deletions src/schematron/schut-to-xspec.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:x="http://www.jenitennison.com/xslt/xspec"
exclude-result-prefixes="xs" version="2.0">

<xsl:param name="stylesheet" select="concat(x:description/@schematron, '.xsl')"/>
<xsl:param name="test_dir" select="'xspec'"/>


<xsl:variable name="error" select="('error', 'fatal')"/>
<xsl:variable name="warn" select="('warn', 'warning')"/>
<xsl:variable name="info" select="('info', 'information')"/>


<xsl:template match="@* | node()" priority="-2">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="x:description[@schematron]">
<xsl:element name="x:description">
<xsl:namespace name="svrl" select="'http://purl.oclc.org/dsdl/svrl'"/>
<xsl:apply-templates select="@*[not(name() = ('stylesheet'))]"/>
<xsl:element name="x:scenario">
<xsl:attribute name="label">
<xsl:text>Schematron: "</xsl:text>
<xsl:value-of select="@schematron"/>
<xsl:text>"</xsl:text>
<xsl:if test="x:param[@name='phase']">
<xsl:value-of select="concat(' phase: ', x:param[@name='phase'][1]/(@select,string())[1])"/>
</xsl:if>
</xsl:attribute>
</xsl:element>
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>

<xsl:template match="@schematron">
<xsl:attribute name="stylesheet" select="$stylesheet"/>
<xsl:variable name="path" select="iri-to-uri(concat(replace(document-uri(/), '(.*)/.*$', '$1'), '/', string()))"/>
<xsl:for-each select="doc($path)/sch:schema/sch:ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
<xsl:namespace name="{./@prefix}" select="./@uri"/>
</xsl:for-each>
</xsl:template>

<xsl:template match="x:import">
<xsl:variable name="href" select="iri-to-uri(concat(replace(document-uri(/), '(.*)/.*$', '$1'), '/', @href))"/>
<xsl:choose>
<xsl:when test="doc($href)//*[
self::x:expect-assert | self::x:expect-not-assert |
self::x:expect-report | self::x:expect-not-report |
self::x:expect-valid | self::x:description[@schematron] ]">
<xsl:comment>BEGIN IMPORT "<xsl:value-of select="@href"/>"</xsl:comment>
<xsl:apply-templates select="doc($href)/x:description/node()"/>
<xsl:comment>END IMPORT "<xsl:value-of select="@href"/>"</xsl:comment>
</xsl:when>
<xsl:otherwise>
<xsl:next-match/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="x:context[not(@href)][
parent::*/x:expect-assert | parent::*/x:expect-not-assert |
parent::*/x:expect-report | parent::*/x:expect-not-report |
parent::*/x:expect-valid | ancestor::x:description[@schematron] ]">
<xsl:variable name="file" select="concat($test_dir, '/', 'context-', generate-id(), '.xml')"/>
<xsl:result-document href="{$file}">
<xsl:copy-of select="./node()"/>
</xsl:result-document>
<xsl:element name="x:context">
<xsl:attribute name="href" select="$file"/>
</xsl:element>
</xsl:template>

<xsl:template match="x:expect-assert">
<xsl:element name="x:expect">
<xsl:call-template name="make-label"/>
<xsl:attribute name="test">
<xsl:sequence select="'exists(svrl:schematron-output/svrl:failed-assert'"/>
<xsl:apply-templates select="@*" mode="make-predicate"/>
<xsl:sequence select="')'"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

<xsl:template match="x:expect-not-assert">
<xsl:element name="x:expect">
<xsl:call-template name="make-label"/>
<xsl:attribute name="test">
<xsl:sequence select="'boolean(svrl:schematron-output[svrl:fired-rule]) and empty(svrl:schematron-output/svrl:failed-assert'"/>
<xsl:apply-templates select="@*" mode="make-predicate"/>
<xsl:sequence select="')'"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

<xsl:template match="x:expect-report">
<xsl:element name="x:expect">
<xsl:call-template name="make-label"/>
<xsl:attribute name="test">
<xsl:sequence select="'exists(svrl:schematron-output/svrl:successful-report'"/>
<xsl:apply-templates select="@*" mode="make-predicate"/>
<xsl:sequence select="')'"/>
</xsl:attribute>
</xsl:element>
</xsl:template>


<xsl:template match="x:expect-not-report">
<xsl:element name="x:expect">
<xsl:call-template name="make-label"/>
<xsl:attribute name="test">
<xsl:sequence select="'boolean(svrl:schematron-output[svrl:fired-rule]) and empty(svrl:schematron-output/svrl:successful-report'"/>
<xsl:apply-templates select="@*" mode="make-predicate"/>
<xsl:sequence select="')'"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

<xsl:template match="@location" mode="make-predicate">
<xsl:variable name="escaped" select="if (not(contains(., codepoints-to-string(39)))) then
concat(codepoints-to-string(39), ., codepoints-to-string(39)) else
concat('concat(', codepoints-to-string(39), replace(., codepoints-to-string(39), concat(codepoints-to-string(39), ', codepoints-to-string(39), ', codepoints-to-string(39))), codepoints-to-string(39), ')')"/>
<xsl:sequence select="concat('[x:schematron-location-compare(', $escaped, ', @location, preceding-sibling::svrl:ns-prefix-in-attribute-values)]')"/>
</xsl:template>

<xsl:template match="@id | @role" mode="make-predicate">
<xsl:sequence select="concat('[(@', local-name(.),
', preceding-sibling::svrl:fired-rule[1]/@',local-name(.),
')[1] = ', codepoints-to-string(39), ., codepoints-to-string(39), ']')"/>
</xsl:template>

<xsl:template name="make-label">
<xsl:attribute name="label" select="string-join((tokenize(local-name(),'-')[.=('report','assert','not')], @id, @role, @location), ' ')"/>
</xsl:template>

<xsl:template match="x:expect-valid">
<xsl:element name="x:expect">
<xsl:attribute name="label" select="'valid'"/>
<xsl:attribute name="test" select="concat(
'boolean(svrl:schematron-output[svrl:fired-rule]) and
not(boolean((svrl:schematron-output/svrl:failed-assert union svrl:schematron-output/svrl:successful-report)[
not(@role) or @role = (',
string-join(for $e in $error return concat(codepoints-to-string(39), $e, codepoints-to-string(39)), ','),
')]))'
)"/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>
18 changes: 16 additions & 2 deletions test/run-xspec-tests.cmd
Original file line number Diff line number Diff line change
@@ -39,12 +39,17 @@ for %%I in (*.xspec) do (
rem
rem Run
rem
"%COMSPEC%" /c ..\bin\xspec.bat "%%~I" > "%RESULT_FILE%" 2>&1
call :is_schematron "%%~nI"
if errorlevel 1 (
"%COMSPEC%" /c ..\bin\xspec.bat -s "%%~I" > "%RESULT_FILE%" 2>&1
) else (
"%COMSPEC%" /c ..\bin\xspec.bat "%%~I" > "%RESULT_FILE%" 2>&1
)

rem
rem Inspect result
rem
( findstr /r /c:".*failed: [1-9]" "%RESULT_FILE%" || findstr /r /c:"\*\** Error [a-z][a-z]*ing the test suite" "%RESULT_FILE%" ) > NUL
( findstr /r /c:".*failed: [1-9]" "%RESULT_FILE%" || findstr /r /c:"\*\** Error [a-z][a-z]*ing the test suite" "%RESULT_FILE%" || findstr /r /c:"\*\** Error .*Schematron" "%RESULT_FILE%" ) > NUL
if not errorlevel 1 (
echo FAILED: %%~I
echo ---------- "%RESULT_FILE%"
@@ -67,3 +72,12 @@ rem
rem Exit as success
rem
exit /b 0

:is_schematron
set var=%~1
if "%var:~0,10%"=="schematron" (
set IS_SCHEMATRON=1
) else (
set IS_SCHEMATRON=0
)
exit /b %IS_SCHEMATRON%
11 changes: 8 additions & 3 deletions test/run-xspec-tests.sh
Original file line number Diff line number Diff line change
@@ -23,9 +23,14 @@
# LICENSE: MIT License
#
#===============================================================================
for xspectest in *.xspec;
do ../bin/xspec.sh $xspectest &> result.log;
if grep -q ".*failed:\s[1-9]" result.log || grep -q -E "\*+\sError\s(running|compiling)\sthe\stest\ssuite" result.log;
for xspectest in *.xspec
do
if test "${xspectest:0:10}" = "schematron"; then
../bin/xspec.sh -s $xspectest &> result.log;
else
../bin/xspec.sh $xspectest &> result.log;
fi
if grep -q ".*failed:\s[1-9]" result.log || grep -q -E "\*+\sError\s(.*Schematron.*|(running|compiling)\sthe\stest\ssuite)" result.log;
then
echo "FAILED: $xspectest";
echo "---------- result.log";
179 changes: 179 additions & 0 deletions test/sch-location-compare.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="../src/schematron/sch-location-compare.xsl">

<x:scenario label="schematron-location-compare" xmlns:svrl="http://purl.oclc.org/dsdl/svrl">

<x:scenario label="expand xpath2 svrl">
<x:scenario label="replace namespace uri with prefix (e.g. 2 namespaces 4 elements)">
<x:call function="x:schematron-location-expand-xpath2">
<x:param name="location" select="failed-assert/@location">
<failed-assert location="/root[1]/*:sec[namespace-uri()='http://example.com/ns1'][2]/*:para[namespace-uri()='http://example.com/ns2'][2]/*:para[namespace-uri()='http://example.com/ns2'][3]"/>
</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="namespace prefixes applied" select="'/root[1]/ex1:sec[2]/ex2:para[2]/ex2:para[3]'"/>
</x:scenario>
</x:scenario>

<x:scenario label="expand xpath1 svrl">
<x:scenario label="remove wildcard namespace (e.g. 3 elements)">
<x:call function="x:schematron-location-expand-xpath1">
<x:param name="location" select="successful-report/@location">
<successful-report location="/root/*[local-name()='sec'][2]/*[local-name()='para'][2]"/>
</x:param>
</x:call>
<x:expect label="namespace wildcard removed" select="'/root/sec[2]/para[2]'"/>
</x:scenario>
</x:scenario>

<x:scenario label="expand xpath1 expect">
<x:scenario label="if no xpath1 style namespace in path return same">
<x:call function="x:schematron-location-expand-xpath1-expect">
<x:param name="expect-location">/ex1:section</x:param>
<x:param name="svrl-location">/section[1]</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
</x:param>
</x:call>
<x:expect label="same" select="'/ex1:section'"/>
</x:scenario>
<x:scenario label="if xpath1 style namespace in path remove prefixes">
<x:call function="x:schematron-location-expand-xpath1-expect">
<x:param name="expect-location">/root/ex1:sec/ex1:sec/ex2:para</x:param>
<x:param name="svrl-location">/root/*[local-name()='sec'][2]/*[local-name()='sec'][2]/*[local-name()='para'][2]</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="namespace prefixes removed" select="'/root/sec/sec/para'"/>
</x:scenario>
</x:scenario>

<x:scenario label="expand attributes">
<x:call function="x:schematron-location-expand-attributes">
<x:param name="location">@*[namespace-uri()='http://example.com/ns2' and local-name()='type']</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="namespace prefix applied" select="'@ex2:type'"/>
</x:scenario>

<x:scenario label="compare">

<x:scenario label="match exact">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/article[1]/section[2]</x:param>
<x:param name="svrl-location">/article[1]/section[2]</x:param>
<x:param name="namespaces"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>

<x:scenario label="match ignoring [1]">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/article/section[2]</x:param>
<x:param name="svrl-location">/article[1]/section[2]</x:param>
<x:param name="namespaces"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>

<x:scenario label="match ignoring leading /">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">article[1]/section[2]</x:param>
<x:param name="svrl-location">/article[1]/section[2]</x:param>
<x:param name="namespaces"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>

<x:scenario label="match with namespaces xpath1">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/root/ex1:sec[2]/ex2:para[2]</x:param>
<x:param name="svrl-location">/root/*[local-name()='sec'][2]/*[local-name()='para'][2]</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>

<x:scenario label="match with namespaces xpath2">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/root/ex1:sec[2]/ex2:para[2]</x:param>
<x:param name="svrl-location">/root[1]/*:sec[namespace-uri()='http://example.com/ns1'][2]/*:para[namespace-uri()='http://example.com/ns2'][2]</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>

<x:scenario label="match with attribute (note: outside of oXygen, Schematron does not appear to fire on rules that have an attribute node as context)">
<x:scenario label="not in namespace">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/article/section[1]/@type</x:param>
<x:param name="svrl-location">/article[1]/section[1]/@type</x:param>
<x:param name="namespaces"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="in namespace">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/ex1:article[1]/ex1:sec[2]/@ex2:type</x:param>
<x:param name="svrl-location">/*:article[namespace-uri()='http://example.com/ns1'][1]/*:sec[namespace-uri()='http://example.com/ns1'][2]/@*[namespace-uri()='http://example.com/ns2' and local-name()='type']</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
</x:scenario>

<x:scenario label="not match">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/root/body/div/para</x:param>
<x:param name="svrl-location">/root[1]/div[1]/para[1]</x:param>
<x:param name="namespaces"/>
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>

<x:scenario label="not match with namespaces xpath1">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/root/ex1:sec[2]/ex2:para</x:param>
<x:param name="svrl-location">/root/*[local-name()='sec'][2]</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>

<x:scenario label="not match with namespaces xpath2">
<x:call function="x:schematron-location-compare">
<x:param name="expect-location">/root/ex1:sec[2]/ex1:sec[1]/ex2:para[2]</x:param>
<x:param name="svrl-location">/root[1]/*:sec[namespace-uri()='http://example.com/ns1'][2]/*:para[namespace-uri()='http://example.com/ns2'][2]</x:param>
<x:param name="namespaces">
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns2" prefix="ex2"/>
</x:param>
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>

</x:scenario>

</x:scenario>

</x:description>
17 changes: 17 additions & 0 deletions test/schematron-01.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">

<sch:pattern>
<sch:rule context="article">
<sch:assert test="title" id="a001">
article should have a title
</sch:assert>
</sch:rule>
<sch:rule context="section">
<sch:assert test="title" id="a002">
section should have a title
</sch:assert>
</sch:rule>
</sch:pattern>

</sch:schema>
14 changes: 14 additions & 0 deletions test/schematron-01.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<article>
<title>Example</title>
<section>
<title>Introduction</title>
<p>Welcome to demo 3!</p>
</section>
<section>
<p>This is an example.</p>
</section>
<section>
<p>Scenario excpect's can specify a location in the context XML that an assert or report is expected to identify.</p>
</section>
</article>
14 changes: 14 additions & 0 deletions test/schematron-01.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schematron-01.sch">
<x:scenario label="schematron-01">
<x:context href="schematron-01.xml"/>
<x:scenario label="article should have a title">
<x:expect-not-assert id="a001"/>
</x:scenario>
<x:scenario label="section should have a title">
<x:expect-assert id="a002" location="/article[1]/section[2]"/>
<x:expect-assert id="a002" location="/article[1]/section[3]"/>
</x:scenario>
</x:scenario>
</x:description>
77 changes: 77 additions & 0 deletions test/schematron-012.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-012.sch">
<x:scenario label="expect-valid">
<x:context href="schematron/schut-to-xspec-012-01.xml"/>
<x:expect-valid/>
</x:scenario>
<x:scenario label="assertions">
<x:scenario label="without attributes">
<x:scenario label="not thrown">
<x:context href="schematron/schut-to-xspec-012-01.xml"/>
<x:expect-not-assert/>
<x:expect-not-report/>
</x:scenario>
<x:scenario label="thrown">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert/>
<x:expect-report/>
</x:scenario>
</x:scenario>
<x:scenario label="with id">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert id="a1"/>
<x:expect-not-assert id="a2"/>
<x:expect-report id="r1"/>
<x:expect-not-report id="r2"/>
</x:scenario>
<x:scenario label="with role">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert role="warn"/>
<x:expect-not-assert role="fatal"/>
<x:expect-report role="warn"/>
<x:expect-not-report role="info"/>
</x:scenario>
<x:scenario label="with location">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert location="/article[1]/div[1]"/>
<x:expect-not-assert location="/article[1]/div[2]"/>
<x:expect-report location="/article[1]/div[3]"/>
<x:expect-not-report location="/article[1]/div[4]"/>
</x:scenario>
<x:scenario label="with id, location">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert id="a1" location="/article[1]/div[1]"/>
<x:expect-not-assert id="a2" location="/article[1]/div[2]"/>
<x:expect-report id="r1" location="/article[1]/div[3]"/>
<x:expect-not-report id="r2" location="/article[1]/div[4]"/>
</x:scenario>
<x:scenario label="with id, role, location">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert id="a1" role="warn" location="/article[1]/div[1]"/>
<x:expect-not-assert id="a2" role="error" location="/article[1]/div[2]"/>
<x:expect-report id="r1" role="warn" location="/article[1]/div[3]"/>
<x:expect-not-report id="r2" role="info" location="/article[1]/div[4]"/>
</x:scenario>
</x:scenario>
<x:scenario label="inherrit from rule">
<x:scenario label="id and role from rule">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert id="ru1" role="error"/>
</x:scenario>
<x:scenario label="id from rule and role from assertion">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert id="ru1" role="warn"/>
</x:scenario>
<x:scenario label="role from rule and id from assertion">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-assert id="ru2" role="error"/>
</x:scenario>
<x:scenario label="match only current rule">
<x:context href="schematron/schut-to-xspec-012-02.xml"/>
<x:expect-not-assert id="ru3"/>
<x:expect-not-assert id="ru3" role="warn"/>
<x:expect-report id="ru3" role="warn" location="/article[1]"/>
</x:scenario>
</x:scenario>
</x:description>
10 changes: 10 additions & 0 deletions test/schematron-014-01.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:ex1="http://example.com/ns1" xmlns:ex2="http://example.com/ns2">
<ex1:sec/>
<ex1:sec>
<ex2:para/>
<ex2:para>
<ex2:para/>
</ex2:para>
</ex1:sec>
</root>
16 changes: 16 additions & 0 deletions test/schematron-014.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">

<sch:ns uri="http://example.com/ns1" prefix="ex1"/>
<sch:ns uri="http://example.com/ns2" prefix="ex2"/>

<sch:pattern>
<sch:rule context="ex1:sec">
<sch:assert test="ex2:para" id="e001">sec should contain para</sch:assert>
</sch:rule>
<sch:rule context="ex2:para">
<sch:report test="ex2:para" id="e002">para should not contain another para</sch:report>
</sch:rule>
</sch:pattern>

</sch:schema>
11 changes: 11 additions & 0 deletions test/schematron-014.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schematron-014.sch">

<x:scenario label="01">
<x:context href="schematron-014-01.xml"/>
<x:expect-assert id="e001" location="/root[1]/ex1:sec[1]"/>
<x:expect-report id="e002" location="/root[1]/ex1:sec[2]/ex2:para[2]"/>
</x:scenario>

</x:description>
16 changes: 16 additions & 0 deletions test/schematron-015.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt">

<sch:ns uri="http://example.com/ns1" prefix="ex1"/>
<sch:ns uri="http://example.com/ns2" prefix="ex2"/>

<sch:pattern>
<sch:rule context="ex1:sec">
<sch:assert test="ex2:para" id="e001">sec should contain para</sch:assert>
</sch:rule>
<sch:rule context="ex2:para">
<sch:report test="ex2:para" id="e002">para should not contain another para</sch:report>
</sch:rule>
</sch:pattern>

</sch:schema>
11 changes: 11 additions & 0 deletions test/schematron-015.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schematron-015.sch">

<x:scenario label="01">
<x:context href="schematron-014-01.xml"/>
<x:expect-assert id="e001" location="/root[1]/ex1:sec[1]"/>
<x:expect-report id="e002" location="/root[1]/ex1:sec[2]/ex2:para[2]"/>
</x:scenario>

</x:description>
50 changes: 50 additions & 0 deletions test/schematron-param-001.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schematron/schut-to-xspec-test.sch">
<x:param name="phase">P1</x:param>
<x:param name="selected" select="codepoints-to-string((80,49))"/>
<!--x:param name="escape1">AAA BBB CCC</x:param-->
<!--x:param name="escape2">a"b</x:param-->
<!--x:param name="escape3">a'b</x:param-->
<!--x:param name="escape4">A ' " B</x:param-->
<x:scenario label="Schematron phase/parameters are passed to Schematron compile"/>
<!--
With xspec.bat:
All of the above examples work properly with xspec.bat.
Have not been able to make them all work in xspec-bat.cmd test.
With xspec.sh:
With xspec.sh escaping spaces (escape1, escape4) is not working.
Have not been able to make them all work in xspec.bats test.
Tested manually by modifying iso_svrl_for_xslt2.xsl to add inside xsl:stylesheet:
<xsl:param name="selected"/>
<xsl:param name="escape1"/>
<xsl:param name="escape2"/>
<xsl:param name="escape3"/>
<xsl:param name="escape4"/>
And inside <xsl:template name="process-root">
<xsl:message>
Phase
<xsl:value-of select="$phase"/>
Selected
<xsl:value-of select="$selected"/>
Escape1
<xsl:value-of select="$escape1"/>
Escape2
<xsl:value-of select="$escape2"/>
Escape3
<xsl:value-of select="$escape3"/>
Escape4
<xsl:value-of select="$escape4"/>
</xsl:message>
Then running:
bin\xspec.bat -s test\schematron\param-001.xspec
bin\xspec.sh -s test\schematron\param-001.xspec
-->
</x:description>
5 changes: 5 additions & 0 deletions test/schematron/schut-to-xspec-001-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="Schematron test scenario"/>
</x:description>
7 changes: 7 additions & 0 deletions test/schematron/schut-to-xspec-001-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="Schematron test scenario"/>
</x:description>
5 changes: 5 additions & 0 deletions test/schematron/schut-to-xspec-002-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-002.sch">
<x:scenario label="Schematron test scenario"/>
</x:description>
7 changes: 7 additions & 0 deletions test/schematron/schut-to-xspec-002-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
xmlns:xlink="http://www.w3.org/1999/xlink" stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-002.sch&#34;"/>
<x:scenario label="Schematron test scenario"/>
</x:description>
4 changes: 4 additions & 0 deletions test/schematron/schut-to-xspec-002.sch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<sch:ns uri="http://www.w3.org/1999/xlink" prefix="xlink"/>
</sch:schema>
7 changes: 7 additions & 0 deletions test/schematron/schut-to-xspec-003-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="Schematron test scenario">
<x:scenario label="nested"></x:scenario>
</x:scenario>
</x:description>
9 changes: 9 additions & 0 deletions test/schematron/schut-to-xspec-003-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="Schematron test scenario">
<x:scenario label="nested"></x:scenario>
</x:scenario>
</x:description>
20 changes: 20 additions & 0 deletions test/schematron/schut-to-xspec-004-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="Schematron test scenario">
<x:scenario label="pending via attribute" pending="test"></x:scenario>
</x:scenario>
<x:pending>
<x:scenario label="pending via element"></x:scenario>
</x:pending>
<x:scenario label="pending nested scenario">
<x:pending>
<x:scenario label="nested"></x:scenario>
</x:pending>
</x:scenario>
<x:scenario label="pending assertions">
<x:pending>
<x:expect-assert/>
</x:pending>
</x:scenario>
</x:description>
22 changes: 22 additions & 0 deletions test/schematron/schut-to-xspec-004-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="Schematron test scenario">
<x:scenario label="pending via attribute" pending="test"></x:scenario>
</x:scenario>
<x:pending>
<x:scenario label="pending via element"></x:scenario>
</x:pending>
<x:scenario label="pending nested scenario">
<x:pending>
<x:scenario label="nested"></x:scenario>
</x:pending>
</x:scenario>
<x:scenario label="pending assertions">
<x:pending>
<x:expect label="assert" test="exists(svrl:schematron-output/svrl:failed-assert)"/>
</x:pending>
</x:scenario>
</x:description>
6 changes: 6 additions & 0 deletions test/schematron/schut-to-xspec-005-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="Schematron test scenario"/>
<x:scenario label="focused" focus="test"/>
</x:description>
8 changes: 8 additions & 0 deletions test/schematron/schut-to-xspec-005-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="Schematron test scenario"/>
<x:scenario label="focused" focus="test"/>
</x:description>
11 changes: 11 additions & 0 deletions test/schematron/schut-to-xspec-006-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="s1" shared="yes">
<x:context href="schut-to-xspec-test.sch"/>
</x:scenario>
<x:scenario label="s2">
<x:like label="s1"/>
<x:expect-assert/>
</x:scenario>
</x:description>
13 changes: 13 additions & 0 deletions test/schematron/schut-to-xspec-006-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="s1" shared="yes">
<x:context href="schut-to-xspec-test.sch"/>
</x:scenario>
<x:scenario label="s2">
<x:like label="s1"/>
<x:expect label="assert" test="exists(svrl:schematron-output/svrl:failed-assert)"/>
</x:scenario>
</x:description>
7 changes: 7 additions & 0 deletions test/schematron/schut-to-xspec-007-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="Schematron test scenario">
<x:context href="schut-to-xspec-007.xml"/>
</x:scenario>
</x:description>
9 changes: 9 additions & 0 deletions test/schematron/schut-to-xspec-007-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="Schematron test scenario">
<x:context href="schut-to-xspec-007.xml"/>
</x:scenario>
</x:description>
2 changes: 2 additions & 0 deletions test/schematron/schut-to-xspec-007.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<document/>
9 changes: 9 additions & 0 deletions test/schematron/schut-to-xspec-008-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="Schematron test scenario">
<x:context>
<snippet/>
</x:context>
</x:scenario>
</x:description>
9 changes: 9 additions & 0 deletions test/schematron/schut-to-xspec-008-out.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
stylesheet="schut-to-xspec-test.sch.xsl">
<x:scenario label="Schematron: &#34;schut-to-xspec-test.sch&#34;"/>
<x:scenario label="Schematron test scenario">
<x:context href="xspec/context-d1e6.xml"/>
</x:scenario>
</x:description>
5 changes: 5 additions & 0 deletions test/schematron/schut-to-xspec-009-import-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:scenario label="B"/>
</x:description>
6 changes: 6 additions & 0 deletions test/schematron/schut-to-xspec-009-in.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="schut-to-xspec-test.sch">
<x:import href="schut-to-xspec-009-import-in.xspec"/>
<x:scenario label="A"/>
</x:description>
Loading