simple-xspec-wrapper 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/xspec +16 -0
- data/lib/xspec/version.rb +3 -0
- data/lib/xspec.rb +256 -0
- data/simple-xspec-wrapper.gemspec +28 -0
- data/spec-test.xml +1125 -0
- data/vendor/xspec-1.0.0/.gitignore +7 -0
- data/vendor/xspec-1.0.0/.travis.yml +57 -0
- data/vendor/xspec-1.0.0/LICENSE +21 -0
- data/vendor/xspec-1.0.0/README.md +26 -0
- data/vendor/xspec-1.0.0/appveyor.yml +77 -0
- data/vendor/xspec-1.0.0/bin/xspec.bat +620 -0
- data/vendor/xspec-1.0.0/bin/xspec.sh +403 -0
- data/vendor/xspec-1.0.0/build.xml +369 -0
- data/vendor/xspec-1.0.0/editors/emacs/README +31 -0
- data/vendor/xspec-1.0.0/editors/emacs/schemas.xml +6 -0
- data/vendor/xspec-1.0.0/editors/oxygen/.cvsignore +2 -0
- data/vendor/xspec-1.0.0/editors/oxygen/README +11 -0
- data/vendor/xspec-1.0.0/editors/oxygen/build.xml +38 -0
- data/vendor/xspec-1.0.0/editors/oxygen/templates/xspec.xml +17 -0
- data/vendor/xspec-1.0.0/editors/oxygen/xspec.framework +175 -0
- data/vendor/xspec-1.0.0/find-examples.xml +37 -0
- data/vendor/xspec-1.0.0/find-examples.xsl +615 -0
- data/vendor/xspec-1.0.0/graphics/3angle-down.gif +0 -0
- data/vendor/xspec-1.0.0/graphics/3angle-right.gif +0 -0
- data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class +0 -0
- data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java +209 -0
- data/vendor/xspec-1.0.0/src/ant/find-test-failure.xsl +17 -0
- data/vendor/xspec-1.0.0/src/ant/get-schematron-phase.xsl +17 -0
- data/vendor/xspec-1.0.0/src/ant/locate-schematron.xsl +28 -0
- data/vendor/xspec-1.0.0/src/ant/make-path.js +4 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-common-tests.xsl +604 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-helper.xsl +152 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-tests.xsl +473 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-utils.xql +263 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-tests-helper.xsl +169 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-tests-utils.xsl +479 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-xspec-tests.xsl +503 -0
- data/vendor/xspec-1.0.0/src/harnesses/basex/basex-standalone-xquery-harness.xproc +135 -0
- data/vendor/xspec-1.0.0/src/harnesses/basex/basex-xquery-harness.xproc +133 -0
- data/vendor/xspec-1.0.0/src/harnesses/exist/exist-xquery-harness.xproc +161 -0
- data/vendor/xspec-1.0.0/src/harnesses/harness-lib.xpl +327 -0
- data/vendor/xspec-1.0.0/src/harnesses/marklogic/ml-xquery-harness.xproc +143 -0
- data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xquery-harness.xproc +108 -0
- data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xslt-harness.xproc +85 -0
- data/vendor/xspec-1.0.0/src/harnesses/zorba/zorba-xquery-harness.xproc +134 -0
- data/vendor/xspec-1.0.0/src/reporter/coverage-report.xsl +378 -0
- data/vendor/xspec-1.0.0/src/reporter/format-utils.xsl +220 -0
- data/vendor/xspec-1.0.0/src/reporter/format-xspec-report-folding.xsl +164 -0
- data/vendor/xspec-1.0.0/src/reporter/format-xspec-report.xsl +410 -0
- data/vendor/xspec-1.0.0/src/reporter/junit-report.xsl +93 -0
- data/vendor/xspec-1.0.0/src/reporter/test-report.css +469 -0
- data/vendor/xspec-1.0.0/src/schemas/find-examples.rnc +90 -0
- data/vendor/xspec-1.0.0/src/schemas/xspec.rnc +304 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_abstract_expand.xsl +313 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_dsdl_include.xsl +1519 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message.xsl +64 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message_xslt2.xsl +64 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_saxon.xsl +2306 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl +1851 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt1.xsl +614 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl +692 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/readme.txt +101 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-cs.xhtml +56 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-de.xhtml +55 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-en.xhtml +57 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-fr.xhtml +54 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-ja.xhtml +53 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-nl.xhtml +58 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/schematron-skeleton-api.htm +723 -0
- data/vendor/xspec-1.0.0/src/schematron/sch-location-compare.xsl +139 -0
- data/vendor/xspec-1.0.0/src/schematron/schut-to-xspec.xsl +179 -0
- data/vendor/xspec-1.0.0/test/Makefile +117 -0
- data/vendor/xspec-1.0.0/test/README +5 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_catalog.xml +4 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_schematron.xspec +6 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_xslt.xspec +5 -0
- data/vendor/xspec-1.0.0/test/end-to-end/README.md +42 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/.gitignore +1 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/.gitignore +3 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-50-result-norm.html +74 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-55-result-norm.html +112 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-focus-1-result-norm.html +109 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-function-result-norm.html +118 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-import-result-norm.html +163 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-imported-result-norm.html +95 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-pending-result-norm.html +123 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-rule-result-norm.html +109 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-three-dots-result-norm.html +1237 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xsl +7 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xspec +10 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xsl +2 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xspec +18 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-focus-1.xspec +71 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-function.xspec +50 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-import.xspec +50 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-imported.xspec +48 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-pending.xspec +89 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-rule.xspec +76 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xsl +49 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xspec +527 -0
- data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.cmd +51 -0
- data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.sh +25 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_deserializer.xsl +53 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_normalizer.xsl +192 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_serializer.xsl +15 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_util.xsl +35 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/compare.xsl +88 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/normalize.xsl +28 -0
- data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.cmd +61 -0
- data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.sh +28 -0
- data/vendor/xspec-1.0.0/test/generate-tests-utils.xspec +636 -0
- data/vendor/xspec-1.0.0/test/generate-x-utils.xspec +173 -0
- data/vendor/xspec-1.0.0/test/generate-xspec-tests.xspec +64 -0
- data/vendor/xspec-1.0.0/test/run-xspec-tests.cmd +83 -0
- data/vendor/xspec-1.0.0/test/run-xspec-tests.sh +42 -0
- data/vendor/xspec-1.0.0/test/sch-location-compare.xspec +179 -0
- data/vendor/xspec-1.0.0/test/schematron/data/standards.xml +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-017.sch +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-018.sch +17 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-019.sch +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-020-01.sch +35 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-020.sch +32 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-021.sch +28 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-022.sch +18 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-compile.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-expand.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-include.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-out.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-out.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002.sch +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-in.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-in.xspec +20 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-out.xspec +22 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-in.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-out.xspec +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-in.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007.xml +2 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-in.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-import-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-out.xspec +10 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-import.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-01.xml +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-02.xml +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-out.xspec +81 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch.xsl +4 -0
- data/vendor/xspec-1.0.0/test/schematron-01.sch +17 -0
- data/vendor/xspec-1.0.0/test/schematron-01.xml +14 -0
- data/vendor/xspec-1.0.0/test/schematron-01.xspec +14 -0
- data/vendor/xspec-1.0.0/test/schematron-012.xspec +83 -0
- data/vendor/xspec-1.0.0/test/schematron-014-01.xml +10 -0
- data/vendor/xspec-1.0.0/test/schematron-014.sch +16 -0
- data/vendor/xspec-1.0.0/test/schematron-014.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron-015.sch +16 -0
- data/vendor/xspec-1.0.0/test/schematron-015.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron-016.sch +19 -0
- data/vendor/xspec-1.0.0/test/schematron-016.xspec +171 -0
- data/vendor/xspec-1.0.0/test/schematron-017.xspec +26 -0
- data/vendor/xspec-1.0.0/test/schematron-018.xspec +120 -0
- data/vendor/xspec-1.0.0/test/schematron-019.xspec +16 -0
- data/vendor/xspec-1.0.0/test/schematron-020.xspec +53 -0
- data/vendor/xspec-1.0.0/test/schematron-021.xspec +27 -0
- data/vendor/xspec-1.0.0/test/schematron-022.xspec +15 -0
- data/vendor/xspec-1.0.0/test/schematron-param-001.xspec +50 -0
- data/vendor/xspec-1.0.0/test/schut-to-xspec-012.sch +27 -0
- data/vendor/xspec-1.0.0/test/schut-to-xspec.xspec +85 -0
- data/vendor/xspec-1.0.0/test/unit-expect-xsl.xspec +28 -0
- data/vendor/xspec-1.0.0/test/xspec-26.xsl +19 -0
- data/vendor/xspec-1.0.0/test/xspec-26.xspec +17 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xml +2 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xsl +6 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xspec +8 -0
- data/vendor/xspec-1.0.0/test/xspec-33.xsl +7 -0
- data/vendor/xspec-1.0.0/test/xspec-33.xspec +15 -0
- data/vendor/xspec-1.0.0/test/xspec-46.xsl +7 -0
- data/vendor/xspec-1.0.0/test/xspec-46.xspec +9 -0
- data/vendor/xspec-1.0.0/test/xspec-72.xsl +13 -0
- data/vendor/xspec-1.0.0/test/xspec-72.xspec +19 -0
- data/vendor/xspec-1.0.0/test/xspec-bat.cmd +757 -0
- data/vendor/xspec-1.0.0/test/xspec-focus-2.xspec +91 -0
- data/vendor/xspec-1.0.0/test/xspec-junit.xspec +78 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xml +1003 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xslt +10 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xspec +13 -0
- data/vendor/xspec-1.0.0/test/xspec-tested.xql +44 -0
- data/vendor/xspec-1.0.0/test/xspec-tested.xsl +64 -0
- data/vendor/xspec-1.0.0/test/xspec-variable.xml +3 -0
- data/vendor/xspec-1.0.0/test/xspec-variable.xspec +58 -0
- data/vendor/xspec-1.0.0/test/xspec-xslt3.xsl +13 -0
- data/vendor/xspec-1.0.0/test/xspec-xslt3.xspec +12 -0
- data/vendor/xspec-1.0.0/test/xspec.bats +420 -0
- data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xslt +40 -0
- data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xspec +75 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.sch +17 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xml +11 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xspec +14 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseA.xspec +11 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseB.xspec +12 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import1.xspec +10 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import2.xspec +8 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import3.xspec +10 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.sch +58 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.xml +19 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc1.xml +6 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc2.xml +7 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.sch +29 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.xspec +63 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.sch +20 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.xspec +33 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/quickfix.sch +81 -0
- data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xq +8 -0
- data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xspec +16 -0
- data/vendor/xspec-1.0.0/xproject/project.xml +8 -0
- data/vendor/xspec-1.0.0/xproject/release-project.xsl +41 -0
- metadata +341 -0
@@ -0,0 +1,304 @@
|
|
1
|
+
# XSpec = XSLT Specifications
|
2
|
+
# This schema is for XSpec documents, which can be used to describe the behaviour
|
3
|
+
# of an XSLT application. They are similar to the RSpec documents used in RoR
|
4
|
+
# testing, but for XSLT
|
5
|
+
default namespace = "http://www.jenitennison.com/xslt/xspec"
|
6
|
+
datatypes xs = "http://www.w3.org/2001/XMLSchema-datatypes"
|
7
|
+
|
8
|
+
start = description
|
9
|
+
|
10
|
+
description =
|
11
|
+
## A description is a description of a stylesheet application.
|
12
|
+
## It must have a stylesheet and/or a query it's associated with.
|
13
|
+
## It may also have a version to aid development over time.
|
14
|
+
element description {
|
15
|
+
common-attributes,
|
16
|
+
attribute stylesheet { xs:anyURI }?,
|
17
|
+
attribute query { xs:anyURI }?,
|
18
|
+
attribute xslt-version { xs:NMTOKEN }?,
|
19
|
+
attribute query-at { xs:anyURI }?,
|
20
|
+
attribute version { xs:NMTOKEN }?,
|
21
|
+
attribute preserve-space { xs:NMTOKENS }?,
|
22
|
+
attribute schematron { xs:anyURI }?,
|
23
|
+
(global-param | import | scenario | pending)+ }
|
24
|
+
|
25
|
+
import =
|
26
|
+
## An import brings in all the scenarios from the referenced file (which must
|
27
|
+
## itself be an XSpec description). All the unshared scenarios in that imported
|
28
|
+
## XSpec will be run on the stylesheet that this XSpec document describes.
|
29
|
+
## Importing is recursive and may be circular (although only one copy of a given
|
30
|
+
## imported document will actually be imported).
|
31
|
+
element import { common-attributes,
|
32
|
+
## The document URI (location) of the imported document.
|
33
|
+
attribute href { xs:anyURI } }
|
34
|
+
|
35
|
+
pending =
|
36
|
+
## Anything that is within a <pending> element will remain untested, but will be
|
37
|
+
## reported as (eventual) desired behaviour. This is a good way of commenting out
|
38
|
+
## a set of behaviours that haven't been implemented yet, or scenarios whose
|
39
|
+
## desired behaviour hasn't been determined, or tests for code that you're not
|
40
|
+
## currently working on, to make the testing process faster.
|
41
|
+
##
|
42
|
+
## An optional label attribute can be used to describe why the scenario or
|
43
|
+
## assertion should not be tested.
|
44
|
+
element pending { common-attributes, label?, (scenario | assertion | schematron-assertion)* }
|
45
|
+
|
46
|
+
scenario =
|
47
|
+
## A scenario defines the environment in which a piece of processing takes place.
|
48
|
+
##
|
49
|
+
## Any parameters defined within a scenario equate to global (stylesheet)
|
50
|
+
## parameters.
|
51
|
+
##
|
52
|
+
## If a scenario has a pending attribute, this has the same semantics as
|
53
|
+
## wrapping the scenario in a <pending> element with a label equal to the value
|
54
|
+
## of the pending attribute.
|
55
|
+
##
|
56
|
+
## If any scenario has a focus attribute, any scenarios without a focus
|
57
|
+
## attribute will be classed as pending.
|
58
|
+
element scenario { common-scenario-attributes, shared?,
|
59
|
+
label,
|
60
|
+
( matching-scenario |
|
61
|
+
function-scenario |
|
62
|
+
named-scenario |
|
63
|
+
schematron-scenario ) }
|
64
|
+
|
65
|
+
common-scenario-attributes = common-attributes,
|
66
|
+
## Anything which has the @pending attribute will remain untested, but will be
|
67
|
+
## reported as (eventual) desired behaviour. This is a good way of commenting out
|
68
|
+
## a set of behaviours that haven't been implemented yet, or scenarios whose
|
69
|
+
## desired behaviour hasn't been determined, or tests for code that you're not
|
70
|
+
## currently working on, to make the testing process faster.
|
71
|
+
##
|
72
|
+
## The attribute value can be used to describe why the scenario or
|
73
|
+
## assertion should not be tested.
|
74
|
+
attribute pending { text }?,
|
75
|
+
## If any scenario has a focus attribute, any scenarios without a focus
|
76
|
+
## attribute will be classed as pending.
|
77
|
+
attribute focus { text }?
|
78
|
+
|
79
|
+
label =
|
80
|
+
## A scenario's label should describe the context that the scenario sets. Top-
|
81
|
+
## level scenarios' labels should be of the form "the square of a number" or
|
82
|
+
## "the XHTML for a <P1> element". Nested scenario labels will usually start with
|
83
|
+
## the word "with"; it should make sense if the labels of ancestor scenarios are
|
84
|
+
## concatenated with this one. For example "with a Type attribute".
|
85
|
+
attribute label { text } |
|
86
|
+
element label { any-content }
|
87
|
+
|
88
|
+
shared =
|
89
|
+
## There are shared scenarios (shared="yes") and unshared scenarios (shared="no",
|
90
|
+
## the default). Shared scenarios can be referenced and reused by other scenarios
|
91
|
+
## with the <like> element. Unshared scenarios are simply run.
|
92
|
+
attribute shared { "yes" | "no" }
|
93
|
+
|
94
|
+
like =
|
95
|
+
## The <like> element pulls a shared scenario into this one (which may be shared
|
96
|
+
## or unshared). Any environment set within the shared scenario is merged with
|
97
|
+
## this one, and any tests in the shared scenario are run in addition to the
|
98
|
+
## ones in this scenario. This allows for modular, reusable sets of tests which
|
99
|
+
## can be applied in multiple contexts.
|
100
|
+
element like { common-attributes, label }
|
101
|
+
|
102
|
+
## A matching scenario is one based on the application of templates to a
|
103
|
+
## particular node. The <context> element defines <xsl:apply-templates> used to
|
104
|
+
## process the node, and the <assertion> elements define the tests on that node.
|
105
|
+
## Child scenarios can override the parameters in the context, and can provide
|
106
|
+
## any missing values in the <context> (for example, if the context on the parent
|
107
|
+
## scenario doesn't provide a mode, that could be provided by the child scenario).
|
108
|
+
matching-scenario = context?,
|
109
|
+
like*,
|
110
|
+
(pending | assertion)*,
|
111
|
+
(pending |
|
112
|
+
element scenario { common-scenario-attributes,
|
113
|
+
label, matching-scenario })*
|
114
|
+
|
115
|
+
## A function scenario is one based on a call to a stylesheet function. The
|
116
|
+
## <call> element defines the function call and the paraemeters passed to it
|
117
|
+
## and the <assertion> elements test the result of the function. Child scenarios
|
118
|
+
## can override the parameters in the function call.
|
119
|
+
function-scenario = function-call?,
|
120
|
+
like*,
|
121
|
+
(pending | assertion)*,
|
122
|
+
(pending |
|
123
|
+
element scenario { common-scenario-attributes,
|
124
|
+
label, function-scenario })*
|
125
|
+
|
126
|
+
## A named scenario is one based on a call to a named template. The <call>
|
127
|
+
## element defines the template call and the parameters passed to it and the
|
128
|
+
## <assertion> elements test the result of the template call. Child scenarios
|
129
|
+
## can override the parameters in the template call.
|
130
|
+
named-scenario = context?,
|
131
|
+
template-call?,
|
132
|
+
like*,
|
133
|
+
(pending | assertion)*,
|
134
|
+
(pending |
|
135
|
+
element scenario { common-scenario-attributes,
|
136
|
+
label, named-scenario })*
|
137
|
+
|
138
|
+
context =
|
139
|
+
## The <context> element defines a context node, the mode in which templates
|
140
|
+
## are applied to it, and any parameters included in the apply templates.
|
141
|
+
element context {
|
142
|
+
common-attributes,
|
143
|
+
## The mode in which templates are applied to it, and any parameters included in the apply templates.
|
144
|
+
attribute mode { xs:QName }?,
|
145
|
+
template-param*,
|
146
|
+
node-selection
|
147
|
+
}
|
148
|
+
|
149
|
+
function-call =
|
150
|
+
## A <call> element either defines a function call or a template call and the
|
151
|
+
## parameters passed to it.
|
152
|
+
element call {
|
153
|
+
common-attributes,
|
154
|
+
## The qualified name of the function which should get called.
|
155
|
+
attribute function { xs:QName }?,
|
156
|
+
function-param*
|
157
|
+
}
|
158
|
+
|
159
|
+
template-call =
|
160
|
+
## A <call> element either defines a function call or a template call and the
|
161
|
+
## parameters passed to it.
|
162
|
+
element call {
|
163
|
+
common-attributes,
|
164
|
+
## The qualified name of the template which should get called.
|
165
|
+
attribute template { xs:QName }?,
|
166
|
+
template-param*
|
167
|
+
}
|
168
|
+
|
169
|
+
global-param =
|
170
|
+
## Global parameters are set globally, for the entire unit test suite. There's
|
171
|
+
## no way to set global parameters within a particular scenario (due to
|
172
|
+
## constraints on implementation).
|
173
|
+
element param { name, selection }
|
174
|
+
|
175
|
+
template-param = element param { common-attributes,
|
176
|
+
name, as?,
|
177
|
+
attribute tunnel { "yes" | "no" }?, selection }
|
178
|
+
|
179
|
+
function-param = element param { common-attributes,
|
180
|
+
name?, as?, position?, selection }
|
181
|
+
|
182
|
+
name = attribute name { xs:QName }
|
183
|
+
|
184
|
+
position = attribute position { xs:integer }
|
185
|
+
|
186
|
+
as = attribute as { text }
|
187
|
+
|
188
|
+
selection = node-selection | value-selection
|
189
|
+
|
190
|
+
node-selection =
|
191
|
+
## The document URI (location) of the imported document.
|
192
|
+
attribute href { xs:anyURI }?,
|
193
|
+
## The XPath expression to access the selected node.
|
194
|
+
attribute select { xpath }?,
|
195
|
+
any-content
|
196
|
+
|
197
|
+
value-selection =
|
198
|
+
## The XPath expression to access the selected node.
|
199
|
+
attribute select { xpath }
|
200
|
+
|
201
|
+
xpath = text
|
202
|
+
|
203
|
+
assertion =
|
204
|
+
## An assertion's test XPath can either return a boolean value, in which case the
|
205
|
+
## assertion succeeds only if the test is true; or a node, in which case the
|
206
|
+
## assertion succeeds only if the node is equal to the one specified with the
|
207
|
+
## href and select attributes or content of the <expect> element.
|
208
|
+
element expect { common-attributes,
|
209
|
+
label, test?, selection }
|
210
|
+
|
211
|
+
test = attribute test { xpath }
|
212
|
+
|
213
|
+
common-attributes = attribute xml:* { text }*
|
214
|
+
|
215
|
+
any-content = mixed { any-element* }
|
216
|
+
any-element = element * { attribute * { text }*, any-content }
|
217
|
+
|
218
|
+
schematron-scenario = context?,
|
219
|
+
like*,
|
220
|
+
(pending | schematron-assertion | assertion)*,
|
221
|
+
(pending |
|
222
|
+
element scenario { common-scenario-attributes,
|
223
|
+
label, schematron-scenario })*
|
224
|
+
|
225
|
+
schematron-assertion =
|
226
|
+
expect-assert | expect-not-assert |
|
227
|
+
expect-report | expect-not-report |
|
228
|
+
expect-valid | expect-rule
|
229
|
+
|
230
|
+
expect-valid =
|
231
|
+
## In a Schematron test, verify that the Schematron is executed and the XML
|
232
|
+
## that is provided as context passes validation.
|
233
|
+
##
|
234
|
+
## In the Schematron an <assert> or <report> can have a <role> attribute
|
235
|
+
## specifying that it is a warning or informational message and these are
|
236
|
+
## considered to be allowed for a passing validation.
|
237
|
+
element expect-valid { empty }
|
238
|
+
|
239
|
+
expect-assert =
|
240
|
+
## In a Schematron test, verify that an <assert> is thrown.
|
241
|
+
##
|
242
|
+
## The attributes id, role, and location can be used in combination to
|
243
|
+
## identify a specific <assert>.
|
244
|
+
element expect-assert {
|
245
|
+
schematron-common-expect,
|
246
|
+
schematron-count-expect
|
247
|
+
}
|
248
|
+
expect-report =
|
249
|
+
## In a Schematron test, verify that a <report> is thrown.
|
250
|
+
##
|
251
|
+
## The attributes id, role, and location can be used in combination to
|
252
|
+
## identify a specific <report>.
|
253
|
+
element expect-report {
|
254
|
+
schematron-common-expect,
|
255
|
+
schematron-count-expect
|
256
|
+
}
|
257
|
+
|
258
|
+
expect-not-assert =
|
259
|
+
## In a Schematron test, verify that an <assert> is not thrown.
|
260
|
+
##
|
261
|
+
## The attributes id, role, and location can be used in combination to
|
262
|
+
## identify a specific <assert>.
|
263
|
+
element expect-not-assert {
|
264
|
+
schematron-common-expect
|
265
|
+
}
|
266
|
+
expect-not-report =
|
267
|
+
## In a Schematron test, verify that a <report> is not thrown.
|
268
|
+
##
|
269
|
+
## The attributes id, role, and location can be used in combination to
|
270
|
+
## identify a specific <report>.
|
271
|
+
element expect-not-report {
|
272
|
+
schematron-common-expect
|
273
|
+
}
|
274
|
+
|
275
|
+
expect-rule =
|
276
|
+
## In a Schematron test, verify that a <rule> is fired.
|
277
|
+
element expect-rule {
|
278
|
+
## Optional label to describe the expectation.
|
279
|
+
attribute label { text }?,
|
280
|
+
## Identify a specific <rule> using its id attribute.
|
281
|
+
attribute id { xs:NCName }?,
|
282
|
+
## Match a specific context attribute value of a <rule>.
|
283
|
+
attribute context { text }?,
|
284
|
+
schematron-count-expect
|
285
|
+
}
|
286
|
+
|
287
|
+
schematron-common-expect =
|
288
|
+
## Optional label to describe the expectation.
|
289
|
+
attribute label { text }?,
|
290
|
+
## Identify a specific <assert> or <report> using its id attribute or
|
291
|
+
## the id attribute of the parent <rule>.
|
292
|
+
attribute id { xs:NCName }?,
|
293
|
+
## Match a specific role attribute value of an <assert> or <report> or
|
294
|
+
## the parent <rule>. Role attribute values are often used to specify
|
295
|
+
## 'error', 'fatal', 'warn', 'warning', 'info', 'information'.
|
296
|
+
attribute role { text }?,
|
297
|
+
## XPath of a location in the context XML that the <assert> or <report>
|
298
|
+
## is expected to find. Namespace prefixes that are defined in Schematron
|
299
|
+
## using ns elements can be used.
|
300
|
+
attribute location { xpath }?
|
301
|
+
|
302
|
+
schematron-count-expect =
|
303
|
+
## Number of times an <assert> or <report> is expected to be thrown.
|
304
|
+
attribute count { xs:nonNegativeInteger }?
|
@@ -0,0 +1,313 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><?xar XSLT?>
|
2
|
+
|
3
|
+
<!--
|
4
|
+
OVERVIEW - iso_abstract_expand.xsl
|
5
|
+
|
6
|
+
This is a preprocessor for ISO Schematron, which implements abstract patterns.
|
7
|
+
It also
|
8
|
+
* extracts a particular schema using an ID, where there are multiple
|
9
|
+
schemas, such as when they are embedded in the same NVDL script
|
10
|
+
* allows parameter substitution inside @context, @test, @select, @path
|
11
|
+
* experimentally, allows parameter recognition and substitution inside
|
12
|
+
text (NOTE: to be removed, for compataibility with other implementations,
|
13
|
+
please do not use this)
|
14
|
+
|
15
|
+
This should be used after iso-dsdl-include.xsl and before the skeleton or
|
16
|
+
meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1.
|
17
|
+
|
18
|
+
Each kind of inclusion can be turned off (or on) on the command line.
|
19
|
+
|
20
|
+
-->
|
21
|
+
|
22
|
+
<!--
|
23
|
+
Open Source Initiative OSI - The MIT License:Licensing
|
24
|
+
[OSI Approved License]
|
25
|
+
|
26
|
+
This source code was previously available under the zlib/libpng license.
|
27
|
+
Attribution is polite.
|
28
|
+
|
29
|
+
The MIT License
|
30
|
+
|
31
|
+
Copyright (c) 2004-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan
|
32
|
+
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
34
|
+
of this software and associated documentation files (the "Software"), to deal
|
35
|
+
in the Software without restriction, including without limitation the rights
|
36
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
37
|
+
copies of the Software, and to permit persons to whom the Software is
|
38
|
+
furnished to do so, subject to the following conditions:
|
39
|
+
|
40
|
+
The above copyright notice and this permission notice shall be included in
|
41
|
+
all copies or substantial portions of the Software.
|
42
|
+
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
46
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
47
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
48
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
49
|
+
THE SOFTWARE.
|
50
|
+
-->
|
51
|
+
|
52
|
+
<!--
|
53
|
+
VERSION INFORMATION
|
54
|
+
2013-09-19 RJ
|
55
|
+
* Allow macro expansion in @path attributes, eg. for sch:name/@path
|
56
|
+
|
57
|
+
2010-07-10 RJ
|
58
|
+
* Move to MIT license
|
59
|
+
|
60
|
+
2008-09-18 RJ
|
61
|
+
* move out param test from iso:schema template to work with XSLT 1. (Noah Fontes)
|
62
|
+
|
63
|
+
2008-07-29 RJ
|
64
|
+
* Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl
|
65
|
+
* Put everything in private namespace
|
66
|
+
* Rewrite replace_substring named template so that copyright is clear
|
67
|
+
|
68
|
+
2008-07-24 RJ
|
69
|
+
* correct abstract patterns so for correct names: param/@name and
|
70
|
+
param/@value
|
71
|
+
|
72
|
+
2007-01-12 RJ
|
73
|
+
* Use ISO namespace
|
74
|
+
* Use pattern/@id not pattern/@name
|
75
|
+
* Add Oliver Becker's suggests from old Schematron-love-in list for <copy>
|
76
|
+
* Add XT -ism?
|
77
|
+
2003 RJ
|
78
|
+
* Original written for old namespace
|
79
|
+
* http://www.topologi.com/resources/iso-pre-pro.xsl
|
80
|
+
-->
|
81
|
+
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
|
82
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
83
|
+
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
|
84
|
+
xmlns:nvdl="http://purl.oclc.org/dsdl/nvdl"
|
85
|
+
|
86
|
+
xmlns:iae="http://www.schematron.com/namespace/iae"
|
87
|
+
|
88
|
+
>
|
89
|
+
|
90
|
+
<xslt:param name="schema-id"></xslt:param>
|
91
|
+
|
92
|
+
|
93
|
+
<!-- Driver for the mode -->
|
94
|
+
<xsl:template match="/">
|
95
|
+
<xsl:apply-templates select="." mode="iae:go" />
|
96
|
+
</xsl:template>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- ================================================================================== -->
|
100
|
+
<!-- Normal processing rules -->
|
101
|
+
<!-- ================================================================================== -->
|
102
|
+
<!-- Output only the selected schema -->
|
103
|
+
<xslt:template match="iso:schema" >
|
104
|
+
<xsl:if test="string-length($schema-id) =0 or @id= $schema-id ">
|
105
|
+
<xslt:copy>
|
106
|
+
<xslt:copy-of select="@*" />
|
107
|
+
<xslt:apply-templates mode="iae:go" />
|
108
|
+
</xslt:copy>
|
109
|
+
</xsl:if>
|
110
|
+
</xslt:template>
|
111
|
+
|
112
|
+
|
113
|
+
<!-- Strip out any foreign elements above the Schematron schema .
|
114
|
+
-->
|
115
|
+
<xslt:template match="*[not(ancestor-or-self::iso:*)]" mode="iae:go" >
|
116
|
+
<xslt:apply-templates mode="iae:go" />
|
117
|
+
</xslt:template>
|
118
|
+
|
119
|
+
|
120
|
+
<!-- ================================================================================== -->
|
121
|
+
<!-- Handle Schematron abstract pattern preprocessing -->
|
122
|
+
<!-- abstract-to-real calls
|
123
|
+
do-pattern calls
|
124
|
+
macro-expand calls
|
125
|
+
multi-macro-expand
|
126
|
+
replace-substring -->
|
127
|
+
<!-- ================================================================================== -->
|
128
|
+
|
129
|
+
<!--
|
130
|
+
Abstract patterns allow you to say, for example
|
131
|
+
|
132
|
+
<pattern name="htmlTable" is-a="table">
|
133
|
+
<param name="row" value="html:tr"/>
|
134
|
+
<param name="cell" value="html:td" />
|
135
|
+
<param name="table" value="html:table" />
|
136
|
+
</pattern>
|
137
|
+
|
138
|
+
For a good introduction, see Uche Ogbujii's article for IBM DeveloperWorks
|
139
|
+
"Discover the flexibility of Schematron abstract patterns"
|
140
|
+
http://www-128.ibm.com/developerworks/xml/library/x-stron.html
|
141
|
+
However, note that ISO Schematron uses @name and @value attributes on
|
142
|
+
the iso:param element, and @id not @name on the pattern element.
|
143
|
+
|
144
|
+
-->
|
145
|
+
|
146
|
+
<!-- Suppress declarations of abstract patterns -->
|
147
|
+
<xslt:template match="iso:pattern[@abstract='true']" mode="iae:go" >
|
148
|
+
<xslt:comment>Suppressed abstract pattern <xslt:value-of select="@id"/> was here</xslt:comment>
|
149
|
+
</xslt:template>
|
150
|
+
|
151
|
+
|
152
|
+
<!-- Suppress uses of abstract patterns -->
|
153
|
+
<xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
|
154
|
+
|
155
|
+
<xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>
|
156
|
+
|
157
|
+
<xslt:call-template name="iae:abstract-to-real" >
|
158
|
+
<xslt:with-param name="caller" select="@id" />
|
159
|
+
<xslt:with-param name="is-a" select="@is-a" />
|
160
|
+
</xslt:call-template>
|
161
|
+
|
162
|
+
</xslt:template>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<!-- output everything else unchanged -->
|
167
|
+
<xslt:template match="*" priority="-1" mode="iae:go" >
|
168
|
+
<xslt:copy>
|
169
|
+
<xslt:copy-of select="@*" />
|
170
|
+
<xslt:apply-templates mode="iae:go"/>
|
171
|
+
</xslt:copy>
|
172
|
+
</xslt:template>
|
173
|
+
|
174
|
+
<!-- Templates for macro expansion of abstract patterns -->
|
175
|
+
<!-- Sets up the initial conditions for the recursive call -->
|
176
|
+
<xslt:template name="iae:macro-expand">
|
177
|
+
<xslt:param name="caller"/>
|
178
|
+
<xslt:param name="text" />
|
179
|
+
<xslt:call-template name="iae:multi-macro-expand">
|
180
|
+
<xslt:with-param name="caller" select="$caller"/>
|
181
|
+
<xslt:with-param name="text" select="$text"/>
|
182
|
+
<xslt:with-param name="paramNumber" select="1"/>
|
183
|
+
</xslt:call-template>
|
184
|
+
|
185
|
+
</xslt:template>
|
186
|
+
|
187
|
+
<!-- Template to replace the current parameter and then
|
188
|
+
recurse to replace subsequent parameters. -->
|
189
|
+
|
190
|
+
<xslt:template name="iae:multi-macro-expand">
|
191
|
+
<xslt:param name="caller"/>
|
192
|
+
<xslt:param name="text" />
|
193
|
+
<xslt:param name="paramNumber" />
|
194
|
+
|
195
|
+
|
196
|
+
<xslt:choose>
|
197
|
+
<xslt:when test="//iso:pattern[@id=$caller]/iso:param[ $paramNumber]">
|
198
|
+
|
199
|
+
<xslt:call-template name="iae:multi-macro-expand">
|
200
|
+
<xslt:with-param name="caller" select="$caller"/>
|
201
|
+
<xslt:with-param name="paramNumber" select="$paramNumber + 1"/>
|
202
|
+
<xslt:with-param name="text" >
|
203
|
+
<xslt:call-template name="iae:replace-substring">
|
204
|
+
<xslt:with-param name="original" select="$text"/>
|
205
|
+
<xslt:with-param name="substring"
|
206
|
+
select="concat('$', //iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@name)"/>
|
207
|
+
<xslt:with-param name="replacement"
|
208
|
+
select="//iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@value"/>
|
209
|
+
</xslt:call-template>
|
210
|
+
</xslt:with-param>
|
211
|
+
</xslt:call-template>
|
212
|
+
</xslt:when>
|
213
|
+
<xslt:otherwise><xslt:value-of select="$text" /></xslt:otherwise>
|
214
|
+
|
215
|
+
</xslt:choose>
|
216
|
+
</xslt:template>
|
217
|
+
|
218
|
+
|
219
|
+
<!-- generate the real pattern from an abstract pattern + parameters-->
|
220
|
+
<xslt:template name="iae:abstract-to-real" >
|
221
|
+
<xslt:param name="caller"/>
|
222
|
+
<xslt:param name="is-a" />
|
223
|
+
<xslt:for-each select="//iso:pattern[@id= $is-a]">
|
224
|
+
<xslt:copy>
|
225
|
+
|
226
|
+
<xslt:choose>
|
227
|
+
<xslt:when test=" string-length( $caller ) = 0">
|
228
|
+
<xslt:attribute name="id"><xslt:value-of select="concat( generate-id(.) , $is-a)" /></xslt:attribute>
|
229
|
+
</xslt:when>
|
230
|
+
<xslt:otherwise>
|
231
|
+
<xslt:attribute name="id"><xslt:value-of select="$caller" /></xslt:attribute>
|
232
|
+
</xslt:otherwise>
|
233
|
+
</xslt:choose>
|
234
|
+
|
235
|
+
<xslt:apply-templates select="*|text()" mode="iae:do-pattern" >
|
236
|
+
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
237
|
+
</xslt:apply-templates>
|
238
|
+
|
239
|
+
</xslt:copy>
|
240
|
+
</xslt:for-each>
|
241
|
+
</xslt:template>
|
242
|
+
|
243
|
+
|
244
|
+
<!-- Generate a non-abstract pattern -->
|
245
|
+
<xslt:template mode="iae:do-pattern" match="*">
|
246
|
+
<xslt:param name="caller"/>
|
247
|
+
<xslt:copy>
|
248
|
+
<xslt:for-each select="@*[name()='test' or name()='context' or name()='select' or name()='path' ]">
|
249
|
+
<xslt:attribute name="{name()}">
|
250
|
+
<xslt:call-template name="iae:macro-expand">
|
251
|
+
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
|
252
|
+
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
253
|
+
</xslt:call-template>
|
254
|
+
</xslt:attribute>
|
255
|
+
</xslt:for-each>
|
256
|
+
<xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select'][name()!='path']" />
|
257
|
+
<xsl:for-each select="node()">
|
258
|
+
<xsl:choose>
|
259
|
+
<!-- Experiment: replace macros in text as well, to allow parameterized assertions
|
260
|
+
and so on, without having to have spurious <iso:value-of> calls and multiple
|
261
|
+
delimiting.
|
262
|
+
NOTE: THIS FUNCTIONALITY WILL BE REMOVED IN THE FUTURE -->
|
263
|
+
<xsl:when test="self::text()">
|
264
|
+
<xslt:call-template name="iae:macro-expand">
|
265
|
+
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
|
266
|
+
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
267
|
+
</xslt:call-template>
|
268
|
+
</xsl:when>
|
269
|
+
<xsl:otherwise>
|
270
|
+
<xslt:apply-templates select="." mode="iae:do-pattern">
|
271
|
+
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
272
|
+
</xslt:apply-templates>
|
273
|
+
</xsl:otherwise>
|
274
|
+
</xsl:choose>
|
275
|
+
</xsl:for-each>
|
276
|
+
</xslt:copy>
|
277
|
+
</xslt:template>
|
278
|
+
|
279
|
+
<!-- UTILITIES -->
|
280
|
+
<!-- Simple version of replace-substring function -->
|
281
|
+
<xslt:template name="iae:replace-substring">
|
282
|
+
<xslt:param name="original" />
|
283
|
+
<xslt:param name="substring" />
|
284
|
+
<xslt:param name="replacement" select="''"/>
|
285
|
+
|
286
|
+
<xsl:choose>
|
287
|
+
<xsl:when test="not($original)" />
|
288
|
+
<xsl:when test="not(string($substring))">
|
289
|
+
<xsl:value-of select="$original" />
|
290
|
+
</xsl:when>
|
291
|
+
<xsl:when test="contains($original, $substring)">
|
292
|
+
<xsl:variable name="before" select="substring-before($original, $substring)" />
|
293
|
+
<xsl:variable name="after" select="substring-after($original, $substring)" />
|
294
|
+
|
295
|
+
<xsl:value-of select="$before" />
|
296
|
+
<xsl:value-of select="$replacement" />
|
297
|
+
<!-- recursion -->
|
298
|
+
<xsl:call-template name="iae:replace-substring">
|
299
|
+
<xsl:with-param name="original" select="$after" />
|
300
|
+
<xsl:with-param name="substring" select="$substring" />
|
301
|
+
<xsl:with-param name="replacement" select="$replacement" />
|
302
|
+
</xsl:call-template>
|
303
|
+
</xsl:when>
|
304
|
+
<xsl:otherwise>
|
305
|
+
<!-- no substitution -->
|
306
|
+
<xsl:value-of select="$original" />
|
307
|
+
</xsl:otherwise>
|
308
|
+
</xsl:choose>
|
309
|
+
</xslt:template>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
</xslt:stylesheet>
|