simple-xspec-wrapper 0.1.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,503 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- ===================================================================== -->
|
|
3
|
+
<!-- File: generate-xspec-tests.xsl -->
|
|
4
|
+
<!-- Author: Jeni Tennsion -->
|
|
5
|
+
<!-- Tags: -->
|
|
6
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) -->
|
|
7
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<xsl:stylesheet version="2.0"
|
|
11
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
12
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
13
|
+
xmlns="http://www.w3.org/1999/XSL/TransformAlias"
|
|
14
|
+
xmlns:test="http://www.jenitennison.com/xslt/unit-test"
|
|
15
|
+
exclude-result-prefixes="#default test"
|
|
16
|
+
xmlns:x="http://www.jenitennison.com/xslt/xspec"
|
|
17
|
+
xmlns:__x="http://www.w3.org/1999/XSL/TransformAliasAlias"
|
|
18
|
+
xmlns:pkg="http://expath.org/ns/pkg"
|
|
19
|
+
xmlns:impl="urn:x-xspec:compile:xslt:impl">
|
|
20
|
+
|
|
21
|
+
<xsl:import href="generate-common-tests.xsl"/>
|
|
22
|
+
<xsl:import href="generate-tests-helper.xsl" />
|
|
23
|
+
|
|
24
|
+
<pkg:import-uri>http://www.jenitennison.com/xslt/xspec/generate-xspec-tests.xsl</pkg:import-uri>
|
|
25
|
+
|
|
26
|
+
<xsl:namespace-alias stylesheet-prefix="#default" result-prefix="xsl"/>
|
|
27
|
+
|
|
28
|
+
<xsl:preserve-space elements="x:space" />
|
|
29
|
+
|
|
30
|
+
<xsl:output indent="yes" encoding="ISO-8859-1" />
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<xsl:variable name="xspec-ns" select="'http://www.jenitennison.com/xslt/xspec'"/>
|
|
34
|
+
|
|
35
|
+
<xsl:variable name="apostrophe">'</xsl:variable>
|
|
36
|
+
<xsl:variable name="stylesheet-uri" as="xs:anyURI"
|
|
37
|
+
select="resolve-uri(/x:description/@stylesheet, replace(base-uri(/x:description), $apostrophe, '%27'))" />
|
|
38
|
+
|
|
39
|
+
<xsl:variable name="stylesheet" as="document-node()"
|
|
40
|
+
select="doc($stylesheet-uri)" />
|
|
41
|
+
|
|
42
|
+
<xsl:template match="/">
|
|
43
|
+
<xsl:call-template name="x:generate-tests"/>
|
|
44
|
+
</xsl:template>
|
|
45
|
+
|
|
46
|
+
<!-- *** x:generate-tests *** -->
|
|
47
|
+
<!-- Does the generation of the test stylesheet -->
|
|
48
|
+
|
|
49
|
+
<xsl:template match="x:description" mode="x:generate-tests">
|
|
50
|
+
<!-- The compiled stylesheet element. -->
|
|
51
|
+
<stylesheet version="{( @xslt-version, '2.0' )[1]}"
|
|
52
|
+
exclude-result-prefixes="pkg impl">
|
|
53
|
+
<xsl:apply-templates select="." mode="x:copy-namespaces" />
|
|
54
|
+
<import href="{$stylesheet-uri}" />
|
|
55
|
+
<import href="{resolve-uri('generate-tests-utils.xsl', static-base-uri())}"/>
|
|
56
|
+
<import href="{resolve-uri('../schematron/sch-location-compare.xsl', static-base-uri())}"/>
|
|
57
|
+
<!-- This namespace alias is used for when the testing process needs to test
|
|
58
|
+
the generation of XSLT! -->
|
|
59
|
+
<namespace-alias stylesheet-prefix="__x" result-prefix="xsl" />
|
|
60
|
+
<variable name="x:stylesheet-uri" as="xs:string" select="'{$stylesheet-uri}'" />
|
|
61
|
+
<output name="x:report" method="xml" indent="yes" />
|
|
62
|
+
<!-- Compile the test suite params (aka global params). -->
|
|
63
|
+
<xsl:call-template name="x:compile-params"/>
|
|
64
|
+
<!-- The main compiled template. -->
|
|
65
|
+
<template name="x:main">
|
|
66
|
+
<message>
|
|
67
|
+
<text>Testing with </text>
|
|
68
|
+
<value-of select="system-property('xsl:product-name')" />
|
|
69
|
+
<text><xsl:text> </xsl:text></text>
|
|
70
|
+
<value-of select="system-property('xsl:product-version')" />
|
|
71
|
+
</message>
|
|
72
|
+
<result-document format="x:report">
|
|
73
|
+
<processing-instruction name="xml-stylesheet">
|
|
74
|
+
<xsl:text>type="text/xsl" href="</xsl:text>
|
|
75
|
+
<xsl:value-of select="resolve-uri('format-xspec-report.xsl',
|
|
76
|
+
static-base-uri())" />
|
|
77
|
+
<xsl:text>"</xsl:text>
|
|
78
|
+
</processing-instruction>
|
|
79
|
+
<!-- This bit of jiggery-pokery with the $stylesheet-uri variable is so
|
|
80
|
+
that the URI appears in the trace report generated from running the
|
|
81
|
+
test stylesheet, which can then be picked up by stylesheets that
|
|
82
|
+
process *that* to generate a coverage report -->
|
|
83
|
+
<x:report stylesheet="{{$x:stylesheet-uri}}" date="{{current-dateTime()}}">
|
|
84
|
+
<!-- Generate calls to the compiled top-level scenarios. -->
|
|
85
|
+
<xsl:call-template name="x:call-scenarios"/>
|
|
86
|
+
</x:report>
|
|
87
|
+
</result-document>
|
|
88
|
+
</template>
|
|
89
|
+
<!-- Compile the top-level scenarios. -->
|
|
90
|
+
<xsl:call-template name="x:compile-scenarios"/>
|
|
91
|
+
</stylesheet>
|
|
92
|
+
</xsl:template>
|
|
93
|
+
|
|
94
|
+
<!-- *** x:output-call *** -->
|
|
95
|
+
<!-- Generates a call to the template compiled from a scenario or an expect element. -->
|
|
96
|
+
|
|
97
|
+
<xsl:template name="x:output-call">
|
|
98
|
+
<xsl:param name="name" as="xs:string"/>
|
|
99
|
+
<xsl:param name="last" as="xs:boolean"/>
|
|
100
|
+
<xsl:param name="params" as="element(param)*"/>
|
|
101
|
+
<call-template name="x:{ $name }">
|
|
102
|
+
<xsl:for-each select="$params">
|
|
103
|
+
<with-param name="{ @name }" select="{ @select }"/>
|
|
104
|
+
</xsl:for-each>
|
|
105
|
+
</call-template>
|
|
106
|
+
<!-- Continue compiling calls. -->
|
|
107
|
+
<xsl:call-template name="x:continue-call-scenarios"/>
|
|
108
|
+
</xsl:template>
|
|
109
|
+
|
|
110
|
+
<!-- *** x:compile *** -->
|
|
111
|
+
<!-- Generates the templates that perform the tests -->
|
|
112
|
+
|
|
113
|
+
<xsl:template name="x:output-scenario">
|
|
114
|
+
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
|
|
115
|
+
<xsl:param name="apply" select="()" tunnel="yes" as="element(x:apply)?"/>
|
|
116
|
+
<xsl:param name="call" select="()" tunnel="yes" as="element(x:call)?"/>
|
|
117
|
+
<xsl:param name="context" select="()" tunnel="yes" as="element(x:context)?"/>
|
|
118
|
+
<xsl:param name="variables" as="element(x:variable)*"/>
|
|
119
|
+
<xsl:param name="params" as="element(param)*"/>
|
|
120
|
+
<xsl:variable name="pending-p" select="exists($pending) and empty(ancestor-or-self::*/@focus)"/>
|
|
121
|
+
<!-- We have to create these error messages at this stage because before now
|
|
122
|
+
we didn't have merged versions of the environment -->
|
|
123
|
+
<xsl:if test="$context/@href and ($context/node() except $context/x:param)">
|
|
124
|
+
<xsl:message terminate="yes">
|
|
125
|
+
<xsl:text>ERROR in scenario "</xsl:text>
|
|
126
|
+
<xsl:value-of select="x:label(.)" />
|
|
127
|
+
<xsl:text>": can't set the context document using both the href</xsl:text>
|
|
128
|
+
<xsl:text> attribute and the content of <context></xsl:text>
|
|
129
|
+
</xsl:message>
|
|
130
|
+
</xsl:if>
|
|
131
|
+
<xsl:if test="$call/@template and $call/@function">
|
|
132
|
+
<xsl:message terminate="yes">
|
|
133
|
+
<xsl:text>ERROR in scenario "</xsl:text>
|
|
134
|
+
<xsl:value-of select="x:label(.)" />
|
|
135
|
+
<xsl:text>": can't call a function and a template at the same time</xsl:text>
|
|
136
|
+
</xsl:message>
|
|
137
|
+
</xsl:if>
|
|
138
|
+
<xsl:if test="$apply and $context">
|
|
139
|
+
<xsl:message terminate="yes">
|
|
140
|
+
<xsl:text>ERROR in scenario "</xsl:text>
|
|
141
|
+
<xsl:value-of select="x:label(.)" />
|
|
142
|
+
<xsl:text>": can't use apply and set a context at the same time</xsl:text>
|
|
143
|
+
</xsl:message>
|
|
144
|
+
</xsl:if>
|
|
145
|
+
<xsl:if test="$apply and $call">
|
|
146
|
+
<xsl:message terminate="yes">
|
|
147
|
+
<xsl:text>ERROR in scenario "</xsl:text>
|
|
148
|
+
<xsl:value-of select="x:label(.)" />
|
|
149
|
+
<xsl:text>": can't use apply and call at the same time</xsl:text>
|
|
150
|
+
</xsl:message>
|
|
151
|
+
</xsl:if>
|
|
152
|
+
<xsl:if test="$context and $call/@function">
|
|
153
|
+
<xsl:message terminate="yes">
|
|
154
|
+
<xsl:text>ERROR in scenario "</xsl:text>
|
|
155
|
+
<xsl:value-of select="x:label(.)" />
|
|
156
|
+
<xsl:text>": can't set a context and call a function at the same time</xsl:text>
|
|
157
|
+
</xsl:message>
|
|
158
|
+
</xsl:if>
|
|
159
|
+
<xsl:if test="x:expect and not($call) and not($apply) and not($context)">
|
|
160
|
+
<xsl:message terminate="yes">
|
|
161
|
+
<xsl:text>ERROR in scenario "</xsl:text>
|
|
162
|
+
<xsl:value-of select="x:label(.)" />
|
|
163
|
+
<xsl:text>": there are tests in this scenario but no call, or apply or context has been given</xsl:text>
|
|
164
|
+
</xsl:message>
|
|
165
|
+
</xsl:if>
|
|
166
|
+
<template name="x:{generate-id()}">
|
|
167
|
+
<xsl:for-each select="$params">
|
|
168
|
+
<param name="{ @name }" required="yes"/>
|
|
169
|
+
</xsl:for-each>
|
|
170
|
+
<message>
|
|
171
|
+
<xsl:if test="$pending-p">
|
|
172
|
+
<xsl:text>PENDING: </xsl:text>
|
|
173
|
+
<xsl:if test="$pending != ''">
|
|
174
|
+
<xsl:text>(</xsl:text>
|
|
175
|
+
<xsl:value-of select="normalize-space($pending)"/>
|
|
176
|
+
<xsl:text>) </xsl:text>
|
|
177
|
+
</xsl:if>
|
|
178
|
+
</xsl:if>
|
|
179
|
+
<xsl:if test="parent::x:scenario">
|
|
180
|
+
<xsl:text>..</xsl:text>
|
|
181
|
+
</xsl:if>
|
|
182
|
+
<xsl:value-of select="normalize-space(x:label(.))"/>
|
|
183
|
+
</message>
|
|
184
|
+
<x:scenario>
|
|
185
|
+
<xsl:if test="$pending-p">
|
|
186
|
+
<xsl:attribute name="pending" select="$pending" />
|
|
187
|
+
</xsl:if>
|
|
188
|
+
<xsl:sequence select="x:label(.)" />
|
|
189
|
+
<xsl:apply-templates select="x:apply | x:call | x:context" mode="x:report" />
|
|
190
|
+
<xsl:apply-templates select="$variables" mode="x:generate-declarations"/>
|
|
191
|
+
<xsl:if test="not($pending-p) and x:expect">
|
|
192
|
+
<variable name="x:result" as="item()*">
|
|
193
|
+
<xsl:choose>
|
|
194
|
+
<xsl:when test="$call/@template">
|
|
195
|
+
<!-- Set up variables containing the parameter values -->
|
|
196
|
+
<xsl:apply-templates select="$call/x:param[1]" mode="x:compile" />
|
|
197
|
+
<!-- Create the template call -->
|
|
198
|
+
<xsl:variable name="template-call">
|
|
199
|
+
<call-template name="{$call/@template}">
|
|
200
|
+
<xsl:for-each select="$call/x:param">
|
|
201
|
+
<with-param name="{@name}" select="${@name}">
|
|
202
|
+
<xsl:copy-of select="@tunnel, @as" />
|
|
203
|
+
</with-param>
|
|
204
|
+
</xsl:for-each>
|
|
205
|
+
</call-template>
|
|
206
|
+
</xsl:variable>
|
|
207
|
+
<xsl:choose>
|
|
208
|
+
<xsl:when test="$context">
|
|
209
|
+
<!-- Set up the $context variable -->
|
|
210
|
+
<xsl:apply-templates select="$context" mode="x:setup-context"/>
|
|
211
|
+
<!-- Switch to the context and call the template -->
|
|
212
|
+
<for-each select="$impl:context">
|
|
213
|
+
<xsl:copy-of select="$template-call" />
|
|
214
|
+
</for-each>
|
|
215
|
+
</xsl:when>
|
|
216
|
+
<xsl:otherwise>
|
|
217
|
+
<xsl:copy-of select="$template-call" />
|
|
218
|
+
</xsl:otherwise>
|
|
219
|
+
</xsl:choose>
|
|
220
|
+
</xsl:when>
|
|
221
|
+
<xsl:when test="$call/@function">
|
|
222
|
+
<!-- Set up variables containing the parameter values -->
|
|
223
|
+
<xsl:apply-templates select="$call/x:param[1]" mode="x:compile" />
|
|
224
|
+
<!-- Create the function call -->
|
|
225
|
+
<sequence>
|
|
226
|
+
<xsl:attribute name="select">
|
|
227
|
+
<xsl:value-of select="$call/@function" />
|
|
228
|
+
<xsl:text>(</xsl:text>
|
|
229
|
+
<xsl:for-each select="$call/x:param">
|
|
230
|
+
<xsl:sort select="xs:integer(@position)" />
|
|
231
|
+
<xsl:text>$</xsl:text>
|
|
232
|
+
<xsl:value-of select="if (@name) then @name else generate-id()" />
|
|
233
|
+
<xsl:if test="position() != last()">, </xsl:if>
|
|
234
|
+
</xsl:for-each>
|
|
235
|
+
<xsl:text>)</xsl:text>
|
|
236
|
+
</xsl:attribute>
|
|
237
|
+
</sequence>
|
|
238
|
+
</xsl:when>
|
|
239
|
+
<xsl:when test="$apply">
|
|
240
|
+
<!-- TODO: FIXME: ... -->
|
|
241
|
+
<xsl:message terminate="yes">
|
|
242
|
+
<xsl:text>The instruction t:apply is not supported yet!</xsl:text>
|
|
243
|
+
</xsl:message>
|
|
244
|
+
<!-- Set up variables containing the parameter values -->
|
|
245
|
+
<xsl:apply-templates select="$apply/x:param[1]" mode="x:compile"/>
|
|
246
|
+
<!-- Create the apply templates instruction -->
|
|
247
|
+
<apply-templates>
|
|
248
|
+
<xsl:copy-of select="$apply/@select | $apply/@mode"/>
|
|
249
|
+
<xsl:for-each select="$apply/x:param">
|
|
250
|
+
<with-param name="{ @name }" select="${ @name }">
|
|
251
|
+
<xsl:copy-of select="@tunnel"/>
|
|
252
|
+
</with-param>
|
|
253
|
+
</xsl:for-each>
|
|
254
|
+
</apply-templates>
|
|
255
|
+
</xsl:when>
|
|
256
|
+
<xsl:when test="$context">
|
|
257
|
+
<!-- Set up the $context variable -->
|
|
258
|
+
<xsl:apply-templates select="$context" mode="x:setup-context"/>
|
|
259
|
+
<!-- Set up variables containing the parameter values -->
|
|
260
|
+
<xsl:apply-templates select="$context/x:param[1]" mode="x:compile"/>
|
|
261
|
+
<!-- Create the template call -->
|
|
262
|
+
<apply-templates select="$impl:context">
|
|
263
|
+
<xsl:sequence select="$context/@mode" />
|
|
264
|
+
<xsl:for-each select="$context/x:param">
|
|
265
|
+
<with-param name="{@name}" select="${@name}">
|
|
266
|
+
<xsl:copy-of select="@tunnel, @as" />
|
|
267
|
+
</with-param>
|
|
268
|
+
</xsl:for-each>
|
|
269
|
+
</apply-templates>
|
|
270
|
+
</xsl:when>
|
|
271
|
+
<xsl:otherwise>
|
|
272
|
+
<!-- TODO: Adapt to a new error reporting facility (above usages too). -->
|
|
273
|
+
<xsl:message terminate="yes">Error: cannot happen.</xsl:message>
|
|
274
|
+
</xsl:otherwise>
|
|
275
|
+
</xsl:choose>
|
|
276
|
+
</variable>
|
|
277
|
+
<call-template name="test:report-value">
|
|
278
|
+
<with-param name="value" select="$x:result" />
|
|
279
|
+
<with-param name="wrapper-name" select="'x:result'" />
|
|
280
|
+
<with-param name="wrapper-ns" select="'{ $xspec-ns }'"/>
|
|
281
|
+
</call-template>
|
|
282
|
+
</xsl:if>
|
|
283
|
+
<xsl:call-template name="x:call-scenarios"/>
|
|
284
|
+
</x:scenario>
|
|
285
|
+
</template>
|
|
286
|
+
<xsl:call-template name="x:compile-scenarios"/>
|
|
287
|
+
</xsl:template>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<xsl:template name="x:output-expect">
|
|
291
|
+
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
|
|
292
|
+
<xsl:param name="context" required="yes" tunnel="yes" as="element(x:context)?"/>
|
|
293
|
+
<xsl:param name="call" required="yes" tunnel="yes" as="element(x:call)?"/>
|
|
294
|
+
<xsl:param name="params" required="yes" as="element(param)*"/>
|
|
295
|
+
<xsl:variable name="pending-p" select="exists($pending) and empty(ancestor::*/@focus)"/>
|
|
296
|
+
<template name="x:{generate-id()}">
|
|
297
|
+
<xsl:for-each select="$params">
|
|
298
|
+
<param name="{ @name }" required="{ @required }"/>
|
|
299
|
+
</xsl:for-each>
|
|
300
|
+
<message>
|
|
301
|
+
<xsl:if test="$pending-p">
|
|
302
|
+
<xsl:text>PENDING: </xsl:text>
|
|
303
|
+
<xsl:if test="normalize-space($pending) != ''">(<xsl:value-of select="normalize-space($pending)"/>) </xsl:if>
|
|
304
|
+
</xsl:if>
|
|
305
|
+
<xsl:value-of select="normalize-space(x:label(.))"/>
|
|
306
|
+
</message>
|
|
307
|
+
<xsl:if test="not($pending-p)">
|
|
308
|
+
<xsl:variable name="version" as="xs:double"
|
|
309
|
+
select="(ancestor-or-self::*[@xslt-version]/@xslt-version, 2.0)[1]" />
|
|
310
|
+
<xsl:apply-templates select="." mode="test:generate-variable-declarations">
|
|
311
|
+
<xsl:with-param name="var" select="'impl:expected'" />
|
|
312
|
+
</xsl:apply-templates>
|
|
313
|
+
<xsl:choose>
|
|
314
|
+
<xsl:when test="@test">
|
|
315
|
+
<!-- This variable declaration could be moved from here (the
|
|
316
|
+
template generated from x:expect) to the template
|
|
317
|
+
generated from x:scenario. It depends only on
|
|
318
|
+
$x:result, so could be computed only once. -->
|
|
319
|
+
<variable name="impl:test-items" as="item()*">
|
|
320
|
+
<choose>
|
|
321
|
+
<!-- From trying this out, it seems like it's useful for the test
|
|
322
|
+
to be able to test the nodes that are generated in the
|
|
323
|
+
$x:result as if they were *children* of the context node.
|
|
324
|
+
Have to experiment a bit to see if that really is the case.
|
|
325
|
+
TODO: To remove. Use directly $x:result instead. See issue 14. -->
|
|
326
|
+
<when test="$x:result instance of node()+">
|
|
327
|
+
<!-- $impl:test-items-doc aims to create an implicit document node as described
|
|
328
|
+
in http://www.w3.org/TR/xslt20/#temporary-trees
|
|
329
|
+
So its "variable" element must not have @as or @select.
|
|
330
|
+
Do not use "document" or "copy-of" element: xspec/xspec#47 -->
|
|
331
|
+
<variable name="impl:test-items-doc">
|
|
332
|
+
<sequence select="$x:result" />
|
|
333
|
+
</variable>
|
|
334
|
+
<sequence select="$impl:test-items-doc treat as document-node()" />
|
|
335
|
+
</when>
|
|
336
|
+
<otherwise>
|
|
337
|
+
<sequence select="$x:result" />
|
|
338
|
+
</otherwise>
|
|
339
|
+
</choose>
|
|
340
|
+
</variable>
|
|
341
|
+
<variable name="impl:test-result" as="item()*">
|
|
342
|
+
<choose>
|
|
343
|
+
<when test="count($impl:test-items) eq 1">
|
|
344
|
+
<for-each select="$impl:test-items">
|
|
345
|
+
<sequence select="{ @test }" version="{ $version }"/>
|
|
346
|
+
</for-each>
|
|
347
|
+
</when>
|
|
348
|
+
<otherwise>
|
|
349
|
+
<sequence select="{ @test }" version="{ $version }"/>
|
|
350
|
+
</otherwise>
|
|
351
|
+
</choose>
|
|
352
|
+
</variable>
|
|
353
|
+
<!-- TODO: A predicate should always return exactly one boolean, or
|
|
354
|
+
this is an error. See issue 5.-->
|
|
355
|
+
<variable name="impl:boolean-test" as="xs:boolean"
|
|
356
|
+
select="$impl:test-result instance of xs:boolean" />
|
|
357
|
+
<variable name="impl:successful" as="xs:boolean"
|
|
358
|
+
select="if ($impl:boolean-test) then $impl:test-result cast as xs:boolean
|
|
359
|
+
else test:deep-equal($impl:expected, $impl:test-result, {$version})" />
|
|
360
|
+
</xsl:when>
|
|
361
|
+
<xsl:otherwise>
|
|
362
|
+
<variable name="impl:successful" as="xs:boolean"
|
|
363
|
+
select="test:deep-equal($impl:expected, $x:result, {$version})" />
|
|
364
|
+
</xsl:otherwise>
|
|
365
|
+
</xsl:choose>
|
|
366
|
+
<if test="not($impl:successful)">
|
|
367
|
+
<message>
|
|
368
|
+
<xsl:text> FAILED</xsl:text>
|
|
369
|
+
</message>
|
|
370
|
+
</if>
|
|
371
|
+
</xsl:if>
|
|
372
|
+
<x:test>
|
|
373
|
+
<xsl:choose>
|
|
374
|
+
<xsl:when test="$pending-p">
|
|
375
|
+
<xsl:attribute name="pending" select="$pending" />
|
|
376
|
+
</xsl:when>
|
|
377
|
+
<xsl:otherwise>
|
|
378
|
+
<xsl:attribute name="successful" select="'{$impl:successful}'" />
|
|
379
|
+
</xsl:otherwise>
|
|
380
|
+
</xsl:choose>
|
|
381
|
+
<xsl:sequence select="x:label(.)"/>
|
|
382
|
+
<xsl:if test="not($pending-p)">
|
|
383
|
+
<xsl:if test="@test">
|
|
384
|
+
<if test="not($impl:boolean-test)">
|
|
385
|
+
<call-template name="test:report-value">
|
|
386
|
+
<with-param name="value" select="$impl:test-result"/>
|
|
387
|
+
<with-param name="wrapper-name" select="'x:result'"/>
|
|
388
|
+
<with-param name="wrapper-ns" select="'{ $xspec-ns }'"/>
|
|
389
|
+
</call-template>
|
|
390
|
+
</if>
|
|
391
|
+
</xsl:if>
|
|
392
|
+
<call-template name="test:report-value">
|
|
393
|
+
<with-param name="value" select="$impl:expected"/>
|
|
394
|
+
<with-param name="wrapper-name" select="'x:expect'"/>
|
|
395
|
+
<with-param name="wrapper-ns" select="'{ $xspec-ns }'"/>
|
|
396
|
+
</call-template>
|
|
397
|
+
</xsl:if>
|
|
398
|
+
</x:test>
|
|
399
|
+
</template>
|
|
400
|
+
</xsl:template>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
<!-- *** x:generate-declarations *** -->
|
|
404
|
+
<!-- Code to generate parameter declarations -->
|
|
405
|
+
<xsl:template match="x:param" mode="x:generate-declarations">
|
|
406
|
+
<xsl:apply-templates select="." mode="test:generate-variable-declarations">
|
|
407
|
+
<xsl:with-param name="var" select="@name"/>
|
|
408
|
+
<xsl:with-param name="type" select="'param'"/>
|
|
409
|
+
</xsl:apply-templates>
|
|
410
|
+
</xsl:template>
|
|
411
|
+
|
|
412
|
+
<xsl:template match="x:variable" mode="x:generate-declarations">
|
|
413
|
+
<xsl:apply-templates select="." mode="test:generate-variable-declarations">
|
|
414
|
+
<xsl:with-param name="var" select="@name"/>
|
|
415
|
+
<xsl:with-param name="type" select="'variable'"/>
|
|
416
|
+
</xsl:apply-templates>
|
|
417
|
+
</xsl:template>
|
|
418
|
+
|
|
419
|
+
<xsl:template match="x:space" mode="test:create-xslt-generator">
|
|
420
|
+
<text><xsl:value-of select="." /></text>
|
|
421
|
+
</xsl:template>
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
<!-- *** x:compile *** -->
|
|
425
|
+
<!-- Helper code for the tests -->
|
|
426
|
+
|
|
427
|
+
<xsl:template match="x:context" mode="x:setup-context">
|
|
428
|
+
<xsl:variable name="context" as="element(x:context)">
|
|
429
|
+
<x:context>
|
|
430
|
+
<xsl:sequence select="@*" />
|
|
431
|
+
<xsl:sequence select="node() except x:param" />
|
|
432
|
+
</x:context>
|
|
433
|
+
</xsl:variable>
|
|
434
|
+
<xsl:apply-templates select="$context" mode="test:generate-variable-declarations">
|
|
435
|
+
<xsl:with-param name="var" select="'impl:context'" />
|
|
436
|
+
</xsl:apply-templates>
|
|
437
|
+
</xsl:template>
|
|
438
|
+
|
|
439
|
+
<xsl:template match="x:context | x:param" mode="x:report">
|
|
440
|
+
<xsl:element name="x:{local-name()}">
|
|
441
|
+
<xsl:apply-templates select="@*" mode="x:report" />
|
|
442
|
+
<xsl:apply-templates mode="test:create-xslt-generator" />
|
|
443
|
+
</xsl:element>
|
|
444
|
+
</xsl:template>
|
|
445
|
+
|
|
446
|
+
<xsl:template match="x:call" mode="x:report">
|
|
447
|
+
<x:call>
|
|
448
|
+
<xsl:copy-of select="@*" />
|
|
449
|
+
<xsl:apply-templates mode="x:report" />
|
|
450
|
+
</x:call>
|
|
451
|
+
</xsl:template>
|
|
452
|
+
|
|
453
|
+
<xsl:template match="@select" mode="x:report">
|
|
454
|
+
<xsl:attribute name="select"
|
|
455
|
+
select="replace(replace(., '\{', '{{'), '\}', '}}')" />
|
|
456
|
+
</xsl:template>
|
|
457
|
+
|
|
458
|
+
<xsl:template match="@*" mode="x:report">
|
|
459
|
+
<xsl:sequence select="." />
|
|
460
|
+
</xsl:template>
|
|
461
|
+
|
|
462
|
+
<xsl:function name="x:label" as="node()?">
|
|
463
|
+
<xsl:param name="labelled" as="element()" />
|
|
464
|
+
<xsl:choose>
|
|
465
|
+
<xsl:when test="exists($labelled/x:label)">
|
|
466
|
+
<xsl:sequence select="$labelled/x:label" />
|
|
467
|
+
</xsl:when>
|
|
468
|
+
<xsl:otherwise>
|
|
469
|
+
<x:label><xsl:value-of select="$labelled/@label" /></x:label>
|
|
470
|
+
</xsl:otherwise>
|
|
471
|
+
</xsl:choose>
|
|
472
|
+
</xsl:function>
|
|
473
|
+
|
|
474
|
+
</xsl:stylesheet>
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
478
|
+
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
|
|
479
|
+
<!-- -->
|
|
480
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
|
|
481
|
+
<!-- -->
|
|
482
|
+
<!-- The contents of this file are subject to the MIT License (see the URI -->
|
|
483
|
+
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
|
|
484
|
+
<!-- -->
|
|
485
|
+
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
|
|
486
|
+
<!-- a copy of this software and associated documentation files (the -->
|
|
487
|
+
<!-- "Software"), to deal in the Software without restriction, including -->
|
|
488
|
+
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
|
|
489
|
+
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
|
|
490
|
+
<!-- permit persons to whom the Software is furnished to do so, subject to -->
|
|
491
|
+
<!-- the following conditions: -->
|
|
492
|
+
<!-- -->
|
|
493
|
+
<!-- The above copyright notice and this permission notice shall be -->
|
|
494
|
+
<!-- included in all copies or substantial portions of the Software. -->
|
|
495
|
+
<!-- -->
|
|
496
|
+
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
|
|
497
|
+
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
|
|
498
|
+
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
|
|
499
|
+
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
|
|
500
|
+
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
|
|
501
|
+
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
|
|
502
|
+
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
|
|
503
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- ===================================================================== -->
|
|
3
|
+
<!-- File: basex-standalone-xquery-harness.xproc -->
|
|
4
|
+
<!-- Author: Florent Georges -->
|
|
5
|
+
<!-- Date: 2011-08-30 -->
|
|
6
|
+
<!-- URI: http://xspec.googlecode.com/ -->
|
|
7
|
+
<!-- Tags: -->
|
|
8
|
+
<!-- Copyright (c) 2011 Florent Georges (see end of file.) -->
|
|
9
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step"
|
|
13
|
+
xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
14
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="http://www.jenitennison.com/xslt/xspec"
|
|
15
|
+
xmlns:pkg="http://expath.org/ns/pkg"
|
|
16
|
+
pkg:import-uri="http://www.jenitennison.com/xslt/xspec/basex/harness/standalone/xquery.xproc"
|
|
17
|
+
name="basex-standalone-xquery-harness" type="t:basex-standalone-xquery-harness" version="1.0">
|
|
18
|
+
|
|
19
|
+
<p:documentation>
|
|
20
|
+
<p>This pipeline executes an XSpec test suite with BaseX standalone.</p>
|
|
21
|
+
<p><b>Primary input:</b> A XSpec test suite document.</p>
|
|
22
|
+
<p><b>Primary output:</b> A formatted HTML XSpec report.</p>
|
|
23
|
+
<p>The dir where you unzipped the XSpec archive on your filesystem is passed in the option
|
|
24
|
+
'xspec-home'. The compiled test suite (the XQuery file to be actually evaluated) is saved
|
|
25
|
+
on the filesystem to be passed to BaseX. The name of this file is passed in the option
|
|
26
|
+
'compiled-file' (it defaults to a file in /tmp). The BaseX JAR file is passed through
|
|
27
|
+
'basex-jar'.</p>
|
|
28
|
+
</p:documentation>
|
|
29
|
+
|
|
30
|
+
<p:serialization port="result" indent="true"/>
|
|
31
|
+
|
|
32
|
+
<p:import href="../harness-lib.xpl"/>
|
|
33
|
+
|
|
34
|
+
<t:parameters name="params"/>
|
|
35
|
+
|
|
36
|
+
<p:group>
|
|
37
|
+
<p:variable name="xspec-home" select="/c:param-set/c:param[@name eq 'xspec-home']/@value">
|
|
38
|
+
<p:pipe step="params" port="parameters"/>
|
|
39
|
+
</p:variable>
|
|
40
|
+
<p:variable name="basex-jar" select="/c:param-set/c:param[@name eq 'basex-jar']/@value">
|
|
41
|
+
<p:pipe step="params" port="parameters"/>
|
|
42
|
+
</p:variable>
|
|
43
|
+
<!-- TODO: Use a robust way to get a tmp file name from the OS... -->
|
|
44
|
+
<p:variable name="compiled-file"
|
|
45
|
+
select="( /c:param-set/c:param[@name eq 'compiled-file']/@value,
|
|
46
|
+
'file:/tmp/xspec-basex-compiled-suite.xq' )[1]">
|
|
47
|
+
<p:pipe step="params" port="parameters"/>
|
|
48
|
+
</p:variable>
|
|
49
|
+
<p:variable name="utils-library-at"
|
|
50
|
+
select="/c:param-set/c:param[@name eq 'utils-library-at']/@value">
|
|
51
|
+
<p:pipe step="params" port="parameters"/>
|
|
52
|
+
</p:variable>
|
|
53
|
+
<!-- either no at location hint, or resolved from xspec-home if packaging not supported -->
|
|
54
|
+
<p:variable name="utils-lib"
|
|
55
|
+
select="if ( $utils-library-at ) then
|
|
56
|
+
$utils-library-at
|
|
57
|
+
else if ( $xspec-home ) then
|
|
58
|
+
resolve-uri('src/compiler/generate-query-utils.xql', $xspec-home)
|
|
59
|
+
else
|
|
60
|
+
''"/>
|
|
61
|
+
|
|
62
|
+
<!-- compile the suite into a query -->
|
|
63
|
+
<t:compile-xquery>
|
|
64
|
+
<p:with-param name="utils-library-at" select="$utils-lib"/>
|
|
65
|
+
</t:compile-xquery>
|
|
66
|
+
|
|
67
|
+
<!-- escape the query as text -->
|
|
68
|
+
<p:escape-markup name="escape"/>
|
|
69
|
+
|
|
70
|
+
<!-- store it on disk in order to pass it to BaseX -->
|
|
71
|
+
<p:store method="text" name="store">
|
|
72
|
+
<p:with-option name="href" select="$compiled-file"/>
|
|
73
|
+
</p:store>
|
|
74
|
+
|
|
75
|
+
<!-- run it on BaseX -->
|
|
76
|
+
<p:choose cx:depends-on="store">
|
|
77
|
+
<p:when test="p:value-available('basex-jar')">
|
|
78
|
+
<!-- use Java directly, rely on 'basex-jar' -->
|
|
79
|
+
<p:exec command="java">
|
|
80
|
+
<p:with-option name="args"
|
|
81
|
+
select="
|
|
82
|
+
string-join(
|
|
83
|
+
('-cp', $basex-jar, 'org.basex.BaseX', $compiled-file),
|
|
84
|
+
' ')"/>
|
|
85
|
+
<p:input port="source">
|
|
86
|
+
<p:empty/>
|
|
87
|
+
</p:input>
|
|
88
|
+
</p:exec>
|
|
89
|
+
</p:when>
|
|
90
|
+
<p:otherwise>
|
|
91
|
+
<!-- rely on a script 'basex' being in the PATH -->
|
|
92
|
+
<p:exec command="basex">
|
|
93
|
+
<p:with-option name="args" select="$compiled-file"/>
|
|
94
|
+
<p:input port="source">
|
|
95
|
+
<p:empty/>
|
|
96
|
+
</p:input>
|
|
97
|
+
</p:exec>
|
|
98
|
+
</p:otherwise>
|
|
99
|
+
</p:choose>
|
|
100
|
+
|
|
101
|
+
<!-- unwrap the exec step wrapper element -->
|
|
102
|
+
<p:unwrap match="/c:result"/>
|
|
103
|
+
|
|
104
|
+
<!-- format the report -->
|
|
105
|
+
<t:format-report/>
|
|
106
|
+
</p:group>
|
|
107
|
+
|
|
108
|
+
</p:pipeline>
|
|
109
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
110
|
+
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
|
|
111
|
+
<!-- -->
|
|
112
|
+
<!-- Copyright (c) 2011 Florent Georges -->
|
|
113
|
+
<!-- -->
|
|
114
|
+
<!-- The contents of this file are subject to the MIT License (see the URI -->
|
|
115
|
+
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
|
|
116
|
+
<!-- -->
|
|
117
|
+
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
|
|
118
|
+
<!-- a copy of this software and associated documentation files (the -->
|
|
119
|
+
<!-- "Software"), to deal in the Software without restriction, including -->
|
|
120
|
+
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
|
|
121
|
+
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
|
|
122
|
+
<!-- permit persons to whom the Software is furnished to do so, subject to -->
|
|
123
|
+
<!-- the following conditions: -->
|
|
124
|
+
<!-- -->
|
|
125
|
+
<!-- The above copyright notice and this permission notice shall be -->
|
|
126
|
+
<!-- included in all copies or substantial portions of the Software. -->
|
|
127
|
+
<!-- -->
|
|
128
|
+
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
|
|
129
|
+
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
|
|
130
|
+
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
|
|
131
|
+
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
|
|
132
|
+
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
|
|
133
|
+
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
|
|
134
|
+
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
|
|
135
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|