simple-xspec-wrapper 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/xspec +16 -0
- data/lib/xspec/version.rb +3 -0
- data/lib/xspec.rb +256 -0
- data/simple-xspec-wrapper.gemspec +28 -0
- data/spec-test.xml +1125 -0
- data/vendor/xspec-1.0.0/.gitignore +7 -0
- data/vendor/xspec-1.0.0/.travis.yml +57 -0
- data/vendor/xspec-1.0.0/LICENSE +21 -0
- data/vendor/xspec-1.0.0/README.md +26 -0
- data/vendor/xspec-1.0.0/appveyor.yml +77 -0
- data/vendor/xspec-1.0.0/bin/xspec.bat +620 -0
- data/vendor/xspec-1.0.0/bin/xspec.sh +403 -0
- data/vendor/xspec-1.0.0/build.xml +369 -0
- data/vendor/xspec-1.0.0/editors/emacs/README +31 -0
- data/vendor/xspec-1.0.0/editors/emacs/schemas.xml +6 -0
- data/vendor/xspec-1.0.0/editors/oxygen/.cvsignore +2 -0
- data/vendor/xspec-1.0.0/editors/oxygen/README +11 -0
- data/vendor/xspec-1.0.0/editors/oxygen/build.xml +38 -0
- data/vendor/xspec-1.0.0/editors/oxygen/templates/xspec.xml +17 -0
- data/vendor/xspec-1.0.0/editors/oxygen/xspec.framework +175 -0
- data/vendor/xspec-1.0.0/find-examples.xml +37 -0
- data/vendor/xspec-1.0.0/find-examples.xsl +615 -0
- data/vendor/xspec-1.0.0/graphics/3angle-down.gif +0 -0
- data/vendor/xspec-1.0.0/graphics/3angle-right.gif +0 -0
- data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class +0 -0
- data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java +209 -0
- data/vendor/xspec-1.0.0/src/ant/find-test-failure.xsl +17 -0
- data/vendor/xspec-1.0.0/src/ant/get-schematron-phase.xsl +17 -0
- data/vendor/xspec-1.0.0/src/ant/locate-schematron.xsl +28 -0
- data/vendor/xspec-1.0.0/src/ant/make-path.js +4 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-common-tests.xsl +604 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-helper.xsl +152 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-tests.xsl +473 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-utils.xql +263 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-tests-helper.xsl +169 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-tests-utils.xsl +479 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-xspec-tests.xsl +503 -0
- data/vendor/xspec-1.0.0/src/harnesses/basex/basex-standalone-xquery-harness.xproc +135 -0
- data/vendor/xspec-1.0.0/src/harnesses/basex/basex-xquery-harness.xproc +133 -0
- data/vendor/xspec-1.0.0/src/harnesses/exist/exist-xquery-harness.xproc +161 -0
- data/vendor/xspec-1.0.0/src/harnesses/harness-lib.xpl +327 -0
- data/vendor/xspec-1.0.0/src/harnesses/marklogic/ml-xquery-harness.xproc +143 -0
- data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xquery-harness.xproc +108 -0
- data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xslt-harness.xproc +85 -0
- data/vendor/xspec-1.0.0/src/harnesses/zorba/zorba-xquery-harness.xproc +134 -0
- data/vendor/xspec-1.0.0/src/reporter/coverage-report.xsl +378 -0
- data/vendor/xspec-1.0.0/src/reporter/format-utils.xsl +220 -0
- data/vendor/xspec-1.0.0/src/reporter/format-xspec-report-folding.xsl +164 -0
- data/vendor/xspec-1.0.0/src/reporter/format-xspec-report.xsl +410 -0
- data/vendor/xspec-1.0.0/src/reporter/junit-report.xsl +93 -0
- data/vendor/xspec-1.0.0/src/reporter/test-report.css +469 -0
- data/vendor/xspec-1.0.0/src/schemas/find-examples.rnc +90 -0
- data/vendor/xspec-1.0.0/src/schemas/xspec.rnc +304 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_abstract_expand.xsl +313 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_dsdl_include.xsl +1519 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message.xsl +64 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message_xslt2.xsl +64 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_saxon.xsl +2306 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl +1851 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt1.xsl +614 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl +692 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/readme.txt +101 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-cs.xhtml +56 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-de.xhtml +55 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-en.xhtml +57 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-fr.xhtml +54 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-ja.xhtml +53 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-nl.xhtml +58 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/schematron-skeleton-api.htm +723 -0
- data/vendor/xspec-1.0.0/src/schematron/sch-location-compare.xsl +139 -0
- data/vendor/xspec-1.0.0/src/schematron/schut-to-xspec.xsl +179 -0
- data/vendor/xspec-1.0.0/test/Makefile +117 -0
- data/vendor/xspec-1.0.0/test/README +5 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_catalog.xml +4 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_schematron.xspec +6 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_xslt.xspec +5 -0
- data/vendor/xspec-1.0.0/test/end-to-end/README.md +42 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/.gitignore +1 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/.gitignore +3 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-50-result-norm.html +74 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-55-result-norm.html +112 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-focus-1-result-norm.html +109 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-function-result-norm.html +118 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-import-result-norm.html +163 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-imported-result-norm.html +95 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-pending-result-norm.html +123 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-rule-result-norm.html +109 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-three-dots-result-norm.html +1237 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xsl +7 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xspec +10 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xsl +2 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xspec +18 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-focus-1.xspec +71 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-function.xspec +50 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-import.xspec +50 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-imported.xspec +48 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-pending.xspec +89 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-rule.xspec +76 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xsl +49 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xspec +527 -0
- data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.cmd +51 -0
- data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.sh +25 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_deserializer.xsl +53 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_normalizer.xsl +192 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_serializer.xsl +15 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_util.xsl +35 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/compare.xsl +88 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/normalize.xsl +28 -0
- data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.cmd +61 -0
- data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.sh +28 -0
- data/vendor/xspec-1.0.0/test/generate-tests-utils.xspec +636 -0
- data/vendor/xspec-1.0.0/test/generate-x-utils.xspec +173 -0
- data/vendor/xspec-1.0.0/test/generate-xspec-tests.xspec +64 -0
- data/vendor/xspec-1.0.0/test/run-xspec-tests.cmd +83 -0
- data/vendor/xspec-1.0.0/test/run-xspec-tests.sh +42 -0
- data/vendor/xspec-1.0.0/test/sch-location-compare.xspec +179 -0
- data/vendor/xspec-1.0.0/test/schematron/data/standards.xml +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-017.sch +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-018.sch +17 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-019.sch +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-020-01.sch +35 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-020.sch +32 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-021.sch +28 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-022.sch +18 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-compile.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-expand.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-include.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-out.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-out.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002.sch +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-in.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-in.xspec +20 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-out.xspec +22 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-in.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-out.xspec +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-in.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007.xml +2 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-in.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-import-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-out.xspec +10 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-import.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-01.xml +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-02.xml +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-out.xspec +81 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch.xsl +4 -0
- data/vendor/xspec-1.0.0/test/schematron-01.sch +17 -0
- data/vendor/xspec-1.0.0/test/schematron-01.xml +14 -0
- data/vendor/xspec-1.0.0/test/schematron-01.xspec +14 -0
- data/vendor/xspec-1.0.0/test/schematron-012.xspec +83 -0
- data/vendor/xspec-1.0.0/test/schematron-014-01.xml +10 -0
- data/vendor/xspec-1.0.0/test/schematron-014.sch +16 -0
- data/vendor/xspec-1.0.0/test/schematron-014.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron-015.sch +16 -0
- data/vendor/xspec-1.0.0/test/schematron-015.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron-016.sch +19 -0
- data/vendor/xspec-1.0.0/test/schematron-016.xspec +171 -0
- data/vendor/xspec-1.0.0/test/schematron-017.xspec +26 -0
- data/vendor/xspec-1.0.0/test/schematron-018.xspec +120 -0
- data/vendor/xspec-1.0.0/test/schematron-019.xspec +16 -0
- data/vendor/xspec-1.0.0/test/schematron-020.xspec +53 -0
- data/vendor/xspec-1.0.0/test/schematron-021.xspec +27 -0
- data/vendor/xspec-1.0.0/test/schematron-022.xspec +15 -0
- data/vendor/xspec-1.0.0/test/schematron-param-001.xspec +50 -0
- data/vendor/xspec-1.0.0/test/schut-to-xspec-012.sch +27 -0
- data/vendor/xspec-1.0.0/test/schut-to-xspec.xspec +85 -0
- data/vendor/xspec-1.0.0/test/unit-expect-xsl.xspec +28 -0
- data/vendor/xspec-1.0.0/test/xspec-26.xsl +19 -0
- data/vendor/xspec-1.0.0/test/xspec-26.xspec +17 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xml +2 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xsl +6 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xspec +8 -0
- data/vendor/xspec-1.0.0/test/xspec-33.xsl +7 -0
- data/vendor/xspec-1.0.0/test/xspec-33.xspec +15 -0
- data/vendor/xspec-1.0.0/test/xspec-46.xsl +7 -0
- data/vendor/xspec-1.0.0/test/xspec-46.xspec +9 -0
- data/vendor/xspec-1.0.0/test/xspec-72.xsl +13 -0
- data/vendor/xspec-1.0.0/test/xspec-72.xspec +19 -0
- data/vendor/xspec-1.0.0/test/xspec-bat.cmd +757 -0
- data/vendor/xspec-1.0.0/test/xspec-focus-2.xspec +91 -0
- data/vendor/xspec-1.0.0/test/xspec-junit.xspec +78 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xml +1003 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xslt +10 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xspec +13 -0
- data/vendor/xspec-1.0.0/test/xspec-tested.xql +44 -0
- data/vendor/xspec-1.0.0/test/xspec-tested.xsl +64 -0
- data/vendor/xspec-1.0.0/test/xspec-variable.xml +3 -0
- data/vendor/xspec-1.0.0/test/xspec-variable.xspec +58 -0
- data/vendor/xspec-1.0.0/test/xspec-xslt3.xsl +13 -0
- data/vendor/xspec-1.0.0/test/xspec-xslt3.xspec +12 -0
- data/vendor/xspec-1.0.0/test/xspec.bats +420 -0
- data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xslt +40 -0
- data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xspec +75 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.sch +17 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xml +11 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xspec +14 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseA.xspec +11 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseB.xspec +12 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import1.xspec +10 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import2.xspec +8 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import3.xspec +10 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.sch +58 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.xml +19 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc1.xml +6 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc2.xml +7 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.sch +29 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.xspec +63 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.sch +20 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.xspec +33 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/quickfix.sch +81 -0
- data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xq +8 -0
- data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xspec +16 -0
- data/vendor/xspec-1.0.0/xproject/project.xml +8 -0
- data/vendor/xspec-1.0.0/xproject/release-project.xsl +41 -0
- metadata +341 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
+
xmlns:functx="http://www.functx.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
4
|
+
exclude-result-prefixes="xs" version="2.0">
|
5
|
+
|
6
|
+
<!-- The functx:escape-for-regex function escapes a string that you wish to be taken
|
7
|
+
literally rather than treated like a regular expression. This is useful when,
|
8
|
+
for example, you are calling the built-in fn:replace function and you want any
|
9
|
+
periods or parentheses to be treated like literal characters rather than regex
|
10
|
+
special characters.
|
11
|
+
From: http://www.xsltfunctions.com/xsl/functx_escape-for-regex.html
|
12
|
+
-->
|
13
|
+
<xsl:function name="functx:escape-for-regex" as="xs:string">
|
14
|
+
<xsl:param name="arg" as="xs:string?"/>
|
15
|
+
|
16
|
+
<xsl:sequence
|
17
|
+
select="
|
18
|
+
replace($arg,
|
19
|
+
'(\.|\[|\]|\\|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1')
|
20
|
+
"
|
21
|
+
/>
|
22
|
+
</xsl:function>
|
23
|
+
|
24
|
+
|
25
|
+
<!-- Escape regexes in a list of phrases -->
|
26
|
+
|
27
|
+
<xsl:template match="phrases">
|
28
|
+
<phrases>
|
29
|
+
<xsl:apply-templates select="phrase"/>
|
30
|
+
</phrases>
|
31
|
+
</xsl:template>
|
32
|
+
|
33
|
+
<xsl:template match="phrase">
|
34
|
+
<xsl:variable name="escaped-text" select="functx:escape-for-regex(.)"/>
|
35
|
+
<phrase status="{if (. = $escaped-text) then 'changed' else 'same'}">
|
36
|
+
<xsl:value-of select="functx:escape-for-regex(.)"/>
|
37
|
+
</phrase>
|
38
|
+
</xsl:template>
|
39
|
+
|
40
|
+
</xsl:stylesheet>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" xmlns:functx="http://www.functx.com" stylesheet="escape-for-regex.xslt">
|
3
|
+
<!--
|
4
|
+
This is a sample test suite written in the XSpec language. It
|
5
|
+
tests the stylesheet escape-for-regex.xslt. It contains three
|
6
|
+
main scenarios (the second of which in turn contains two sub-
|
7
|
+
scenarios).
|
8
|
+
|
9
|
+
See https://github.com/xspec/xspec/wiki/Getting-Started for the
|
10
|
+
full tutorial it is part of.
|
11
|
+
-->
|
12
|
+
<!--
|
13
|
+
This is a very simple scenario, checking the return value of a
|
14
|
+
function call (the param does not contain any character to be
|
15
|
+
escaped).
|
16
|
+
-->
|
17
|
+
<x:scenario label="No escaping">
|
18
|
+
<!-- call the function with the string 'Hello' -->
|
19
|
+
<x:call function="functx:escape-for-regex">
|
20
|
+
<x:param select="'Hello'"/>
|
21
|
+
</x:call>
|
22
|
+
<!-- check the result -->
|
23
|
+
<x:expect label="Must not be escaped at all" select="'Hello'"/>
|
24
|
+
</x:scenario>
|
25
|
+
<!--
|
26
|
+
This scenario demonstrates:
|
27
|
+
(1) how to test a function (named templates can be simliarly tested)
|
28
|
+
(2) that scenarios can be nested
|
29
|
+
(3) a test can have multiple expectations.
|
30
|
+
-->
|
31
|
+
<x:scenario label="Test simple patterns">
|
32
|
+
<!-- first sub-scenario -->
|
33
|
+
<x:scenario label="When encountering parentheses">
|
34
|
+
<!-- call the function -->
|
35
|
+
<x:call function="functx:escape-for-regex">
|
36
|
+
<x:param name="arg" select="'(Hello)'"/>
|
37
|
+
</x:call>
|
38
|
+
<!-- check the result -->
|
39
|
+
<x:expect label="escape them." select="'\(Hello\)'"/>
|
40
|
+
</x:scenario>
|
41
|
+
<!-- second sub-scenario -->
|
42
|
+
<x:scenario label="When encountering a whitespace character class">
|
43
|
+
<!-- call the function with another parameter -->
|
44
|
+
<x:call function="functx:escape-for-regex">
|
45
|
+
<x:param name="arg" select="'\sHello'"/>
|
46
|
+
</x:call>
|
47
|
+
<!-- check the result -->
|
48
|
+
<x:expect label="escape the backslash" select="'\\sHello'"/>
|
49
|
+
<!-- we can have several checks on the same result -->
|
50
|
+
<x:expect label="result should have one more character than source" test="string-length(.) = 8"/>
|
51
|
+
</x:scenario>
|
52
|
+
</x:scenario>
|
53
|
+
<!--
|
54
|
+
This scenario demonstrates how to test a matching template.
|
55
|
+
-->
|
56
|
+
<x:scenario label="When processing a list of phrases">
|
57
|
+
<!-- apply template rules to this element -->
|
58
|
+
<x:context>
|
59
|
+
<phrases>
|
60
|
+
<phrase>Hello!</phrase>
|
61
|
+
<phrase>Goodbye!</phrase>
|
62
|
+
<phrase>(So long!)</phrase>
|
63
|
+
</phrases>
|
64
|
+
</x:context>
|
65
|
+
<!-- check the result -->
|
66
|
+
<x:expect label="All phrase elements should remain" test="count(phrases/phrase) = 3"/>
|
67
|
+
<x:expect label="Strings should be escaped and status attributes should be added">
|
68
|
+
<phrases>
|
69
|
+
<phrase status="same">Hello!</phrase>
|
70
|
+
<phrase status="same">Goodbye!</phrase>
|
71
|
+
<phrase status="changed">\(So long!\)</phrase>
|
72
|
+
</phrases>
|
73
|
+
</x:expect>
|
74
|
+
</x:scenario>
|
75
|
+
</x:description>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
3
|
+
|
4
|
+
<sch:pattern>
|
5
|
+
<sch:rule context="article">
|
6
|
+
<sch:assert test="title" id="a001">
|
7
|
+
article should have a title
|
8
|
+
</sch:assert>
|
9
|
+
</sch:rule>
|
10
|
+
<sch:rule context="section">
|
11
|
+
<sch:assert test="title" id="a002">
|
12
|
+
section should have a title
|
13
|
+
</sch:assert>
|
14
|
+
</sch:rule>
|
15
|
+
</sch:pattern>
|
16
|
+
|
17
|
+
</sch:schema>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-01.sch">
|
4
|
+
<x:scenario label="demo-01">
|
5
|
+
<x:context href="demo-01.xml"/>
|
6
|
+
<x:scenario label="article should have a title">
|
7
|
+
<x:expect-not-assert id="a001"/>
|
8
|
+
</x:scenario>
|
9
|
+
<x:scenario label="section should have a title">
|
10
|
+
<x:expect-not-assert id="a002" location="/article[1]/section[1]"/>
|
11
|
+
<x:expect-assert id="a002" location="/article[1]/section[2]"/>
|
12
|
+
</x:scenario>
|
13
|
+
</x:scenario>
|
14
|
+
</x:description>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-02.sch">
|
4
|
+
<x:param name="phase">PhaseA</x:param>
|
5
|
+
<x:scenario label="Pattern 1">
|
6
|
+
<x:context href="demo-02.xml"/>
|
7
|
+
<x:expect-assert id="t1-1" role="warn"/>
|
8
|
+
<x:expect-not-assert id="t2-1"/>
|
9
|
+
</x:scenario>
|
10
|
+
<x:import href="demo-02-import1.xspec"/>
|
11
|
+
</x:description>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-02.sch">
|
4
|
+
<x:param name="phase">PhaseB</x:param>
|
5
|
+
<x:scenario label="Pattern 2">
|
6
|
+
<x:context href="demo-02.xml"/>
|
7
|
+
<x:expect-assert id="t2-1" role="error"/>
|
8
|
+
<x:expect-not-assert id="t1-1"/>
|
9
|
+
</x:scenario>
|
10
|
+
<x:import href="demo-02-import1.xspec"/>
|
11
|
+
<x:import href="demo-02-import3.xspec"/>
|
12
|
+
</x:description>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-02.sch">
|
4
|
+
<x:scenario label="Pattern 3 - Shared">
|
5
|
+
<x:context href="demo-02.xml"/>
|
6
|
+
<x:expect-assert id="t3-1"/>
|
7
|
+
</x:scenario>
|
8
|
+
<x:import href="demo-02-import2.xspec"/>
|
9
|
+
</x:description>
|
10
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-02.sch">
|
4
|
+
<x:scenario label="Pattern 4 - example of a second level of imported scenarios">
|
5
|
+
<x:context href="demo-02.xml"/>
|
6
|
+
<x:expect-report id="t4-1" role="warn"/>
|
7
|
+
</x:scenario>
|
8
|
+
</x:description>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" xmlns:local="local">
|
3
|
+
<x:scenario label="XSpec function scenario imported">
|
4
|
+
<x:call function="local:add">
|
5
|
+
<x:param name="a" select="5" as="xs:integer"/>
|
6
|
+
<x:param name="b" select="2" as="xs:integer"/>
|
7
|
+
</x:call>
|
8
|
+
<x:expect label="add 5 + 2" select="xs:integer(7)"/>
|
9
|
+
</x:scenario>
|
10
|
+
</x:description>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
|
3
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
4
|
+
queryBinding="xslt2">
|
5
|
+
|
6
|
+
<sch:ns uri="local" prefix="local"/>
|
7
|
+
|
8
|
+
<xsl:function name="local:add" as="xs:integer">
|
9
|
+
<xsl:param name="a" as="xs:integer"/>
|
10
|
+
<xsl:param name="b" as="xs:integer"/>
|
11
|
+
<xsl:value-of select="$a + $b"/>
|
12
|
+
</xsl:function>
|
13
|
+
|
14
|
+
<sch:phase id="PhaseA">
|
15
|
+
<sch:active pattern="Pattern1"/>
|
16
|
+
<sch:active pattern="Pattern3"/>
|
17
|
+
<sch:active pattern="Pattern4"/>
|
18
|
+
</sch:phase>
|
19
|
+
|
20
|
+
<sch:phase id="PhaseB">
|
21
|
+
<sch:active pattern="Pattern2"/>
|
22
|
+
<sch:active pattern="Pattern3"/>
|
23
|
+
<sch:active pattern="Pattern4"/>
|
24
|
+
</sch:phase>
|
25
|
+
|
26
|
+
<sch:pattern id="Pattern1">
|
27
|
+
<sch:rule context="sec">
|
28
|
+
<sch:assert test="@sec-type" id="t1-1" role="warn">
|
29
|
+
sec element should have a sec-type attribute.
|
30
|
+
</sch:assert>
|
31
|
+
</sch:rule>
|
32
|
+
</sch:pattern>
|
33
|
+
|
34
|
+
<sch:pattern id="Pattern2">
|
35
|
+
<sch:rule context="sec">
|
36
|
+
<sch:assert test="@sec-type" id="t2-1" role="error">
|
37
|
+
sec element should have a sec-type attribute.
|
38
|
+
</sch:assert>
|
39
|
+
</sch:rule>
|
40
|
+
</sch:pattern>
|
41
|
+
|
42
|
+
<sch:pattern id="Pattern3">
|
43
|
+
<sch:rule context="sec">
|
44
|
+
<sch:assert test="title" id="t3-1">
|
45
|
+
section should have a title
|
46
|
+
</sch:assert>
|
47
|
+
</sch:rule>
|
48
|
+
</sch:pattern>
|
49
|
+
|
50
|
+
<sch:pattern id="Pattern4">
|
51
|
+
<sch:rule context="sec">
|
52
|
+
<sch:report test="count(p) = 1" id="t4-1" role="warn">
|
53
|
+
Short section has only one paragraph.
|
54
|
+
</sch:report>
|
55
|
+
</sch:rule>
|
56
|
+
</sch:pattern>
|
57
|
+
|
58
|
+
</sch:schema>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<article>
|
3
|
+
<article-title>Demo 2</article-title>
|
4
|
+
<body>
|
5
|
+
<sec sec-type="introduction">
|
6
|
+
<title>Welcome!</title>
|
7
|
+
<p>Schematron is a wonderful tool for testing XML to find out if the XML follows an expected structure.</p>
|
8
|
+
<p>In addition to validating XML, Schematron can also raise alerts for things you might want to know through warnings and informational messages. It can pass/fail validation and much more!</p>
|
9
|
+
</sec>
|
10
|
+
<sec>
|
11
|
+
<p>Schematron uses XPath to test the contents of XML.</p>
|
12
|
+
</sec>
|
13
|
+
<sec sec-type="testing">
|
14
|
+
<title>Testing Schematron</title>
|
15
|
+
<p>While Schematron is useful for testing XML files, it is also useful to have a tool for testing Schematron itself.</p>
|
16
|
+
<p>Schematron is simple to use. However sometimes tests can sometimes become very complex. A good set of test cases can help you to avoid problems and makes your work go faster.</p>
|
17
|
+
</sec>
|
18
|
+
</body>
|
19
|
+
</article>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
3
|
+
|
4
|
+
<sch:pattern>
|
5
|
+
|
6
|
+
<sch:rule context="title">
|
7
|
+
<sch:assert test="following-sibling::p" id="a0001">
|
8
|
+
title should be followed by a paragraph
|
9
|
+
</sch:assert>
|
10
|
+
<sch:assert test="string() ne upper-case(string())" role="warn" id="a0002">
|
11
|
+
title should not be all upper case
|
12
|
+
</sch:assert>
|
13
|
+
</sch:rule>
|
14
|
+
|
15
|
+
<sch:rule context="p">
|
16
|
+
<sch:report test="string-length() lt 10" id="a0003" role="warn">
|
17
|
+
paragraph is less than 10 characters long
|
18
|
+
</sch:report>
|
19
|
+
</sch:rule>
|
20
|
+
|
21
|
+
<sch:rule context="document" role="info" id="a0004">
|
22
|
+
<sch:report test="section" role="info">
|
23
|
+
the document has at least one section
|
24
|
+
</sch:report>
|
25
|
+
</sch:rule>
|
26
|
+
|
27
|
+
</sch:pattern>
|
28
|
+
|
29
|
+
</sch:schema>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-03.sch">
|
4
|
+
|
5
|
+
<x:scenario label="demo 3">
|
6
|
+
|
7
|
+
<x:scenario label="inline context">
|
8
|
+
<x:scenario label="valid">
|
9
|
+
<x:context>
|
10
|
+
<document>
|
11
|
+
<title>Introduction</title>
|
12
|
+
<p>some paragraph text</p>
|
13
|
+
</document>
|
14
|
+
</x:context>
|
15
|
+
<x:expect-not-assert id="a0001"/>
|
16
|
+
<x:expect-valid/>
|
17
|
+
</x:scenario>
|
18
|
+
<x:scenario label="not valid">
|
19
|
+
<x:context>
|
20
|
+
<document>
|
21
|
+
<title>Introduction</title>
|
22
|
+
</document>
|
23
|
+
</x:context>
|
24
|
+
<x:expect-assert id="a0001"/>
|
25
|
+
</x:scenario>
|
26
|
+
<x:scenario label="valid with warning">
|
27
|
+
<x:context>
|
28
|
+
<document>
|
29
|
+
<title>Introduction</title>
|
30
|
+
<p>Hello!</p>
|
31
|
+
</document>
|
32
|
+
</x:context>
|
33
|
+
<x:expect-valid/>
|
34
|
+
<x:expect-report id="a0003"/>
|
35
|
+
</x:scenario>
|
36
|
+
</x:scenario>
|
37
|
+
|
38
|
+
<x:scenario label="file as context">
|
39
|
+
<x:scenario label="valid file with warning">
|
40
|
+
<x:context href="demo-03-doc2.xml"/>
|
41
|
+
<x:expect-valid/>
|
42
|
+
<x:expect-assert id="a0002" role="warn"/>
|
43
|
+
<x:expect-report id="a0003" role="warn"/>
|
44
|
+
</x:scenario>
|
45
|
+
<x:scenario label="not valid file">
|
46
|
+
<x:context href="demo-03-doc1.xml"/>
|
47
|
+
<x:expect-assert id="a0001"/>
|
48
|
+
</x:scenario>
|
49
|
+
</x:scenario>
|
50
|
+
|
51
|
+
<x:scenario label="example" pending="tests marked as pending are not executed">
|
52
|
+
<x:context href="demo-03-doc1.xml"/>
|
53
|
+
<x:expect-valid/>
|
54
|
+
</x:scenario>
|
55
|
+
|
56
|
+
<x:scenario label="id or role can be placed on on the rule">
|
57
|
+
<x:context href="demo-03-doc1.xml"/>
|
58
|
+
<x:expect-report id="a0004" role="info"/>
|
59
|
+
</x:scenario>
|
60
|
+
|
61
|
+
</x:scenario>
|
62
|
+
|
63
|
+
</x:description>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
3
|
+
|
4
|
+
<sch:ns uri="http://example.com/ns1" prefix="ex1"/>
|
5
|
+
<sch:ns uri="http://example.com/ns2" prefix="ex2"/>
|
6
|
+
<sch:ns uri="http://example.com/ns3" prefix="ex3"/>
|
7
|
+
|
8
|
+
<sch:pattern>
|
9
|
+
<sch:rule context="ex1:article">
|
10
|
+
<sch:assert test="ex2:title">article should have a title</sch:assert>
|
11
|
+
</sch:rule>
|
12
|
+
<sch:rule context="ex3:sec">
|
13
|
+
<sch:assert test="ex2:para">sec should have at least one para</sch:assert>
|
14
|
+
</sch:rule>
|
15
|
+
<sch:rule context="figure">
|
16
|
+
<sch:assert test="caption">figure should have a caption</sch:assert>
|
17
|
+
</sch:rule>
|
18
|
+
</sch:pattern>
|
19
|
+
|
20
|
+
</sch:schema>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" schematron="demo-04.sch"
|
4
|
+
xmlns:ex1="http://example.com/ns1" xmlns:ex2="http://example.com/ns2" xmlns:ex3="http://example.com/ns3">
|
5
|
+
|
6
|
+
<x:scenario label="demo 4">
|
7
|
+
<x:scenario label="XPath location with namespaces">
|
8
|
+
<x:context>
|
9
|
+
<ex1:article>
|
10
|
+
<ex3:sec>
|
11
|
+
<ex2:para>paragraph 1</ex2:para>
|
12
|
+
</ex3:sec>
|
13
|
+
<ex3:sec ex2:type="3">
|
14
|
+
<figure><img src="example.png"/></figure>
|
15
|
+
</ex3:sec>
|
16
|
+
</ex1:article>
|
17
|
+
</x:context>
|
18
|
+
<x:scenario label="using oXygen's Copy XPath">
|
19
|
+
<x:expect-assert location="/ex1:article[1]"/>
|
20
|
+
<x:expect-assert location="/ex1:article[1]/ex3:sec[2]"/>
|
21
|
+
<x:expect-assert location="/ex1:article[1]/ex3:sec[2]/figure[1]"/>
|
22
|
+
</x:scenario>
|
23
|
+
<x:scenario label="using XPath without [1] or leading /">
|
24
|
+
<x:expect-assert location="ex1:article"/>
|
25
|
+
<x:expect-assert location="ex1:article/ex3:sec[2]"/>
|
26
|
+
<x:expect-assert location="ex1:article/ex3:sec[2]/figure"/>
|
27
|
+
</x:scenario>
|
28
|
+
<x:scenario label="expecting no assert should fail">
|
29
|
+
<x:expect-not-assert location="ex1:article"/>
|
30
|
+
</x:scenario>
|
31
|
+
</x:scenario>
|
32
|
+
</x:scenario>
|
33
|
+
</x:description>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
|
3
|
+
xmlns:sqf="http://www.schematron-quickfix.com/validator/process" defaultPhase="check-id">
|
4
|
+
|
5
|
+
<sch:ns uri="http://purl.oclc.org/dsdl/schematron" prefix="sch"/>
|
6
|
+
|
7
|
+
<sch:p>
|
8
|
+
This Schematron Quick Fix is intended to help with adding id and role attributes to assert and report elements in a Schematron.
|
9
|
+
|
10
|
+
To use this quick fix create a validation scenario in oXygen that uses this Schematron.
|
11
|
+
The validation scenario configuration might look something like this:
|
12
|
+
|
13
|
+
<![CDATA[
|
14
|
+
file to validate File type Validation engine Auto Schema Phase
|
15
|
+
${currentFileURL} Schematron Document Default engine Yes
|
16
|
+
${currentFileURL} XML Document Default engine Yes /path/to/quickfix.sch #ALL
|
17
|
+
]]>
|
18
|
+
|
19
|
+
Apply the validation scenario to validate any Schematron.
|
20
|
+
|
21
|
+
Using the check-id phase,
|
22
|
+
each assert or report element that is missing an id attribute will be flagged.
|
23
|
+
Click on each flagged element and use the quick fix to insert an id attribute.
|
24
|
+
The generated ID will be based on a running number and will use the nearest ancestor ID if there is one.
|
25
|
+
|
26
|
+
Using the check-role phase,
|
27
|
+
each assert or report element that is missing a role attribute will be flagged.
|
28
|
+
Click on each flagged element and use the quick fix to insert a role attribute to
|
29
|
+
make the result of the test be an 'error', 'warn', or 'info'.
|
30
|
+
</sch:p>
|
31
|
+
|
32
|
+
<sch:phase id="check-id">
|
33
|
+
<sch:active pattern="sqf-add-id"/>
|
34
|
+
</sch:phase>
|
35
|
+
|
36
|
+
<sch:phase id="check-role">
|
37
|
+
<sch:active pattern="sqf-add-role"/>
|
38
|
+
</sch:phase>
|
39
|
+
|
40
|
+
<sch:pattern id="sqf-add-id">
|
41
|
+
<sch:rule context="sch:assert | sch:report">
|
42
|
+
<sch:assert test="@id" sqf:fix="add-id" id="sch0001" role="warn"><sch:name/> should have an id attribute.</sch:assert>
|
43
|
+
<sch:let name="nearest-id" value="ancestor-or-self::*[@id][1]/@id"/>
|
44
|
+
<sch:let name="id-prefix" value="'sch'"/>
|
45
|
+
<sqf:fix id="add-id">
|
46
|
+
<sqf:description>
|
47
|
+
<sqf:title>Add id attribute</sqf:title>
|
48
|
+
</sqf:description>
|
49
|
+
<sqf:add node-type="attribute" target="id" select="
|
50
|
+
if (not($nearest-id)) then concat($id-prefix, format-number(count(//sch:assert[@id][not(ancestor::*[@id])] | //sch:report[@id][not(ancestor::*[@id])]) + 1, '0000'))
|
51
|
+
else concat($nearest-id, '-', format-number(count(ancestor::*[@id = $nearest-id]//(sch:assert[@id] | sch:report[@id])) + 1, '00'))
|
52
|
+
"/>
|
53
|
+
</sqf:fix>
|
54
|
+
</sch:rule>
|
55
|
+
</sch:pattern>
|
56
|
+
|
57
|
+
<sch:pattern id="sqf-add-role">
|
58
|
+
<sch:rule context="sch:assert | sch:report">
|
59
|
+
<sch:assert test="@role" sqf:fix="sqf-add-role-error sqf-add-role-warn sqf-add-role-info" role="warn" id="sch0002"><sch:name/> should have a role attribute.</sch:assert>
|
60
|
+
<sqf:fix id="sqf-add-role-error">
|
61
|
+
<sqf:description>
|
62
|
+
<sqf:title>Add role 'error'</sqf:title>
|
63
|
+
</sqf:description>
|
64
|
+
<sqf:add node-type="attribute" target="role" select="'error'"/>
|
65
|
+
</sqf:fix>
|
66
|
+
<sqf:fix id="sqf-add-role-warn">
|
67
|
+
<sqf:description>
|
68
|
+
<sqf:title>Add role 'warn'</sqf:title>
|
69
|
+
</sqf:description>
|
70
|
+
<sqf:add node-type="attribute" target="role" select="'warn'"/>
|
71
|
+
</sqf:fix>
|
72
|
+
<sqf:fix id="sqf-add-role-info">
|
73
|
+
<sqf:description>
|
74
|
+
<sqf:title>Add role 'info'</sqf:title>
|
75
|
+
</sqf:description>
|
76
|
+
<sqf:add node-type="attribute" target="role" select="'info'"/>
|
77
|
+
</sqf:fix>
|
78
|
+
</sch:rule>
|
79
|
+
</sch:pattern>
|
80
|
+
|
81
|
+
</sch:schema>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
|
3
|
+
xmlns:functx="http://www.functx.com"
|
4
|
+
query="http://www.functx.com"
|
5
|
+
query-at="xquery-tutorial.xq">
|
6
|
+
|
7
|
+
<x:scenario label="Calling function capitalize-first">
|
8
|
+
<x:call function="functx:capitalize-first">
|
9
|
+
<x:param select="'hello'"/>
|
10
|
+
</x:call>
|
11
|
+
|
12
|
+
<x:expect label="should capitalize the first character of the string" select="'Hello'"/>
|
13
|
+
|
14
|
+
</x:scenario>
|
15
|
+
|
16
|
+
</x:description>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
2
|
+
xmlns:proj="http://expath.org/ns/project"
|
3
|
+
xmlns:zip="http://expath.org/ns/zip"
|
4
|
+
exclude-result-prefixes="#all"
|
5
|
+
version="2.0">
|
6
|
+
|
7
|
+
<xsl:import href="http://expath.org/ns/project/release.xsl"/>
|
8
|
+
|
9
|
+
<!-- The overload point. -->
|
10
|
+
<xsl:template match="zip:file" mode="proj:modify-release">
|
11
|
+
<xsl:apply-templates select="." mode="add-readme"/>
|
12
|
+
</xsl:template>
|
13
|
+
|
14
|
+
<!-- Copy everything... -->
|
15
|
+
<xsl:template match="node()" mode="add-readme">
|
16
|
+
<xsl:copy>
|
17
|
+
<xsl:copy-of select="@*"/>
|
18
|
+
<xsl:apply-templates select="node()" mode="add-readme"/>
|
19
|
+
</xsl:copy>
|
20
|
+
</xsl:template>
|
21
|
+
|
22
|
+
<!-- ...and add the README file, and the Java, bin and tutorial dirs. -->
|
23
|
+
<xsl:template match="zip:file/zip:dir" mode="add-readme">
|
24
|
+
<xsl:copy>
|
25
|
+
<!-- copy the existing -->
|
26
|
+
<xsl:copy-of select="@*"/>
|
27
|
+
<!-- add the README file -->
|
28
|
+
<zip:entry src="{ resolve-uri('README', $proj:project) }"/>
|
29
|
+
<!-- copy the existing -->
|
30
|
+
<xsl:apply-templates select="node()" mode="add-readme"/>
|
31
|
+
<!-- additional dirs -->
|
32
|
+
<xsl:for-each select="'bin/', 'java/', 'tutorial/'">
|
33
|
+
<!-- resolve the dir, absolute, from the project's dir -->
|
34
|
+
<xsl:variable name="dir" select="resolve-uri(., $proj:project)"/>
|
35
|
+
<!-- recurse dir and create the appropriate zip:file elements -->
|
36
|
+
<xsl:sequence select="proj:zip-directory($dir)"/>
|
37
|
+
</xsl:for-each>
|
38
|
+
</xsl:copy>
|
39
|
+
</xsl:template>
|
40
|
+
|
41
|
+
</xsl:stylesheet>
|