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,263 @@
|
|
1
|
+
module namespace test = "http://www.jenitennison.com/xslt/unit-test";
|
2
|
+
|
3
|
+
(::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
|
4
|
+
(: File: generate-query-utils.xql :)
|
5
|
+
(: Author: Jeni Tennsion :)
|
6
|
+
(: URL: http://github.com/xspec/xspec :)
|
7
|
+
(: Tags: :)
|
8
|
+
(: Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) :)
|
9
|
+
(: ------------------------------------------------------------------------ :)
|
10
|
+
|
11
|
+
|
12
|
+
declare namespace fn = "http://www.w3.org/2005/xpath-functions";
|
13
|
+
|
14
|
+
declare function test:deep-equal($seq1 as item()*, $seq2 as item()*) as xs:boolean
|
15
|
+
{
|
16
|
+
test:deep-equal($seq1, $seq2, 2.0)
|
17
|
+
};
|
18
|
+
|
19
|
+
declare function test:deep-equal(
|
20
|
+
$seq1 as item()*,
|
21
|
+
$seq2 as item()*,
|
22
|
+
$version as xs:double
|
23
|
+
) as xs:boolean
|
24
|
+
{
|
25
|
+
if ( $version = 1.0 ) then
|
26
|
+
if ( $seq1 instance of xs:string and $seq2 instance of text()+ ) then
|
27
|
+
test:deep-equal($seq1, fn:string-join($seq2, ''))
|
28
|
+
else if ( $seq1 instance of xs:double and $seq2 instance of text()+ ) then
|
29
|
+
test:deep-equal($seq1, xs:double(fn:string-join($seq2, '')))
|
30
|
+
else if ( $seq1 instance of xs:decimal and $seq2 instance of text()+ ) then
|
31
|
+
test:deep-equal($seq1, xs:decimal(fn:string-join($seq2, '')))
|
32
|
+
else if ( $seq1 instance of xs:integer and $seq2 instance of text()+ ) then
|
33
|
+
test:deep-equal($seq1, xs:integer(fn:string-join($seq2, '')))
|
34
|
+
else
|
35
|
+
test:deep-equal($seq1, $seq2)
|
36
|
+
else if ( fn:empty($seq1) or fn:empty($seq2) ) then
|
37
|
+
fn:empty($seq1) and fn:empty($seq2)
|
38
|
+
else if ( fn:count($seq1) = fn:count($seq2) ) then
|
39
|
+
every $i in (1 to fn:count($seq1))
|
40
|
+
satisfies test:item-deep-equal($seq1[$i], $seq2[$i])
|
41
|
+
else if ( $seq1 instance of text() and $seq2 instance of text()+ ) then
|
42
|
+
test:deep-equal($seq1, text { fn:string-join($seq2, '') })
|
43
|
+
else
|
44
|
+
fn:false()
|
45
|
+
};
|
46
|
+
|
47
|
+
declare function test:item-deep-equal($item1 as item(), $item2 as item()) as xs:boolean
|
48
|
+
{
|
49
|
+
if ( $item1 instance of node() and $item2 instance of node() ) then
|
50
|
+
test:node-deep-equal($item1, $item2)
|
51
|
+
else if ( fn:not($item1 instance of node()) and fn:not($item2 instance of node()) ) then
|
52
|
+
fn:deep-equal($item1, $item2)
|
53
|
+
else
|
54
|
+
fn:false()
|
55
|
+
};
|
56
|
+
|
57
|
+
declare function test:node-deep-equal($node1 as node(), $node2 as node()) as xs:boolean
|
58
|
+
{
|
59
|
+
if ( $node1 instance of document-node() and $node2 instance of document-node() ) then
|
60
|
+
test:deep-equal(test:sorted-children($node1), test:sorted-children($node2))
|
61
|
+
else if ( $node1 instance of element() and $node2 instance of element() ) then
|
62
|
+
if ( fn:node-name($node1) eq fn:node-name($node2) ) then
|
63
|
+
let $atts1 as attribute()* := test:sort-named-nodes($node1/@*)
|
64
|
+
let $atts2 as attribute()* := test:sort-named-nodes($node2/@*)
|
65
|
+
return
|
66
|
+
if ( test:deep-equal($atts1, $atts2) ) then
|
67
|
+
if ( fn:count($node1/node()) = 1 and $node1/text() = '...' ) then
|
68
|
+
fn:true()
|
69
|
+
else
|
70
|
+
test:deep-equal(test:sorted-children($node1), test:sorted-children($node2))
|
71
|
+
else
|
72
|
+
fn:false()
|
73
|
+
else
|
74
|
+
fn:false()
|
75
|
+
else if ( $node1 instance of text() and $node1 = '...' ) then
|
76
|
+
fn:true()
|
77
|
+
else if ( $node1 instance of text() and $node2 instance of text() ) then
|
78
|
+
fn:string($node1) eq fn:string($node2)
|
79
|
+
else if ( ( $node1 instance of attribute() and $node2 instance of attribute() )
|
80
|
+
or ( $node1 instance of processing-instruction()
|
81
|
+
and $node2 instance of processing-instruction()) ) then
|
82
|
+
fn:node-name($node1) eq fn:node-name($node2)
|
83
|
+
and ( fn:string($node1) eq fn:string($node2) or fn:string($node1) = '...' )
|
84
|
+
else if ( $node1 instance of comment() and $node2 instance of comment() ) then
|
85
|
+
fn:string($node1) eq fn:string($node2) or fn:string($node1) = '...'
|
86
|
+
else
|
87
|
+
fn:false()
|
88
|
+
};
|
89
|
+
|
90
|
+
declare function test:sorted-children($node as node()) as node()*
|
91
|
+
{
|
92
|
+
$node/child::node()
|
93
|
+
except ( $node/text()[fn:not(fn:normalize-space(.))], $node/test:message )
|
94
|
+
};
|
95
|
+
|
96
|
+
(: Aim to be identical to:
|
97
|
+
:
|
98
|
+
: <xsl:perform-sort select="$nodes">
|
99
|
+
: <xsl:sort select="namespace-uri(.)" />
|
100
|
+
: <xsl:sort select="local-name(.)" />
|
101
|
+
: </xsl:perform-sort>
|
102
|
+
:)
|
103
|
+
declare function test:sort-named-nodes($nodes as node()*) as node()*
|
104
|
+
{
|
105
|
+
if ( fn:empty($nodes) ) then
|
106
|
+
()
|
107
|
+
else
|
108
|
+
let $idx := test:named-nodes-minimum($nodes)
|
109
|
+
return (
|
110
|
+
$nodes[$idx],
|
111
|
+
test:sort-named-nodes(fn:remove($nodes, $idx))
|
112
|
+
)
|
113
|
+
};
|
114
|
+
|
115
|
+
(: Return the "minimum" of $nodes, using the order defined by
|
116
|
+
: test:sort-named-nodes().
|
117
|
+
:)
|
118
|
+
declare function test:named-nodes-minimum($nodes as node()+) as xs:integer
|
119
|
+
{
|
120
|
+
(: if there is only one node, this is the minimum :)
|
121
|
+
if ( fn:empty($nodes[2]) ) then
|
122
|
+
1
|
123
|
+
(: if not, init the temp minimum on the first one, then walk through the sequence :)
|
124
|
+
else
|
125
|
+
test:named-nodes-minimum($nodes, fn:node-name($nodes[1]), 1, 2)
|
126
|
+
};
|
127
|
+
|
128
|
+
declare function test:named-nodes-minimum(
|
129
|
+
$nodes as node()+,
|
130
|
+
$min as xs:QName,
|
131
|
+
$idx as xs:integer,
|
132
|
+
$curr as xs:integer
|
133
|
+
) as xs:integer
|
134
|
+
{
|
135
|
+
if ( $curr gt fn:count($nodes) ) then
|
136
|
+
$idx
|
137
|
+
else if ( test:qname-lt(fn:node-name($nodes[$curr]), $min) ) then
|
138
|
+
test:named-nodes-minimum($nodes, fn:node-name($nodes[$curr]), $curr, $curr + 1)
|
139
|
+
else
|
140
|
+
test:named-nodes-minimum($nodes, $min, $idx, $curr + 1)
|
141
|
+
};
|
142
|
+
|
143
|
+
declare function test:qname-lt($n1 as xs:QName, $n2 as xs:QName) as xs:boolean
|
144
|
+
{
|
145
|
+
if ( fn:namespace-uri-from-QName($n1) eq fn:namespace-uri-from-QName($n2) ) then
|
146
|
+
fn:local-name-from-QName($n1) lt fn:local-name-from-QName($n2)
|
147
|
+
else
|
148
|
+
fn:namespace-uri-from-QName($n1) lt fn:namespace-uri-from-QName($n2)
|
149
|
+
};
|
150
|
+
|
151
|
+
declare function test:report-value($value as item()*, $wrapper-name as xs:string) as element()
|
152
|
+
{
|
153
|
+
test:report-value($value, $wrapper-name, 'http://www.jenitennison.com/xslt/xspec')
|
154
|
+
};
|
155
|
+
|
156
|
+
declare function test:report-value(
|
157
|
+
$value as item()*,
|
158
|
+
$wrapper-name as xs:string,
|
159
|
+
$wrapper-ns as xs:string
|
160
|
+
) as element()
|
161
|
+
{
|
162
|
+
element { fn:QName($wrapper-ns, $wrapper-name) } {
|
163
|
+
if ( $value[1] instance of attribute() ) then (
|
164
|
+
attribute { 'select' } { '/*/(@* | node())' },
|
165
|
+
element { fn:QName($wrapper-ns, 'temp') } { $value }
|
166
|
+
)
|
167
|
+
else if ( $value instance of node()+ ) then (
|
168
|
+
if ( $value instance of document-node() ) then
|
169
|
+
attribute { 'select' } { '/' }
|
170
|
+
else if ( fn:not($value instance of element()+) ) then
|
171
|
+
attribute { 'select' } { '/node()' }
|
172
|
+
else
|
173
|
+
()
|
174
|
+
,
|
175
|
+
if ( fn:count($value//node()) > 1000 ) then
|
176
|
+
fn:error((), 'TODO: Write the value within a file...')
|
177
|
+
else
|
178
|
+
(: TODO: The original stylesheet use a mode to do a bit
|
179
|
+
different copy, to preserve withespaces... :)
|
180
|
+
$value
|
181
|
+
)
|
182
|
+
else
|
183
|
+
attribute { 'select' } {
|
184
|
+
if ( fn:empty($value) ) then
|
185
|
+
'()'
|
186
|
+
else if ( $value instance of item() ) then
|
187
|
+
test:report-atomic-value($value)
|
188
|
+
else
|
189
|
+
fn:concat('(', fn:string-join(for $v in $value return test:report-atomic-value($v), ', '), ')')
|
190
|
+
}
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
declare function test:report-atomic-value($value as item()) as xs:string
|
195
|
+
{
|
196
|
+
if ( $value instance of xs:string ) then
|
197
|
+
fn:concat("'", fn:replace($value, "'", "''"), "'")
|
198
|
+
else if ( $value instance of xs:integer or
|
199
|
+
$value instance of xs:decimal or
|
200
|
+
$value instance of xs:double ) then
|
201
|
+
fn:string($value)
|
202
|
+
else if ( $value instance of xs:QName ) then
|
203
|
+
fn:concat("QName('",
|
204
|
+
fn:namespace-uri-from-QName($value),
|
205
|
+
"', '",
|
206
|
+
if ( fn:prefix-from-QName($value) ) then
|
207
|
+
fn:concat(fn:prefix-from-QName($value), ':')
|
208
|
+
else
|
209
|
+
'',
|
210
|
+
fn:local-name-from-QName($value),
|
211
|
+
"')")
|
212
|
+
else
|
213
|
+
fn:concat(test:atom-type($value), '(', test:report-atomic-value(fn:string($value)), ')')
|
214
|
+
};
|
215
|
+
|
216
|
+
declare function test:atom-type($value as xs:anyAtomicType) as xs:string
|
217
|
+
{
|
218
|
+
if ( $value instance of xs:string ) then
|
219
|
+
'xs:string'
|
220
|
+
else if ( $value instance of xs:boolean ) then
|
221
|
+
'xs:boolean'
|
222
|
+
else if ( $value instance of xs:double ) then
|
223
|
+
'xs:double'
|
224
|
+
else if ( $value instance of xs:anyURI ) then
|
225
|
+
'xs:anyURI'
|
226
|
+
else if ( $value instance of xs:dateTime ) then
|
227
|
+
'xs:dateTime'
|
228
|
+
else if ( $value instance of xs:date ) then
|
229
|
+
'xs:date'
|
230
|
+
else if ( $value instance of xs:time ) then
|
231
|
+
'xs:time'
|
232
|
+
else
|
233
|
+
'xs:anyAtomicType'
|
234
|
+
};
|
235
|
+
|
236
|
+
|
237
|
+
(: ------------------------------------------------------------------------ :)
|
238
|
+
(: DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. :)
|
239
|
+
(: :)
|
240
|
+
(: Copyright (c) 2008, 2010 Jeni Tennsion :)
|
241
|
+
(: :)
|
242
|
+
(: The contents of this file are subject to the MIT License (see the URI :)
|
243
|
+
(: http://www.opensource.org/licenses/mit-license.php for details). :)
|
244
|
+
(: :)
|
245
|
+
(: Permission is hereby granted, free of charge, to any person obtaining :)
|
246
|
+
(: a copy of this software and associated documentation files (the :)
|
247
|
+
(: "Software"), to deal in the Software without restriction, including :)
|
248
|
+
(: without limitation the rights to use, copy, modify, merge, publish, :)
|
249
|
+
(: distribute, sublicense, and/or sell copies of the Software, and to :)
|
250
|
+
(: permit persons to whom the Software is furnished to do so, subject to :)
|
251
|
+
(: the following conditions: :)
|
252
|
+
(: :)
|
253
|
+
(: The above copyright notice and this permission notice shall be :)
|
254
|
+
(: included in all copies or substantial portions of the Software. :)
|
255
|
+
(: :)
|
256
|
+
(: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, :)
|
257
|
+
(: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF :)
|
258
|
+
(: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. :)
|
259
|
+
(: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY :)
|
260
|
+
(: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, :)
|
261
|
+
(: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE :)
|
262
|
+
(: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. :)
|
263
|
+
(: ------------------------------------------------------------------------ :)
|
@@ -0,0 +1,169 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- ===================================================================== -->
|
3
|
+
<!-- File: generate-tests-helper.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 version="2.0"
|
12
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
13
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
14
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
15
|
+
xmlns:test="http://www.jenitennison.com/xslt/unit-test"
|
16
|
+
extension-element-prefixes="test"
|
17
|
+
xmlns="http://www.w3.org/1999/XSL/TransformAlias"
|
18
|
+
xmlns:t="http://www.jenitennison.com/xslt/unit-testAlias"
|
19
|
+
exclude-result-prefixes="#default t xhtml"
|
20
|
+
xmlns:pkg="http://expath.org/ns/pkg"
|
21
|
+
xmlns:__x="http://www.w3.org/1999/XSL/TransformAliasAlias">
|
22
|
+
|
23
|
+
<pkg:import-uri>http://www.jenitennison.com/xslt/xspec/generate-tests-helper.xsl</pkg:import-uri>
|
24
|
+
|
25
|
+
<xsl:namespace-alias stylesheet-prefix="#default" result-prefix="xsl"/>
|
26
|
+
<xsl:namespace-alias stylesheet-prefix="t" result-prefix="test"/>
|
27
|
+
|
28
|
+
<xsl:output indent="yes" encoding="ISO-8859-1" />
|
29
|
+
|
30
|
+
<xsl:key name="functions"
|
31
|
+
match="xsl:function"
|
32
|
+
use="resolve-QName(@name, .)" />
|
33
|
+
|
34
|
+
<xsl:key name="named-templates"
|
35
|
+
match="xsl:template[@name]"
|
36
|
+
use="if (contains(@name, ':'))
|
37
|
+
then resolve-QName(@name, .)
|
38
|
+
else QName('', @name)" />
|
39
|
+
|
40
|
+
<xsl:key name="matching-templates"
|
41
|
+
match="xsl:template[@match]"
|
42
|
+
use="concat('match=', normalize-space(@match), '+',
|
43
|
+
'mode=', normalize-space(@mode))" />
|
44
|
+
|
45
|
+
|
46
|
+
<xsl:template match="*" mode="test:generate-variable-declarations">
|
47
|
+
<xsl:param name="var" as="xs:string" required="yes" />
|
48
|
+
<xsl:param name="type" as="xs:string" select="'variable'" />
|
49
|
+
<xsl:choose>
|
50
|
+
<xsl:when test="node() or @href">
|
51
|
+
<variable name="{$var}-doc" as="document-node()">
|
52
|
+
<xsl:choose>
|
53
|
+
<xsl:when test="@href">
|
54
|
+
<xsl:attribute name="select">
|
55
|
+
<xsl:text>doc('</xsl:text>
|
56
|
+
<xsl:value-of select="resolve-uri(@href, base-uri(.))" />
|
57
|
+
<xsl:text>')</xsl:text>
|
58
|
+
</xsl:attribute>
|
59
|
+
</xsl:when>
|
60
|
+
<xsl:otherwise>
|
61
|
+
<document>
|
62
|
+
<xsl:apply-templates mode="test:create-xslt-generator" />
|
63
|
+
</document>
|
64
|
+
</xsl:otherwise>
|
65
|
+
</xsl:choose>
|
66
|
+
</variable>
|
67
|
+
<xsl:element name="xsl:{$type}">
|
68
|
+
<xsl:copy-of select="@as"/>
|
69
|
+
<xsl:attribute name="name" select="$var" />
|
70
|
+
<xsl:attribute name="select"
|
71
|
+
select="if (@select)
|
72
|
+
then concat('$', $var, '-doc/(', @select, ')')
|
73
|
+
else if (@href)
|
74
|
+
then concat('$', $var, '-doc')
|
75
|
+
else concat('$', $var, '-doc/node()')" />
|
76
|
+
</xsl:element>
|
77
|
+
</xsl:when>
|
78
|
+
<xsl:when test="@select">
|
79
|
+
<xsl:element name="xsl:{$type}">
|
80
|
+
<xsl:copy-of select="@as|@select"/>
|
81
|
+
<xsl:attribute name="name" select="$var" />
|
82
|
+
</xsl:element>
|
83
|
+
</xsl:when>
|
84
|
+
<xsl:otherwise>
|
85
|
+
<xsl:element name="xsl:{$type}">
|
86
|
+
<xsl:copy-of select="@as"/>
|
87
|
+
<xsl:attribute name="name" select="$var" />
|
88
|
+
<xsl:attribute name="select" select="'()'" />
|
89
|
+
</xsl:element>
|
90
|
+
</xsl:otherwise>
|
91
|
+
</xsl:choose>
|
92
|
+
</xsl:template>
|
93
|
+
|
94
|
+
|
95
|
+
<xsl:template match="*" mode="test:create-xslt-generator">
|
96
|
+
<xsl:copy>
|
97
|
+
<xsl:apply-templates select="@*|node()" mode="test:create-xslt-generator"/>
|
98
|
+
</xsl:copy>
|
99
|
+
</xsl:template>
|
100
|
+
|
101
|
+
<xsl:template match="@*" mode="test:create-xslt-generator">
|
102
|
+
<xsl:copy-of select="."/>
|
103
|
+
</xsl:template>
|
104
|
+
|
105
|
+
<xsl:template match="xsl:*" mode="test:create-xslt-generator">
|
106
|
+
<xsl:element name="__x:{ local-name() }">
|
107
|
+
<xsl:apply-templates select="@*|node()" mode="test:create-xslt-generator"/>
|
108
|
+
</xsl:element>
|
109
|
+
</xsl:template>
|
110
|
+
|
111
|
+
<xsl:template match="@xsl:*" mode="test:create-xslt-generator">
|
112
|
+
<xsl:attribute name="__x:{ local-name() }" select="."/>
|
113
|
+
</xsl:template>
|
114
|
+
|
115
|
+
<xsl:template match="text()" mode="test:create-xslt-generator">
|
116
|
+
<text>
|
117
|
+
<xsl:value-of select="."/>
|
118
|
+
</text>
|
119
|
+
</xsl:template>
|
120
|
+
|
121
|
+
<xsl:template match="comment()" mode="test:create-xslt-generator">
|
122
|
+
<comment>
|
123
|
+
<xsl:value-of select="."/>
|
124
|
+
</comment>
|
125
|
+
</xsl:template>
|
126
|
+
|
127
|
+
<xsl:template match="processing-instruction()" mode="test:create-xslt-generator">
|
128
|
+
<processing-instruction name="{name()}">
|
129
|
+
<xsl:value-of select="."/>
|
130
|
+
</processing-instruction>
|
131
|
+
</xsl:template>
|
132
|
+
|
133
|
+
<xsl:function name="test:matching-xslt-elements" as="element()*">
|
134
|
+
<xsl:param name="element-kind" as="xs:string"/>
|
135
|
+
<xsl:param name="element-id" as="item()"/>
|
136
|
+
<xsl:param name="stylesheet" as="document-node()"/>
|
137
|
+
<xsl:sequence select="key($element-kind, $element-id, $stylesheet)"/>
|
138
|
+
</xsl:function>
|
139
|
+
|
140
|
+
</xsl:stylesheet>
|
141
|
+
|
142
|
+
|
143
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
144
|
+
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
|
145
|
+
<!-- -->
|
146
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
|
147
|
+
<!-- -->
|
148
|
+
<!-- The contents of this file are subject to the MIT License (see the URI -->
|
149
|
+
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
|
150
|
+
<!-- -->
|
151
|
+
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
|
152
|
+
<!-- a copy of this software and associated documentation files (the -->
|
153
|
+
<!-- "Software"), to deal in the Software without restriction, including -->
|
154
|
+
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
|
155
|
+
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
|
156
|
+
<!-- permit persons to whom the Software is furnished to do so, subject to -->
|
157
|
+
<!-- the following conditions: -->
|
158
|
+
<!-- -->
|
159
|
+
<!-- The above copyright notice and this permission notice shall be -->
|
160
|
+
<!-- included in all copies or substantial portions of the Software. -->
|
161
|
+
<!-- -->
|
162
|
+
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
|
163
|
+
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
|
164
|
+
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
|
165
|
+
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
|
166
|
+
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
|
167
|
+
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
|
168
|
+
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
|
169
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|