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,604 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- ===================================================================== -->
|
|
3
|
+
<!-- File: generate-common-tests.xsl -->
|
|
4
|
+
<!-- Author: Jeni Tennsion -->
|
|
5
|
+
<!-- URL: http://github.com/xspec/xspec -->
|
|
6
|
+
<!-- Tags: -->
|
|
7
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) -->
|
|
8
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
12
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
13
|
+
xmlns:test="http://www.jenitennison.com/xslt/unit-test"
|
|
14
|
+
xmlns:x="http://www.jenitennison.com/xslt/xspec"
|
|
15
|
+
xmlns:pkg="http://expath.org/ns/pkg"
|
|
16
|
+
exclude-result-prefixes="xs test x pkg"
|
|
17
|
+
version="2.0">
|
|
18
|
+
|
|
19
|
+
<pkg:import-uri>http://www.jenitennison.com/xslt/xspec/generate-common-tests.xsl</pkg:import-uri>
|
|
20
|
+
|
|
21
|
+
<xsl:preserve-space elements="x:space"/>
|
|
22
|
+
|
|
23
|
+
<!--
|
|
24
|
+
Drive the overall compilation of a suite. Apply template on
|
|
25
|
+
the x:description element, in the mode
|
|
26
|
+
-->
|
|
27
|
+
<xsl:template name="x:generate-tests">
|
|
28
|
+
<xsl:variable name="this" select="." as="document-node(element(x:description))"/>
|
|
29
|
+
<xsl:variable name="all-specs" as="document-node(element(x:description))">
|
|
30
|
+
<xsl:document>
|
|
31
|
+
<x:description>
|
|
32
|
+
<xsl:apply-templates select="$this/x:description" mode="x:copy-namespaces"/>
|
|
33
|
+
<xsl:copy-of select="$this/x:description/@*"/>
|
|
34
|
+
<xsl:apply-templates select="x:gather-specs($this/x:description)"
|
|
35
|
+
mode="x:gather-specs"/>
|
|
36
|
+
</x:description>
|
|
37
|
+
</xsl:document>
|
|
38
|
+
</xsl:variable>
|
|
39
|
+
<xsl:variable name="unshared-scenarios" as="document-node()">
|
|
40
|
+
<xsl:document>
|
|
41
|
+
<xsl:apply-templates select="$all-specs/*" mode="x:unshare-scenarios"/>
|
|
42
|
+
</xsl:document>
|
|
43
|
+
</xsl:variable>
|
|
44
|
+
<xsl:apply-templates select="$unshared-scenarios/*" mode="x:generate-tests"/>
|
|
45
|
+
</xsl:template>
|
|
46
|
+
|
|
47
|
+
<xsl:template match="x:description" mode="x:copy-namespaces">
|
|
48
|
+
<xsl:variable name="e" as="element()" select="."/>
|
|
49
|
+
<xsl:for-each select="in-scope-prefixes($e)">
|
|
50
|
+
<xsl:namespace name="{ . }" select="namespace-uri-for-prefix(., $e)"/>
|
|
51
|
+
</xsl:for-each>
|
|
52
|
+
</xsl:template>
|
|
53
|
+
|
|
54
|
+
<xsl:function name="x:gather-specs" as="element(x:description)+">
|
|
55
|
+
<xsl:param name="visit" as="element(x:description)+"/>
|
|
56
|
+
<xsl:variable name="imports" as="element(x:import)*"
|
|
57
|
+
select="$visit/x:import"/>
|
|
58
|
+
<xsl:variable name="imported" as="element(x:description)*"
|
|
59
|
+
select="document($imports/@href)/x:description"/>
|
|
60
|
+
<xsl:choose>
|
|
61
|
+
<xsl:when test="empty($imported except $visit)">
|
|
62
|
+
<xsl:sequence select="$visit"/>
|
|
63
|
+
</xsl:when>
|
|
64
|
+
<xsl:otherwise>
|
|
65
|
+
<xsl:sequence select="x:gather-specs($visit | $imported)"/>
|
|
66
|
+
</xsl:otherwise>
|
|
67
|
+
</xsl:choose>
|
|
68
|
+
</xsl:function>
|
|
69
|
+
|
|
70
|
+
<xsl:template match="x:description" mode="x:gather-specs">
|
|
71
|
+
<xsl:apply-templates mode="x:gather-specs">
|
|
72
|
+
<xsl:with-param name="xslt-version" tunnel="yes" select="
|
|
73
|
+
( @xslt-version, '2.0' )[1]"/>
|
|
74
|
+
<xsl:with-param name="preserve-space" tunnel="yes" select="
|
|
75
|
+
for $qname in tokenize(@preserve-space, '\s+') return
|
|
76
|
+
resolve-QName($qname, .)"/>
|
|
77
|
+
</xsl:apply-templates>
|
|
78
|
+
</xsl:template>
|
|
79
|
+
|
|
80
|
+
<xsl:template match="x:scenario" mode="x:gather-specs">
|
|
81
|
+
<xsl:param name="xslt-version" as="xs:string" tunnel="yes" required="yes"/>
|
|
82
|
+
<x:scenario xslt-version="{$xslt-version}">
|
|
83
|
+
<xsl:copy-of select="@*"/>
|
|
84
|
+
<xsl:apply-templates mode="x:gather-specs"/>
|
|
85
|
+
</x:scenario>
|
|
86
|
+
</xsl:template>
|
|
87
|
+
|
|
88
|
+
<xsl:template match="x:*/@href" mode="x:gather-specs">
|
|
89
|
+
<xsl:attribute name="href" select="resolve-uri(., base-uri(.))"/>
|
|
90
|
+
</xsl:template>
|
|
91
|
+
|
|
92
|
+
<xsl:template match="text()[not(normalize-space())]" mode="x:gather-specs">
|
|
93
|
+
<xsl:param name="preserve-space" as="xs:QName*" tunnel="yes" select="()"/>
|
|
94
|
+
<xsl:if test="parent::x:space
|
|
95
|
+
or ancestor::*[@xml:space][1]/@xml:space = 'preserve'
|
|
96
|
+
or node-name(parent::*) = $preserve-space">
|
|
97
|
+
<x:space>
|
|
98
|
+
<xsl:value-of select="."/>
|
|
99
|
+
</x:space>
|
|
100
|
+
</xsl:if>
|
|
101
|
+
</xsl:template>
|
|
102
|
+
|
|
103
|
+
<xsl:template match="node()|@*" mode="x:gather-specs">
|
|
104
|
+
<xsl:copy>
|
|
105
|
+
<xsl:apply-templates select="node()|@*" mode="x:gather-specs"/>
|
|
106
|
+
</xsl:copy>
|
|
107
|
+
</xsl:template>
|
|
108
|
+
|
|
109
|
+
<!--
|
|
110
|
+
Drive the compilation of scenarios to generate call
|
|
111
|
+
instructions (the scenarios are compiled to an XSLT named
|
|
112
|
+
template or an XQuery function, which must have the
|
|
113
|
+
corresponding call instruction at some point).
|
|
114
|
+
-->
|
|
115
|
+
<xsl:template name="x:call-scenarios">
|
|
116
|
+
<xsl:param name="pending" select="this//@focus" tunnel="yes" as="node()?"/>
|
|
117
|
+
<xsl:variable name="this" select="." as="element()"/>
|
|
118
|
+
<xsl:if test="empty($this[self::x:description|self::x:scenario])">
|
|
119
|
+
<xsl:sequence select="
|
|
120
|
+
error(
|
|
121
|
+
xs:QName('x:XSPEC006'),
|
|
122
|
+
concat('$this must be a description or a scenario, but is: ', name(.))
|
|
123
|
+
)"/>
|
|
124
|
+
</xsl:if>
|
|
125
|
+
<xsl:apply-templates select="$this/*[1]" mode="x:generate-calls">
|
|
126
|
+
<xsl:with-param name="pending" select="$pending" tunnel="yes"/>
|
|
127
|
+
</xsl:apply-templates>
|
|
128
|
+
</xsl:template>
|
|
129
|
+
|
|
130
|
+
<xsl:template name="x:continue-call-scenarios">
|
|
131
|
+
<!-- Continue walking the siblings. -->
|
|
132
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current"/>
|
|
133
|
+
</xsl:template>
|
|
134
|
+
|
|
135
|
+
<!--
|
|
136
|
+
Those elements are ignored in this mode.
|
|
137
|
+
|
|
138
|
+
x:label elements can be ignored, they are used by x:label()
|
|
139
|
+
(which selects either the x:label element or the label
|
|
140
|
+
attribute).
|
|
141
|
+
|
|
142
|
+
TODO: Imports are "resolved" in x:gather-specs(). But this is
|
|
143
|
+
not done the usual way, instead it returns all x:description
|
|
144
|
+
elements. Change this by using the usual recursive template
|
|
145
|
+
resolving x:import elements in place. Bur for now, those
|
|
146
|
+
elements are still here, so we have to ignore them...
|
|
147
|
+
-->
|
|
148
|
+
<xsl:template match="x:apply|x:call|x:context|x:import|x:label" mode="x:generate-calls">
|
|
149
|
+
<!-- Nothing, but must continue the sibling-walking... -->
|
|
150
|
+
<xsl:call-template name="x:continue-call-scenarios"/>
|
|
151
|
+
</xsl:template>
|
|
152
|
+
|
|
153
|
+
<!--
|
|
154
|
+
Default rule for that mode generates an error.
|
|
155
|
+
-->
|
|
156
|
+
<xsl:template match="@*|node()" mode="x:generate-calls">
|
|
157
|
+
<xsl:sequence select="
|
|
158
|
+
error(
|
|
159
|
+
xs:QName('x:XSPEC001'),
|
|
160
|
+
concat('Unhandled node in x:generate-calls mode: ', name(.))
|
|
161
|
+
)"/>
|
|
162
|
+
</xsl:template>
|
|
163
|
+
|
|
164
|
+
<!--
|
|
165
|
+
At x:pending elements, we switch the $pending tunnel param
|
|
166
|
+
value for children.
|
|
167
|
+
-->
|
|
168
|
+
<xsl:template match="x:pending" mode="x:generate-calls">
|
|
169
|
+
<xsl:apply-templates select="*[1]" mode="x:generate-calls">
|
|
170
|
+
<xsl:with-param name="pending" select="x:label(.)" tunnel="yes"/>
|
|
171
|
+
</xsl:apply-templates>
|
|
172
|
+
<!-- Continue walking the siblings. -->
|
|
173
|
+
<xsl:call-template name="x:continue-call-scenarios"/>
|
|
174
|
+
</xsl:template>
|
|
175
|
+
|
|
176
|
+
<!--
|
|
177
|
+
A scenario is called by the name { generate-id() }.
|
|
178
|
+
|
|
179
|
+
Call "x:output-call", which must on turn call "x:continue-call-scenarios".
|
|
180
|
+
-->
|
|
181
|
+
<xsl:template match="x:scenario" mode="x:generate-calls">
|
|
182
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
183
|
+
<xsl:call-template name="x:output-call">
|
|
184
|
+
<xsl:with-param name="name" select="generate-id()"/>
|
|
185
|
+
<xsl:with-param name="last" select="empty(following-sibling::x:scenario)"/>
|
|
186
|
+
<xsl:with-param name="params" as="element(param)*">
|
|
187
|
+
<xsl:for-each select="$vars">
|
|
188
|
+
<param name="{ @name }" select="${ @name }"/>
|
|
189
|
+
</xsl:for-each>
|
|
190
|
+
</xsl:with-param>
|
|
191
|
+
</xsl:call-template>
|
|
192
|
+
</xsl:template>
|
|
193
|
+
|
|
194
|
+
<!--
|
|
195
|
+
An expectation is called by the name { generate-id() }.
|
|
196
|
+
|
|
197
|
+
Call "x:output-call", which must on turn call "x:continue-call-scenarios".
|
|
198
|
+
-->
|
|
199
|
+
<xsl:template match="x:expect" mode="x:generate-calls">
|
|
200
|
+
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
|
|
201
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
202
|
+
<xsl:call-template name="x:output-call">
|
|
203
|
+
<xsl:with-param name="name" select="generate-id()"/>
|
|
204
|
+
<xsl:with-param name="last" select="empty(following-sibling::x:expect)"/>
|
|
205
|
+
<xsl:with-param name="params" as="element(param)*">
|
|
206
|
+
<xsl:if test="empty($pending|ancestor::x:scenario/@pending) or exists(ancestor::*/@focus)">
|
|
207
|
+
<param name="x:result" select="$x:result"/>
|
|
208
|
+
</xsl:if>
|
|
209
|
+
<xsl:for-each select="$vars">
|
|
210
|
+
<param name="{ @name }" select="${ @name }"/>
|
|
211
|
+
</xsl:for-each>
|
|
212
|
+
</xsl:with-param>
|
|
213
|
+
</xsl:call-template>
|
|
214
|
+
</xsl:template>
|
|
215
|
+
|
|
216
|
+
<!--
|
|
217
|
+
x:variable element generates a variable declaration and adds a
|
|
218
|
+
variable on the stack (the tunnel param $vars).
|
|
219
|
+
-->
|
|
220
|
+
<xsl:template match="x:variable" mode="x:generate-calls">
|
|
221
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
222
|
+
<!-- The variable declaration. -->
|
|
223
|
+
<xsl:if test="empty(following-sibling::x:call)">
|
|
224
|
+
<xsl:apply-templates select="." mode="test:generate-variable-declarations">
|
|
225
|
+
<xsl:with-param name="var" select="( @name, generate-id() )[1]"/>
|
|
226
|
+
<xsl:with-param name="type" select="'variable'"/>
|
|
227
|
+
</xsl:apply-templates>
|
|
228
|
+
</xsl:if>
|
|
229
|
+
<!-- Continue walking the siblings. -->
|
|
230
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current">
|
|
231
|
+
<xsl:with-param name="vars" tunnel="yes" as="element(var)+">
|
|
232
|
+
<xsl:sequence select="$vars"/>
|
|
233
|
+
<var name="{ @name }"/>
|
|
234
|
+
</xsl:with-param>
|
|
235
|
+
</xsl:apply-templates>
|
|
236
|
+
</xsl:template>
|
|
237
|
+
|
|
238
|
+
<!--
|
|
239
|
+
Global x:variable and x:param elements are not handled like
|
|
240
|
+
local variables and params (which are passed through calls).
|
|
241
|
+
They are declared globally.
|
|
242
|
+
-->
|
|
243
|
+
<xsl:template match="x:description/x:param|x:description/x:variable" mode="x:generate-calls">
|
|
244
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
245
|
+
<!-- Continue walking the siblings. -->
|
|
246
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current"/>
|
|
247
|
+
</xsl:template>
|
|
248
|
+
|
|
249
|
+
<!--
|
|
250
|
+
Drive the compilation of test suite params (aka global params
|
|
251
|
+
and variables).
|
|
252
|
+
-->
|
|
253
|
+
<xsl:template name="x:compile-params">
|
|
254
|
+
<xsl:variable name="this" select="." as="element(x:description)"/>
|
|
255
|
+
<xsl:apply-templates select="$this/(x:param|x:variable)" mode="x:generate-declarations"/>
|
|
256
|
+
</xsl:template>
|
|
257
|
+
|
|
258
|
+
<!--
|
|
259
|
+
Mode: compile.
|
|
260
|
+
|
|
261
|
+
Must be "fired" by the named template "x:compile-scenarios".
|
|
262
|
+
It is a "sibling walking" mode: x:compile-scenarios applies the
|
|
263
|
+
template in this mode on the first child, then each template
|
|
264
|
+
rule must apply the template in this same mode on the next
|
|
265
|
+
sibling. The reason for this navigation style is to easily
|
|
266
|
+
represent variable scopes.
|
|
267
|
+
-->
|
|
268
|
+
|
|
269
|
+
<!--
|
|
270
|
+
Drive the compilation of scenarios to either XSLT named
|
|
271
|
+
templates or XQuery functions.
|
|
272
|
+
-->
|
|
273
|
+
<xsl:template name="x:compile-scenarios">
|
|
274
|
+
<xsl:param name="pending" as="node()?" select="(.//@focus)[1]" tunnel="yes"/>
|
|
275
|
+
<xsl:variable name="this" select="." as="element()"/>
|
|
276
|
+
<xsl:if test="empty($this[self::x:description|self::x:scenario])">
|
|
277
|
+
<xsl:sequence select="
|
|
278
|
+
error(
|
|
279
|
+
xs:QName('x:XSPEC007'),
|
|
280
|
+
concat('$this must be a description or a scenario, but is: ', name(.))
|
|
281
|
+
)"/>
|
|
282
|
+
</xsl:if>
|
|
283
|
+
<xsl:apply-templates select="$this/*[1]" mode="x:compile">
|
|
284
|
+
<xsl:with-param name="pending" select="$pending" tunnel="yes"/>
|
|
285
|
+
</xsl:apply-templates>
|
|
286
|
+
</xsl:template>
|
|
287
|
+
|
|
288
|
+
<!--
|
|
289
|
+
At x:pending elements, we switch the $pending tunnel param
|
|
290
|
+
value for children.
|
|
291
|
+
-->
|
|
292
|
+
<xsl:template match="x:pending" mode="x:compile">
|
|
293
|
+
<xsl:apply-templates select="*[1]" mode="x:compile">
|
|
294
|
+
<xsl:with-param name="pending" select="x:label(.)" tunnel="yes"/>
|
|
295
|
+
</xsl:apply-templates>
|
|
296
|
+
<!-- Continue walking the siblings. -->
|
|
297
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current"/>
|
|
298
|
+
</xsl:template>
|
|
299
|
+
|
|
300
|
+
<!--
|
|
301
|
+
Compile a scenario.
|
|
302
|
+
-->
|
|
303
|
+
<xsl:template match="x:scenario" mode="x:compile">
|
|
304
|
+
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
|
|
305
|
+
<xsl:param name="apply" select="()" tunnel="yes" as="element(x:apply)?"/>
|
|
306
|
+
<xsl:param name="call" select="()" tunnel="yes" as="element(x:call)?"/>
|
|
307
|
+
<xsl:param name="context" select="()" tunnel="yes" as="element(x:context)?"/>
|
|
308
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
309
|
+
<!-- The new $pending. -->
|
|
310
|
+
<xsl:variable name="new-pending" as="node()?" select="
|
|
311
|
+
if ( @focus ) then
|
|
312
|
+
()
|
|
313
|
+
else if ( @pending ) then
|
|
314
|
+
@pending
|
|
315
|
+
else
|
|
316
|
+
$pending"/>
|
|
317
|
+
<!-- The new apply. -->
|
|
318
|
+
<xsl:variable name="new-apply" as="element(x:apply)?">
|
|
319
|
+
<xsl:choose>
|
|
320
|
+
<xsl:when test="x:apply">
|
|
321
|
+
<xsl:variable name="local-params" as="element(x:param)*" select="x:apply/x:param"/>
|
|
322
|
+
<x:apply>
|
|
323
|
+
<xsl:sequence select="$apply/@*"/>
|
|
324
|
+
<xsl:sequence select="x:apply/@*"/>
|
|
325
|
+
<xsl:sequence select="
|
|
326
|
+
$apply/x:param[not(@name = $local-params/@name)],
|
|
327
|
+
$local-params"/>
|
|
328
|
+
<!-- TODO: Test that "x:apply/(node() except x:param)" is empty. -->
|
|
329
|
+
</x:apply>
|
|
330
|
+
</xsl:when>
|
|
331
|
+
<xsl:otherwise>
|
|
332
|
+
<xsl:sequence select="$apply"/>
|
|
333
|
+
</xsl:otherwise>
|
|
334
|
+
</xsl:choose>
|
|
335
|
+
</xsl:variable>
|
|
336
|
+
<!-- The new context. -->
|
|
337
|
+
<xsl:variable name="new-context" as="element(x:context)?">
|
|
338
|
+
<xsl:choose>
|
|
339
|
+
<xsl:when test="x:context">
|
|
340
|
+
<xsl:variable name="local-params" as="element(x:param)*" select="x:context/x:param"/>
|
|
341
|
+
<x:context>
|
|
342
|
+
<xsl:sequence select="$context/@*"/>
|
|
343
|
+
<xsl:sequence select="x:context/@*"/>
|
|
344
|
+
<xsl:sequence select="
|
|
345
|
+
$context/x:param[not(@name = $local-params/@name)],
|
|
346
|
+
$local-params"/>
|
|
347
|
+
<xsl:sequence select="
|
|
348
|
+
if ( x:context/(node() except x:param) ) then
|
|
349
|
+
x:context/(node() except x:param)
|
|
350
|
+
else
|
|
351
|
+
$context/(node() except x:param)"/>
|
|
352
|
+
</x:context>
|
|
353
|
+
</xsl:when>
|
|
354
|
+
<xsl:otherwise>
|
|
355
|
+
<xsl:sequence select="$context"/>
|
|
356
|
+
</xsl:otherwise>
|
|
357
|
+
</xsl:choose>
|
|
358
|
+
</xsl:variable>
|
|
359
|
+
<!-- The new call. -->
|
|
360
|
+
<xsl:variable name="new-call" as="element(x:call)?">
|
|
361
|
+
<xsl:choose>
|
|
362
|
+
<xsl:when test="x:call">
|
|
363
|
+
<xsl:variable name="local-params" as="element(x:param)*" select="x:call/x:param"/>
|
|
364
|
+
<x:call>
|
|
365
|
+
<xsl:sequence select="$call/@*"/>
|
|
366
|
+
<xsl:sequence select="x:call/@*"/>
|
|
367
|
+
<xsl:sequence select="
|
|
368
|
+
$call/x:param[not(@name = $local-params/@name)],
|
|
369
|
+
$local-params"/>
|
|
370
|
+
<!-- TODO: Test that "x:call/(node() except x:param)" is empty. -->
|
|
371
|
+
</x:call>
|
|
372
|
+
</xsl:when>
|
|
373
|
+
<xsl:otherwise>
|
|
374
|
+
<xsl:sequence select="$call"/>
|
|
375
|
+
</xsl:otherwise>
|
|
376
|
+
</xsl:choose>
|
|
377
|
+
</xsl:variable>
|
|
378
|
+
<!-- Call the serializing template (for XSLT or XQuery). -->
|
|
379
|
+
<xsl:call-template name="x:output-scenario">
|
|
380
|
+
<xsl:with-param name="pending" select="$new-pending" tunnel="yes"/>
|
|
381
|
+
<xsl:with-param name="apply" select="$new-apply" tunnel="yes"/>
|
|
382
|
+
<xsl:with-param name="call" select="$new-call" tunnel="yes"/>
|
|
383
|
+
<xsl:with-param name="context" select="$new-context" tunnel="yes"/>
|
|
384
|
+
<!-- the variable declarations preceding the x:call (if any). -->
|
|
385
|
+
<xsl:with-param name="variables" select="x:call/preceding-sibling::x:variable"/>
|
|
386
|
+
<xsl:with-param name="params" as="element(param)*">
|
|
387
|
+
<xsl:for-each select="$vars">
|
|
388
|
+
<param name="{ @name }" required="yes"/>
|
|
389
|
+
</xsl:for-each>
|
|
390
|
+
</xsl:with-param>
|
|
391
|
+
</xsl:call-template>
|
|
392
|
+
<!-- Continue walking the siblings. -->
|
|
393
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current"/>
|
|
394
|
+
</xsl:template>
|
|
395
|
+
|
|
396
|
+
<!--
|
|
397
|
+
Compile an expectation.
|
|
398
|
+
-->
|
|
399
|
+
<xsl:template match="x:expect" mode="x:compile">
|
|
400
|
+
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
|
|
401
|
+
<xsl:param name="context" required="yes" tunnel="yes" as="element(x:context)?"/>
|
|
402
|
+
<xsl:param name="call" required="yes" tunnel="yes" as="element(x:call)?"/>
|
|
403
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
404
|
+
<!-- Call the serializing template (for XSLT or XQuery). -->
|
|
405
|
+
<xsl:call-template name="x:output-expect">
|
|
406
|
+
<xsl:with-param name="pending" tunnel="yes" select="
|
|
407
|
+
( $pending, ancestor::x:scenario/@pending )[1]"/>
|
|
408
|
+
<xsl:with-param name="context" tunnel="yes" select="$context"/>
|
|
409
|
+
<xsl:with-param name="call" tunnel="yes" select="$call"/>
|
|
410
|
+
<xsl:with-param name="params" as="element(param)*">
|
|
411
|
+
<xsl:if test="empty($pending|ancestor::x:scenario/@pending) or exists(ancestor::*/@focus)">
|
|
412
|
+
<param name="x:result" required="yes"/>
|
|
413
|
+
</xsl:if>
|
|
414
|
+
<xsl:for-each select="$vars">
|
|
415
|
+
<param name="{ @name }" required="yes"/>
|
|
416
|
+
</xsl:for-each>
|
|
417
|
+
</xsl:with-param>
|
|
418
|
+
</xsl:call-template>
|
|
419
|
+
<!-- Continue walking the siblings. -->
|
|
420
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current"/>
|
|
421
|
+
</xsl:template>
|
|
422
|
+
|
|
423
|
+
<!--
|
|
424
|
+
x:param elements generate actual call param's variable.
|
|
425
|
+
-->
|
|
426
|
+
<xsl:template match="x:param" mode="x:compile">
|
|
427
|
+
<xsl:apply-templates select="." mode="test:generate-variable-declarations">
|
|
428
|
+
<xsl:with-param name="var" select="( @name, generate-id() )[1]"/>
|
|
429
|
+
<xsl:with-param name="type" select="'variable'"/>
|
|
430
|
+
</xsl:apply-templates>
|
|
431
|
+
<!-- Continue walking the siblings (only other x:param elements, within this
|
|
432
|
+
x:call or x:context). -->
|
|
433
|
+
<xsl:apply-templates select="following-sibling::*[self::x:param][1]" mode="#current"/>
|
|
434
|
+
</xsl:template>
|
|
435
|
+
|
|
436
|
+
<!--
|
|
437
|
+
x:variable element adds a variable on the stack (the tunnel
|
|
438
|
+
param $vars).
|
|
439
|
+
-->
|
|
440
|
+
<xsl:template match="x:variable" mode="x:compile">
|
|
441
|
+
<xsl:param name="vars" select="()" tunnel="yes" as="element(var)*"/>
|
|
442
|
+
<!-- Continue walking the siblings, adding a new variable on the stack. -->
|
|
443
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current">
|
|
444
|
+
<xsl:with-param name="vars" tunnel="yes" as="element(var)+">
|
|
445
|
+
<xsl:sequence select="$vars"/>
|
|
446
|
+
<var name="{ @name }"/>
|
|
447
|
+
</xsl:with-param>
|
|
448
|
+
</xsl:apply-templates>
|
|
449
|
+
</xsl:template>
|
|
450
|
+
|
|
451
|
+
<!--
|
|
452
|
+
Those elements are ignored in this mode.
|
|
453
|
+
|
|
454
|
+
x:label elements can be ignored, they are used by x:label()
|
|
455
|
+
(which selects either the x:label element or the label
|
|
456
|
+
attribute).
|
|
457
|
+
|
|
458
|
+
TODO: Imports are "resolved" in x:gather-specs(). But this is
|
|
459
|
+
not done the usual way, instead it returns all x:description
|
|
460
|
+
elements. Change this by using the usual recursive template
|
|
461
|
+
resolving x:import elements in place. Bur for now, those
|
|
462
|
+
elements are still here, so we have to ignore them...
|
|
463
|
+
-->
|
|
464
|
+
<xsl:template match="x:description/x:param
|
|
465
|
+
|x:description/x:variable
|
|
466
|
+
|x:apply
|
|
467
|
+
|x:call
|
|
468
|
+
|x:context
|
|
469
|
+
|x:import
|
|
470
|
+
|x:label" mode="x:compile">
|
|
471
|
+
<!-- Nothing... -->
|
|
472
|
+
<!-- Continue walking the siblings. -->
|
|
473
|
+
<xsl:apply-templates select="following-sibling::*[1]" mode="#current"/>
|
|
474
|
+
</xsl:template>
|
|
475
|
+
|
|
476
|
+
<!--
|
|
477
|
+
Default rule for that mode generates an error.
|
|
478
|
+
-->
|
|
479
|
+
<xsl:template match="@*|node()" mode="x:compile">
|
|
480
|
+
<xsl:sequence select="
|
|
481
|
+
error(
|
|
482
|
+
xs:QName('x:XSPEC002'),
|
|
483
|
+
concat('Unhandled node in x:compile mode: ', name(.))
|
|
484
|
+
)"/>
|
|
485
|
+
</xsl:template>
|
|
486
|
+
|
|
487
|
+
<!-- *** x:unshare-scenarios *** -->
|
|
488
|
+
<!-- This mode resolves all the <like> elements to bring in the scenarios that
|
|
489
|
+
they specify -->
|
|
490
|
+
|
|
491
|
+
<xsl:template match="x:description" mode="x:unshare-scenarios">
|
|
492
|
+
<xsl:copy>
|
|
493
|
+
<xsl:apply-templates select="." mode="x:copy-namespaces"/>
|
|
494
|
+
<xsl:copy-of select="@*"/>
|
|
495
|
+
<xsl:apply-templates mode="x:unshare-scenarios"/>
|
|
496
|
+
</xsl:copy>
|
|
497
|
+
</xsl:template>
|
|
498
|
+
|
|
499
|
+
<xsl:template match="x:scenario" mode="x:unshare-scenarios">
|
|
500
|
+
<x:scenario>
|
|
501
|
+
<xsl:copy-of select="@* except @shared"/>
|
|
502
|
+
<xsl:apply-templates mode="x:unshare-scenarios"/>
|
|
503
|
+
</x:scenario>
|
|
504
|
+
</xsl:template>
|
|
505
|
+
|
|
506
|
+
<xsl:key name="scenarios" match="x:scenario" use="x:label(.)"/>
|
|
507
|
+
|
|
508
|
+
<xsl:template match="x:like" mode="x:unshare-scenarios">
|
|
509
|
+
<xsl:apply-templates select="key('scenarios', x:label(.))/*" mode="x:unshare-scenarios"/>
|
|
510
|
+
</xsl:template>
|
|
511
|
+
|
|
512
|
+
<xsl:template match="x:pending" mode="x:unshare-scenarios">
|
|
513
|
+
<x:pending>
|
|
514
|
+
<xsl:copy-of select="@*"/>
|
|
515
|
+
<xsl:apply-templates mode="x:unshare-scenarios"/>
|
|
516
|
+
</x:pending>
|
|
517
|
+
</xsl:template>
|
|
518
|
+
|
|
519
|
+
<xsl:template match="x:scenario[@shared = 'yes']" mode="x:unshare-scenarios"/>
|
|
520
|
+
|
|
521
|
+
<xsl:template match="node()" mode="x:unshare-scenarios">
|
|
522
|
+
<xsl:copy>
|
|
523
|
+
<xsl:copy-of select="@*"/>
|
|
524
|
+
<xsl:apply-templates mode="x:unshare-scenarios"/>
|
|
525
|
+
</xsl:copy>
|
|
526
|
+
</xsl:template>
|
|
527
|
+
|
|
528
|
+
<!--
|
|
529
|
+
Debugging tool. Return a human-readable path of a node.
|
|
530
|
+
-->
|
|
531
|
+
<xsl:function name="x:node-path" as="xs:string">
|
|
532
|
+
<xsl:param name="n" as="node()"/>
|
|
533
|
+
<xsl:value-of separator="">
|
|
534
|
+
<xsl:for-each select="$n/ancestor-or-self::*">
|
|
535
|
+
<xsl:variable name="prec" select="
|
|
536
|
+
preceding-sibling::*[node-name(.) eq node-name(current())]"/>
|
|
537
|
+
<xsl:text>/</xsl:text>
|
|
538
|
+
<xsl:value-of select="name(.)"/>
|
|
539
|
+
<xsl:if test="exists($prec)">
|
|
540
|
+
<xsl:text>[</xsl:text>
|
|
541
|
+
<xsl:value-of select="count($prec) + 1"/>
|
|
542
|
+
<xsl:text>]</xsl:text>
|
|
543
|
+
</xsl:if>
|
|
544
|
+
</xsl:for-each>
|
|
545
|
+
<xsl:choose>
|
|
546
|
+
<xsl:when test="$n instance of attribute()">
|
|
547
|
+
<xsl:text/>/@<xsl:value-of select="name($n)"/>
|
|
548
|
+
</xsl:when>
|
|
549
|
+
<xsl:when test="$n instance of text()">
|
|
550
|
+
<xsl:text>/{text: </xsl:text>
|
|
551
|
+
<xsl:value-of select="substring($n, 1, 5)"/>
|
|
552
|
+
<xsl:text>...}</xsl:text>
|
|
553
|
+
</xsl:when>
|
|
554
|
+
<xsl:when test="$n instance of comment()">
|
|
555
|
+
<xsl:text>/{comment}</xsl:text>
|
|
556
|
+
</xsl:when>
|
|
557
|
+
<xsl:when test="$n instance of processing-instruction()">
|
|
558
|
+
<xsl:text>/{pi: </xsl:text>
|
|
559
|
+
<xsl:value-of select="name($n)"/>
|
|
560
|
+
<xsl:text>}</xsl:text>
|
|
561
|
+
</xsl:when>
|
|
562
|
+
<xsl:when test="$n instance of document-node()">
|
|
563
|
+
<xsl:text>/</xsl:text>
|
|
564
|
+
</xsl:when>
|
|
565
|
+
<xsl:when test="$n instance of element()"/>
|
|
566
|
+
<xsl:otherwise>
|
|
567
|
+
<xsl:text>/{ns: </xsl:text>
|
|
568
|
+
<xsl:value-of select="name($n)"/>
|
|
569
|
+
<xsl:text>}</xsl:text>
|
|
570
|
+
</xsl:otherwise>
|
|
571
|
+
</xsl:choose>
|
|
572
|
+
</xsl:value-of>
|
|
573
|
+
</xsl:function>
|
|
574
|
+
|
|
575
|
+
</xsl:stylesheet>
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
579
|
+
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
|
|
580
|
+
<!-- -->
|
|
581
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
|
|
582
|
+
<!-- -->
|
|
583
|
+
<!-- The contents of this file are subject to the MIT License (see the URI -->
|
|
584
|
+
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
|
|
585
|
+
<!-- -->
|
|
586
|
+
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
|
|
587
|
+
<!-- a copy of this software and associated documentation files (the -->
|
|
588
|
+
<!-- "Software"), to deal in the Software without restriction, including -->
|
|
589
|
+
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
|
|
590
|
+
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
|
|
591
|
+
<!-- permit persons to whom the Software is furnished to do so, subject to -->
|
|
592
|
+
<!-- the following conditions: -->
|
|
593
|
+
<!-- -->
|
|
594
|
+
<!-- The above copyright notice and this permission notice shall be -->
|
|
595
|
+
<!-- included in all copies or substantial portions of the Software. -->
|
|
596
|
+
<!-- -->
|
|
597
|
+
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
|
|
598
|
+
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
|
|
599
|
+
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
|
|
600
|
+
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
|
|
601
|
+
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
|
|
602
|
+
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
|
|
603
|
+
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
|
|
604
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|