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,378 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- ===================================================================== -->
|
|
3
|
+
<!-- File: coverage-report.xsl -->
|
|
4
|
+
<!-- Author: Jeni Tennsion -->
|
|
5
|
+
<!-- Tags: -->
|
|
6
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) -->
|
|
7
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<xsl:stylesheet version="2.0"
|
|
11
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
12
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
13
|
+
xmlns:test="http://www.jenitennison.com/xslt/unit-test"
|
|
14
|
+
xmlns="http://www.w3.org/1999/xhtml"
|
|
15
|
+
xmlns:pkg="http://expath.org/ns/pkg"
|
|
16
|
+
exclude-result-prefixes="xs">
|
|
17
|
+
|
|
18
|
+
<xsl:import href="format-utils.xsl" />
|
|
19
|
+
|
|
20
|
+
<pkg:import-uri>http://www.jenitennison.com/xslt/xspec/coverage-report.xsl</pkg:import-uri>
|
|
21
|
+
|
|
22
|
+
<xsl:param name="pwd" as="xs:string" required="yes"/>
|
|
23
|
+
<xsl:param name="tests" as="xs:string" required="yes"/>
|
|
24
|
+
|
|
25
|
+
<xsl:variable name="tests-uri" as="xs:anyURI" select="
|
|
26
|
+
resolve-uri(translate($tests, '\', '/'), $pwd)"/>
|
|
27
|
+
|
|
28
|
+
<xsl:variable name="stylesheet-uri" as="xs:anyURI"
|
|
29
|
+
select="if (doc($tests-uri)/*/@stylesheet)
|
|
30
|
+
then resolve-uri(doc($tests-uri)/*/@stylesheet, $tests-uri)
|
|
31
|
+
else $tests-uri" />
|
|
32
|
+
|
|
33
|
+
<xsl:variable name="trace" as="document-node()" select="/" />
|
|
34
|
+
|
|
35
|
+
<xsl:variable name="stylesheet-trees" as="document-node()+"
|
|
36
|
+
select="test:collect-stylesheets(doc($stylesheet-uri))" />
|
|
37
|
+
|
|
38
|
+
<xsl:function name="test:collect-stylesheets" as="document-node()+">
|
|
39
|
+
<xsl:param name="stylesheets" as="document-node()+" />
|
|
40
|
+
<xsl:variable name="imports" as="document-node()*"
|
|
41
|
+
select="document($stylesheets/*/(xsl:import|xsl:include)/@href)" />
|
|
42
|
+
<xsl:variable name="new-stylesheets" as="document-node()*"
|
|
43
|
+
select="$stylesheets | $imports" />
|
|
44
|
+
<xsl:choose>
|
|
45
|
+
<xsl:when test="$imports except $stylesheets">
|
|
46
|
+
<xsl:sequence select="test:collect-stylesheets($stylesheets | $imports)" />
|
|
47
|
+
</xsl:when>
|
|
48
|
+
<xsl:otherwise>
|
|
49
|
+
<xsl:sequence select="$stylesheets" />
|
|
50
|
+
</xsl:otherwise>
|
|
51
|
+
</xsl:choose>
|
|
52
|
+
</xsl:function>
|
|
53
|
+
|
|
54
|
+
<xsl:key name="modules" match="m" use="@u" />
|
|
55
|
+
<xsl:key name="constructs" match="c" use="@id" />
|
|
56
|
+
<xsl:key name="coverage" match="h" use="concat(@m, ':', @l)" />
|
|
57
|
+
|
|
58
|
+
<xsl:template match="/">
|
|
59
|
+
<xsl:apply-templates select="." mode="test:coverage-report" />
|
|
60
|
+
</xsl:template>
|
|
61
|
+
|
|
62
|
+
<xsl:template match="/" mode="test:coverage-report">
|
|
63
|
+
<html>
|
|
64
|
+
<head>
|
|
65
|
+
<title>Test Coverage Report for <xsl:value-of select="test:format-URI($stylesheet-uri)" /></title>
|
|
66
|
+
<link rel="stylesheet" type="text/css"
|
|
67
|
+
href="{resolve-uri('test-report.css', static-base-uri())}" />
|
|
68
|
+
</head>
|
|
69
|
+
<body>
|
|
70
|
+
<h1>Test Coverage Report</h1>
|
|
71
|
+
<p>Stylesheet: <a href="{$stylesheet-uri}"><xsl:value-of select="test:format-URI($stylesheet-uri)" /></a></p>
|
|
72
|
+
<xsl:apply-templates select="$stylesheet-trees/xsl:*" mode="test:coverage-report" />
|
|
73
|
+
</body>
|
|
74
|
+
</html>
|
|
75
|
+
</xsl:template>
|
|
76
|
+
|
|
77
|
+
<xsl:template match="xsl:stylesheet | xsl:transform" mode="test:coverage-report">
|
|
78
|
+
<xsl:variable name="stylesheet-uri" as="xs:anyURI"
|
|
79
|
+
select="base-uri(.)" />
|
|
80
|
+
<xsl:variable name="stylesheet-tree" as="document-node()"
|
|
81
|
+
select=".." />
|
|
82
|
+
<xsl:variable name="stylesheet-string" as="xs:string"
|
|
83
|
+
select="unparsed-text($stylesheet-uri)" />
|
|
84
|
+
<xsl:variable name="stylesheet-lines" as="xs:string+"
|
|
85
|
+
select="tokenize($stylesheet-string, '\n')" />
|
|
86
|
+
<xsl:variable name="number-of-lines" as="xs:integer"
|
|
87
|
+
select="count($stylesheet-lines)" />
|
|
88
|
+
<xsl:variable name="number-width" as="xs:integer"
|
|
89
|
+
select="string-length(xs:string($number-of-lines))" />
|
|
90
|
+
<xsl:variable name="number-format" as="xs:string"
|
|
91
|
+
select="string-join(for $i in 1 to $number-width return '0', '')" />
|
|
92
|
+
<xsl:variable name="module" as="xs:string?">
|
|
93
|
+
<xsl:variable name="uri" as="xs:string"
|
|
94
|
+
select="if (starts-with($stylesheet-uri, '/'))
|
|
95
|
+
then concat('file:', $stylesheet-uri)
|
|
96
|
+
else $stylesheet-uri" />
|
|
97
|
+
<xsl:sequence select="key('modules', $uri, $trace)/@id" />
|
|
98
|
+
</xsl:variable>
|
|
99
|
+
<h2>
|
|
100
|
+
module: <xsl:value-of select="$stylesheet-uri" />;
|
|
101
|
+
<xsl:value-of select="$number-of-lines" /> lines
|
|
102
|
+
</h2>
|
|
103
|
+
<xsl:choose>
|
|
104
|
+
<xsl:when test="empty($module)">
|
|
105
|
+
<p><span class="missed">not used</span></p>
|
|
106
|
+
</xsl:when>
|
|
107
|
+
<xsl:otherwise>
|
|
108
|
+
<pre>
|
|
109
|
+
<xsl:value-of select="format-number(1, $number-format)" />
|
|
110
|
+
<xsl:text>: </xsl:text>
|
|
111
|
+
<xsl:call-template name="test:output-lines">
|
|
112
|
+
<xsl:with-param name="line-number" select="0" />
|
|
113
|
+
<xsl:with-param name="stylesheet-string" select="$stylesheet-string" />
|
|
114
|
+
<xsl:with-param name="node" select="." />
|
|
115
|
+
<xsl:with-param name="number-format" tunnel="yes" select="$number-format" />
|
|
116
|
+
<xsl:with-param name="module" tunnel="yes" select="$module" />
|
|
117
|
+
</xsl:call-template>
|
|
118
|
+
</pre>
|
|
119
|
+
</xsl:otherwise>
|
|
120
|
+
</xsl:choose>
|
|
121
|
+
</xsl:template>
|
|
122
|
+
|
|
123
|
+
<xsl:variable name="attribute-regex" as="xs:string">
|
|
124
|
+
<xsl:value-of>
|
|
125
|
+
\s+
|
|
126
|
+
([^>\s]+) <!-- 1: the name of the attribute -->
|
|
127
|
+
\s*
|
|
128
|
+
=
|
|
129
|
+
\s*
|
|
130
|
+
( <!-- 2: the value of the attribute (with quotes) -->
|
|
131
|
+
"([^"]*)" <!-- 3: the value without quotes -->
|
|
132
|
+
|
|
|
133
|
+
'([^']*)' <!-- 4: also the value without quotes -->
|
|
134
|
+
)
|
|
135
|
+
</xsl:value-of>
|
|
136
|
+
</xsl:variable>
|
|
137
|
+
|
|
138
|
+
<xsl:variable name="construct-regex" as="xs:string">
|
|
139
|
+
<xsl:value-of>
|
|
140
|
+
^
|
|
141
|
+
( <!-- 1: the construct -->
|
|
142
|
+
([^<]+) <!-- 2: some text -->
|
|
143
|
+
|
|
|
144
|
+
(<!-- <!-- 3: a comment -->
|
|
145
|
+
([^-]|-[^-])* <!-- 4: the content of the comment -->
|
|
146
|
+
-->)
|
|
147
|
+
|
|
|
148
|
+
(<\? <!-- 5: a PI -->
|
|
149
|
+
([^?]|\?[^>])* <!-- 6: the content of the PI -->
|
|
150
|
+
\?>)
|
|
151
|
+
|
|
|
152
|
+
(<\[CDATA\[ <!-- 7: a CDATA section -->
|
|
153
|
+
([^\]]|\][^\]]|\]\][^>])* <!-- 8: the content of the CDATA section -->
|
|
154
|
+
\]\]>)
|
|
155
|
+
|
|
|
156
|
+
(</ <!-- 9: a close tag -->
|
|
157
|
+
([^>]+) <!-- 10: the name of the element being closed -->
|
|
158
|
+
>)
|
|
159
|
+
|
|
|
160
|
+
(< <!-- 11: an open tag -->
|
|
161
|
+
([^>/\s]+) <!-- 12: the name of the element being opened -->
|
|
162
|
+
( <!-- 13: the attributes of the element -->
|
|
163
|
+
( <!-- 14: wrapper for the attribute regex -->
|
|
164
|
+
<xsl:value-of select="$attribute-regex" /> <!-- 15-18 attribute stuff -->
|
|
165
|
+
)*
|
|
166
|
+
)
|
|
167
|
+
\s*
|
|
168
|
+
(/?) <!-- 19: empty element tag flag -->
|
|
169
|
+
>
|
|
170
|
+
)
|
|
171
|
+
)
|
|
172
|
+
(.*) <!-- 20: the rest of the string -->
|
|
173
|
+
$
|
|
174
|
+
</xsl:value-of>
|
|
175
|
+
</xsl:variable>
|
|
176
|
+
|
|
177
|
+
<xsl:template name="test:output-lines">
|
|
178
|
+
<xsl:param name="line-number" as="xs:integer" required="yes" />
|
|
179
|
+
<xsl:param name="stylesheet-string" as="xs:string" required="yes" />
|
|
180
|
+
<xsl:param name="node" as="node()" required="yes" />
|
|
181
|
+
<xsl:param name="number-format" tunnel="yes" as="xs:string" required="yes" />
|
|
182
|
+
<xsl:param name="module" tunnel="yes" as="xs:string" required="yes" />
|
|
183
|
+
<xsl:analyze-string select="$stylesheet-string"
|
|
184
|
+
regex="{$construct-regex}" flags="sx">
|
|
185
|
+
<xsl:matching-substring>
|
|
186
|
+
<xsl:variable name="construct" as="xs:string" select="regex-group(1)" />
|
|
187
|
+
<xsl:variable name="rest" as="xs:string" select="regex-group(20)" />
|
|
188
|
+
<xsl:variable name="construct-lines" as="xs:string+"
|
|
189
|
+
select="tokenize($construct, '\n')" />
|
|
190
|
+
<xsl:variable name="endTag" as="xs:boolean" select="regex-group(9) != ''" />
|
|
191
|
+
<xsl:variable name="emptyTag" as="xs:boolean" select="regex-group(19) != ''" />
|
|
192
|
+
<xsl:variable name="startTag" as="xs:boolean" select="not($emptyTag) and regex-group(11) != ''" />
|
|
193
|
+
<xsl:variable name="matches" as="xs:boolean"
|
|
194
|
+
select="($node instance of text() and
|
|
195
|
+
regex-group(2) != '') or
|
|
196
|
+
($node instance of element() and
|
|
197
|
+
($startTag or $endTag or $emptyTag) and
|
|
198
|
+
name($node) = (regex-group(10), regex-group(12))) or
|
|
199
|
+
($node instance of comment() and
|
|
200
|
+
regex-group(3) != '') or
|
|
201
|
+
($node instance of processing-instruction() and
|
|
202
|
+
regex-group(5) != '')" />
|
|
203
|
+
<xsl:variable name="coverage" as="xs:string"
|
|
204
|
+
select="if ($matches) then test:coverage($node, $module) else 'ignored'" />
|
|
205
|
+
<xsl:for-each select="$construct-lines">
|
|
206
|
+
<xsl:if test="position() != 1">
|
|
207
|
+
<xsl:text>
</xsl:text>
|
|
208
|
+
<xsl:value-of select="format-number($line-number + position(), $number-format)" />
|
|
209
|
+
<xsl:text>: </xsl:text>
|
|
210
|
+
</xsl:if>
|
|
211
|
+
<span class="{$coverage}">
|
|
212
|
+
<xsl:value-of select="." />
|
|
213
|
+
</span>
|
|
214
|
+
</xsl:for-each>
|
|
215
|
+
<xsl:if test="$rest != ''">
|
|
216
|
+
<xsl:call-template name="test:output-lines">
|
|
217
|
+
<xsl:with-param name="line-number" select="$line-number + count($construct-lines) - 1" />
|
|
218
|
+
<xsl:with-param name="stylesheet-string" select="$rest" />
|
|
219
|
+
<xsl:with-param name="node" as="node()">
|
|
220
|
+
<xsl:choose>
|
|
221
|
+
<xsl:when test="$matches">
|
|
222
|
+
<xsl:choose>
|
|
223
|
+
<xsl:when test="$startTag">
|
|
224
|
+
<xsl:choose>
|
|
225
|
+
<xsl:when test="$node/node()">
|
|
226
|
+
<xsl:sequence select="$node/node()[1]" />
|
|
227
|
+
</xsl:when>
|
|
228
|
+
<xsl:otherwise>
|
|
229
|
+
<xsl:sequence select="$node" />
|
|
230
|
+
</xsl:otherwise>
|
|
231
|
+
</xsl:choose>
|
|
232
|
+
</xsl:when>
|
|
233
|
+
<xsl:otherwise>
|
|
234
|
+
<xsl:choose>
|
|
235
|
+
<xsl:when test="$node/following-sibling::node()">
|
|
236
|
+
<xsl:sequence select="$node/following-sibling::node()[1]" />
|
|
237
|
+
</xsl:when>
|
|
238
|
+
<xsl:otherwise>
|
|
239
|
+
<xsl:sequence select="$node/parent::node()" />
|
|
240
|
+
</xsl:otherwise>
|
|
241
|
+
</xsl:choose>
|
|
242
|
+
</xsl:otherwise>
|
|
243
|
+
</xsl:choose>
|
|
244
|
+
</xsl:when>
|
|
245
|
+
<xsl:otherwise>
|
|
246
|
+
<xsl:sequence select="$node" />
|
|
247
|
+
</xsl:otherwise>
|
|
248
|
+
</xsl:choose>
|
|
249
|
+
</xsl:with-param>
|
|
250
|
+
</xsl:call-template>
|
|
251
|
+
</xsl:if>
|
|
252
|
+
</xsl:matching-substring>
|
|
253
|
+
<xsl:non-matching-substring>
|
|
254
|
+
<xsl:message terminate="yes">
|
|
255
|
+
unmatched string: <xsl:value-of select="." />
|
|
256
|
+
</xsl:message>
|
|
257
|
+
</xsl:non-matching-substring>
|
|
258
|
+
</xsl:analyze-string>
|
|
259
|
+
</xsl:template>
|
|
260
|
+
|
|
261
|
+
<xsl:function name="test:coverage" as="xs:string">
|
|
262
|
+
<xsl:param name="node" as="node()" />
|
|
263
|
+
<xsl:param name="module" as="xs:string" />
|
|
264
|
+
<xsl:variable name="coverage" as="xs:string+">
|
|
265
|
+
<xsl:apply-templates select="$node" mode="test:coverage">
|
|
266
|
+
<xsl:with-param name="module" tunnel="yes" select="$module" />
|
|
267
|
+
</xsl:apply-templates>
|
|
268
|
+
</xsl:variable>
|
|
269
|
+
<xsl:if test="count($coverage) > 1">
|
|
270
|
+
<xsl:message terminate="yes">
|
|
271
|
+
more than one coverage identified for:
|
|
272
|
+
<xsl:sequence select="$node" />
|
|
273
|
+
</xsl:message>
|
|
274
|
+
</xsl:if>
|
|
275
|
+
<xsl:sequence select="$coverage[1]" />
|
|
276
|
+
</xsl:function>
|
|
277
|
+
|
|
278
|
+
<xsl:template match="text()[normalize-space(.) = '' and not(parent::xsl:text)]" mode="test:coverage">ignored</xsl:template>
|
|
279
|
+
|
|
280
|
+
<xsl:template match="processing-instruction() | comment()" mode="test:coverage">ignored</xsl:template>
|
|
281
|
+
|
|
282
|
+
<!-- A hit on these nodes doesn't really count; you have to hit
|
|
283
|
+
their contents to hit them -->
|
|
284
|
+
<xsl:template match="xsl:otherwise | xsl:when | xsl:matching-substring | xsl:non-matching-substring | xsl:for-each | xsl:for-each-group" mode="test:coverage">
|
|
285
|
+
<xsl:param name="module" tunnel="yes" as="xs:string" required="yes" />
|
|
286
|
+
<xsl:variable name="hits-on-content" as="element(h)*"
|
|
287
|
+
select="test:hit-on-nodes(node(), $module)" />
|
|
288
|
+
<xsl:choose>
|
|
289
|
+
<xsl:when test="exists($hits-on-content)">hit</xsl:when>
|
|
290
|
+
<xsl:otherwise>missed</xsl:otherwise>
|
|
291
|
+
</xsl:choose>
|
|
292
|
+
</xsl:template>
|
|
293
|
+
|
|
294
|
+
<xsl:template match="* | text()" mode="test:coverage">
|
|
295
|
+
<xsl:param name="module" tunnel="yes" as="xs:string" required="yes" />
|
|
296
|
+
<xsl:variable name="hit" as="element(h)*"
|
|
297
|
+
select="test:hit-on-nodes(., $module)" />
|
|
298
|
+
<xsl:choose>
|
|
299
|
+
<xsl:when test="exists($hit)">hit</xsl:when>
|
|
300
|
+
<xsl:when test="self::text() and normalize-space(.) = '' and not(parent::xsl:text)">ignored</xsl:when>
|
|
301
|
+
<xsl:when test="self::xsl:variable">
|
|
302
|
+
<xsl:sequence select="test:coverage(following-sibling::*[not(self::xsl:variable)][1], $module)" />
|
|
303
|
+
</xsl:when>
|
|
304
|
+
<xsl:when test="ancestor::xsl:variable">
|
|
305
|
+
<xsl:sequence select="test:coverage(ancestor::xsl:variable[1], $module)" />
|
|
306
|
+
</xsl:when>
|
|
307
|
+
<xsl:when test="self::xsl:stylesheet or self::xsl:transform">ignored</xsl:when>
|
|
308
|
+
<xsl:when test="self::xsl:function or self::xsl:template">missed</xsl:when>
|
|
309
|
+
<!-- A node within a top-level non-XSLT element -->
|
|
310
|
+
<xsl:when test="empty(ancestor::xsl:*[parent::xsl:stylesheet or parent::xsl:transform])">ignored</xsl:when>
|
|
311
|
+
<xsl:when test="self::xsl:param">
|
|
312
|
+
<xsl:sequence select="test:coverage(parent::*, $module)" />
|
|
313
|
+
</xsl:when>
|
|
314
|
+
<xsl:otherwise>missed</xsl:otherwise>
|
|
315
|
+
</xsl:choose>
|
|
316
|
+
</xsl:template>
|
|
317
|
+
|
|
318
|
+
<xsl:template match="/" mode="test:coverage">ignored</xsl:template>
|
|
319
|
+
|
|
320
|
+
<xsl:function name="test:hit-on-nodes" as="element(h)*"
|
|
321
|
+
xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="saxon">
|
|
322
|
+
<xsl:param name="nodes" as="node()*" />
|
|
323
|
+
<xsl:param name="module" as="xs:string" />
|
|
324
|
+
<xsl:for-each select="$nodes[not(self::text()[not(normalize-space())])]">
|
|
325
|
+
<xsl:variable name="hits" as="element(h)*"
|
|
326
|
+
select="test:hit-on-lines(saxon:line-number(.), $module)" />
|
|
327
|
+
<xsl:variable name="name" as="xs:string"
|
|
328
|
+
select="concat('{', namespace-uri(.), '}', local-name(.))" />
|
|
329
|
+
<xsl:for-each select="$hits">
|
|
330
|
+
<xsl:variable name="construct" as="xs:string"
|
|
331
|
+
select="key('constructs', @c)/@n" />
|
|
332
|
+
<xsl:if test="$name = $construct or
|
|
333
|
+
not(starts-with($construct, '{'))">
|
|
334
|
+
<xsl:sequence select="." />
|
|
335
|
+
</xsl:if>
|
|
336
|
+
</xsl:for-each>
|
|
337
|
+
</xsl:for-each>
|
|
338
|
+
</xsl:function>
|
|
339
|
+
|
|
340
|
+
<xsl:function name="test:hit-on-lines" as="element(h)*">
|
|
341
|
+
<xsl:param name="line-numbers" as="xs:integer*" />
|
|
342
|
+
<xsl:param name="module" as="xs:string" />
|
|
343
|
+
<xsl:variable name="keys" as="xs:string*"
|
|
344
|
+
select="for $l in $line-numbers
|
|
345
|
+
return concat($module, ':', $l)" />
|
|
346
|
+
<xsl:sequence select="key('coverage', $keys, $trace)" />
|
|
347
|
+
</xsl:function>
|
|
348
|
+
|
|
349
|
+
</xsl:stylesheet>
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
353
|
+
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
|
|
354
|
+
<!-- -->
|
|
355
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
|
|
356
|
+
<!-- -->
|
|
357
|
+
<!-- The contents of this file are subject to the MIT License (see the URI -->
|
|
358
|
+
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
|
|
359
|
+
<!-- -->
|
|
360
|
+
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
|
|
361
|
+
<!-- a copy of this software and associated documentation files (the -->
|
|
362
|
+
<!-- "Software"), to deal in the Software without restriction, including -->
|
|
363
|
+
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
|
|
364
|
+
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
|
|
365
|
+
<!-- permit persons to whom the Software is furnished to do so, subject to -->
|
|
366
|
+
<!-- the following conditions: -->
|
|
367
|
+
<!-- -->
|
|
368
|
+
<!-- The above copyright notice and this permission notice shall be -->
|
|
369
|
+
<!-- included in all copies or substantial portions of the Software. -->
|
|
370
|
+
<!-- -->
|
|
371
|
+
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
|
|
372
|
+
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
|
|
373
|
+
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
|
|
374
|
+
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
|
|
375
|
+
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
|
|
376
|
+
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
|
|
377
|
+
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
|
|
378
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- ===================================================================== -->
|
|
3
|
+
<!-- File: format-utils.xsl -->
|
|
4
|
+
<!-- Author: Jeni Tennsion -->
|
|
5
|
+
<!-- Tags: -->
|
|
6
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) -->
|
|
7
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<xsl:stylesheet version="2.0"
|
|
11
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
12
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
13
|
+
xmlns:test="http://www.jenitennison.com/xslt/unit-test"
|
|
14
|
+
xmlns:x="http://www.jenitennison.com/xslt/xspec"
|
|
15
|
+
xmlns="http://www.w3.org/1999/xhtml"
|
|
16
|
+
xmlns:pkg="http://expath.org/ns/pkg"
|
|
17
|
+
exclude-result-prefixes="test xs x pkg">
|
|
18
|
+
|
|
19
|
+
<xsl:import href="../compiler/generate-tests-utils.xsl" />
|
|
20
|
+
|
|
21
|
+
<pkg:import-uri>http://www.jenitennison.com/xslt/xspec/format-utils.xsl</pkg:import-uri>
|
|
22
|
+
|
|
23
|
+
<xsl:output name="x:report" method="xml" indent="yes"/>
|
|
24
|
+
|
|
25
|
+
<xsl:variable name="omit-namespaces" as="xs:string+"
|
|
26
|
+
select="('http://www.w3.org/XML/1998/namespace',
|
|
27
|
+
'http://www.w3.org/1999/XSL/Transform',
|
|
28
|
+
'http://www.w3.org/2001/XMLSchema',
|
|
29
|
+
'http://www.jenitennison.com/xslt/unit-test',
|
|
30
|
+
'http://www.jenitennison.com/xslt/xspec')" />
|
|
31
|
+
|
|
32
|
+
<xsl:template match="*" mode="test:serialize" priority="20">
|
|
33
|
+
<xsl:param name="level" as="xs:integer" select="0" tunnel="yes" />
|
|
34
|
+
<xsl:param name="perform-comparison" tunnel="yes" as="xs:boolean" select="false()" />
|
|
35
|
+
<xsl:param name="comparison" as="node()?" select="()" />
|
|
36
|
+
<xsl:param name="expected" as="xs:boolean" select="true()" />
|
|
37
|
+
<xsl:text><</xsl:text>
|
|
38
|
+
<xsl:choose>
|
|
39
|
+
<xsl:when test="$perform-comparison">
|
|
40
|
+
<span class="{if (if ($expected) then test:deep-equal(., $comparison) else test:deep-equal($comparison, .)) then 'same' else 'diff'}">
|
|
41
|
+
<xsl:value-of select="name()" />
|
|
42
|
+
</span>
|
|
43
|
+
</xsl:when>
|
|
44
|
+
<xsl:otherwise>
|
|
45
|
+
<xsl:value-of select="name()" />
|
|
46
|
+
</xsl:otherwise>
|
|
47
|
+
</xsl:choose>
|
|
48
|
+
<xsl:variable name="attribute-indent" as="xs:string">
|
|
49
|
+
<xsl:value-of>
|
|
50
|
+
<xsl:text>
</xsl:text>
|
|
51
|
+
<xsl:for-each select="1 to $level"><xsl:text> </xsl:text></xsl:for-each>
|
|
52
|
+
<xsl:value-of select="replace(name(parent::*), '.', ' ')" />
|
|
53
|
+
</xsl:value-of>
|
|
54
|
+
</xsl:variable>
|
|
55
|
+
<xsl:variable name="new-namespaces" as="node()*"
|
|
56
|
+
select="namespace::*[not(. = $omit-namespaces) and ($level = 0 or not(name() = ../../namespace::*/name()))]" />
|
|
57
|
+
<xsl:if test="not(namespace::*[name() = '']) and ../namespace::*[name() = '']">
|
|
58
|
+
<xsl:text> xmlns=""</xsl:text>
|
|
59
|
+
</xsl:if>
|
|
60
|
+
<xsl:for-each select="$new-namespaces">
|
|
61
|
+
<xsl:if test="position() > 1">
|
|
62
|
+
<xsl:value-of select="$attribute-indent" />
|
|
63
|
+
</xsl:if>
|
|
64
|
+
<xsl:text> xmlns</xsl:text>
|
|
65
|
+
<xsl:if test="name()">
|
|
66
|
+
<xsl:value-of select="concat(':', name())" />
|
|
67
|
+
</xsl:if>
|
|
68
|
+
<xsl:text>="</xsl:text>
|
|
69
|
+
<xsl:value-of select="." />
|
|
70
|
+
<xsl:text>"</xsl:text>
|
|
71
|
+
</xsl:for-each>
|
|
72
|
+
<xsl:for-each select="@*">
|
|
73
|
+
<xsl:if test="$new-namespaces or position() > 1">
|
|
74
|
+
<xsl:value-of select="$attribute-indent" />
|
|
75
|
+
</xsl:if>
|
|
76
|
+
<xsl:text> </xsl:text>
|
|
77
|
+
<xsl:choose>
|
|
78
|
+
<xsl:when test="$perform-comparison">
|
|
79
|
+
<xsl:variable name="name" as="xs:QName" select="node-name(.)" />
|
|
80
|
+
<xsl:variable name="comparison-att" as="attribute()?" select="$comparison/@*[node-name(.) = $name]" />
|
|
81
|
+
<span class="{if (if ($expected) then test:deep-equal(., $comparison-att) else test:deep-equal($comparison-att, .)) then 'same' else 'diff'}">
|
|
82
|
+
<xsl:value-of select="name()" />
|
|
83
|
+
</span>
|
|
84
|
+
</xsl:when>
|
|
85
|
+
<xsl:otherwise>
|
|
86
|
+
<xsl:value-of select="name()" />
|
|
87
|
+
</xsl:otherwise>
|
|
88
|
+
</xsl:choose>
|
|
89
|
+
<xsl:text>="</xsl:text>
|
|
90
|
+
<xsl:value-of select="replace(replace(., '"', '&quot;'),
|
|
91
|
+
'\s(\s+)', '
$1')" />
|
|
92
|
+
<xsl:text>"</xsl:text>
|
|
93
|
+
</xsl:for-each>
|
|
94
|
+
<xsl:choose>
|
|
95
|
+
<xsl:when test="child::node()">
|
|
96
|
+
<xsl:text>></xsl:text>
|
|
97
|
+
<xsl:choose>
|
|
98
|
+
<xsl:when test="$perform-comparison and
|
|
99
|
+
not($expected) and
|
|
100
|
+
$comparison/node() instance of text() and
|
|
101
|
+
$comparison = '...'">
|
|
102
|
+
<xsl:text>...</xsl:text>
|
|
103
|
+
</xsl:when>
|
|
104
|
+
<xsl:when test="$perform-comparison">
|
|
105
|
+
<xsl:for-each select="node()">
|
|
106
|
+
<xsl:variable name="pos" as="xs:integer" select="position()" />
|
|
107
|
+
<xsl:apply-templates select="." mode="test:serialize">
|
|
108
|
+
<xsl:with-param name="level" select="$level + 1" tunnel="yes" />
|
|
109
|
+
<xsl:with-param name="comparison" select="$comparison/node()[position() = $pos]" />
|
|
110
|
+
<xsl:with-param name="expected" select="$expected" />
|
|
111
|
+
</xsl:apply-templates>
|
|
112
|
+
</xsl:for-each>
|
|
113
|
+
</xsl:when>
|
|
114
|
+
<xsl:otherwise>
|
|
115
|
+
<xsl:apply-templates mode="test:serialize">
|
|
116
|
+
<xsl:with-param name="level" select="$level + 1" tunnel="yes" />
|
|
117
|
+
</xsl:apply-templates>
|
|
118
|
+
</xsl:otherwise>
|
|
119
|
+
</xsl:choose>
|
|
120
|
+
<xsl:text></</xsl:text>
|
|
121
|
+
<xsl:value-of select="name()" />
|
|
122
|
+
<xsl:text>></xsl:text>
|
|
123
|
+
</xsl:when>
|
|
124
|
+
<xsl:otherwise> /></xsl:otherwise>
|
|
125
|
+
</xsl:choose>
|
|
126
|
+
</xsl:template>
|
|
127
|
+
|
|
128
|
+
<xsl:template match="comment()" mode="test:serialize">
|
|
129
|
+
<xsl:sequence
|
|
130
|
+
select="concat('<--', ., '-->')" />
|
|
131
|
+
</xsl:template>
|
|
132
|
+
|
|
133
|
+
<xsl:template match="processing-instruction()" mode="test:serialize">
|
|
134
|
+
<xsl:sequence select="concat('<?', name(), ' ', ., '?>')" />
|
|
135
|
+
</xsl:template>
|
|
136
|
+
|
|
137
|
+
<xsl:template match="node()" mode="test:serialize" priority="10">
|
|
138
|
+
<xsl:param name="perform-comparison" tunnel="yes" as="xs:boolean" select="false()" />
|
|
139
|
+
<xsl:param name="comparison" as="node()?" select="()" />
|
|
140
|
+
<xsl:param name="expected" as="xs:boolean" select="true()" />
|
|
141
|
+
<xsl:variable name="serialized" as="item()*">
|
|
142
|
+
<xsl:next-match />
|
|
143
|
+
</xsl:variable>
|
|
144
|
+
<xsl:choose>
|
|
145
|
+
<xsl:when test="$perform-comparison">
|
|
146
|
+
<span class="{if (if ($expected) then test:deep-equal(., $comparison) else test:deep-equal($comparison, .)) then 'same' else 'diff'}">
|
|
147
|
+
<xsl:copy-of select="$serialized" />
|
|
148
|
+
</span>
|
|
149
|
+
</xsl:when>
|
|
150
|
+
<xsl:otherwise>
|
|
151
|
+
<xsl:copy-of select="$serialized" />
|
|
152
|
+
</xsl:otherwise>
|
|
153
|
+
</xsl:choose>
|
|
154
|
+
</xsl:template>
|
|
155
|
+
|
|
156
|
+
<xsl:template match="test:ws" mode="test:serialize" priority="30">
|
|
157
|
+
<xsl:param name="perform-comparison" as="xs:boolean" tunnel="yes" select="false()" />
|
|
158
|
+
<xsl:if test="$perform-comparison">
|
|
159
|
+
<span class="whitespace">
|
|
160
|
+
<xsl:analyze-string select="." regex="\s">
|
|
161
|
+
<xsl:matching-substring>
|
|
162
|
+
<xsl:choose>
|
|
163
|
+
<xsl:when test=". = '
'">\n</xsl:when>
|
|
164
|
+
<xsl:when test=". = '
'">\r</xsl:when>
|
|
165
|
+
<xsl:when test=". = '	'">\t</xsl:when>
|
|
166
|
+
<xsl:when test=". = ' '">.</xsl:when>
|
|
167
|
+
</xsl:choose>
|
|
168
|
+
</xsl:matching-substring>
|
|
169
|
+
</xsl:analyze-string>
|
|
170
|
+
</span>
|
|
171
|
+
</xsl:if>
|
|
172
|
+
</xsl:template>
|
|
173
|
+
|
|
174
|
+
<xsl:template match="text()[not(normalize-space())]" mode="test:serialize" priority="20">
|
|
175
|
+
<xsl:param name="indentation" as="xs:integer" tunnel="yes" select="0" />
|
|
176
|
+
<xsl:value-of select="concat('
', substring(., $indentation + 2))" />
|
|
177
|
+
</xsl:template>
|
|
178
|
+
|
|
179
|
+
<xsl:function name="test:format-URI" as="xs:string">
|
|
180
|
+
<xsl:param name="URI" as="xs:anyURI" />
|
|
181
|
+
<xsl:choose>
|
|
182
|
+
<xsl:when test="starts-with($URI, 'file:/')">
|
|
183
|
+
<xsl:value-of select="replace(substring-after($URI, 'file:/'), '%20', ' ')" />
|
|
184
|
+
</xsl:when>
|
|
185
|
+
<xsl:otherwise>
|
|
186
|
+
<xsl:value-of select="$URI" />
|
|
187
|
+
</xsl:otherwise>
|
|
188
|
+
</xsl:choose>
|
|
189
|
+
</xsl:function>
|
|
190
|
+
|
|
191
|
+
</xsl:stylesheet>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
|
195
|
+
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
|
|
196
|
+
<!-- -->
|
|
197
|
+
<!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
|
|
198
|
+
<!-- -->
|
|
199
|
+
<!-- The contents of this file are subject to the MIT License (see the URI -->
|
|
200
|
+
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
|
|
201
|
+
<!-- -->
|
|
202
|
+
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
|
|
203
|
+
<!-- a copy of this software and associated documentation files (the -->
|
|
204
|
+
<!-- "Software"), to deal in the Software without restriction, including -->
|
|
205
|
+
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
|
|
206
|
+
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
|
|
207
|
+
<!-- permit persons to whom the Software is furnished to do so, subject to -->
|
|
208
|
+
<!-- the following conditions: -->
|
|
209
|
+
<!-- -->
|
|
210
|
+
<!-- The above copyright notice and this permission notice shall be -->
|
|
211
|
+
<!-- included in all copies or substantial portions of the Software. -->
|
|
212
|
+
<!-- -->
|
|
213
|
+
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
|
|
214
|
+
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
|
|
215
|
+
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
|
|
216
|
+
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
|
|
217
|
+
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
|
|
218
|
+
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
|
|
219
|
+
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
|
|
220
|
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|