simple-xspec-wrapper 0.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +11 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +37 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +49 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/exe/xspec +16 -0
  15. data/lib/xspec/version.rb +3 -0
  16. data/lib/xspec.rb +256 -0
  17. data/simple-xspec-wrapper.gemspec +28 -0
  18. data/spec-test.xml +1125 -0
  19. data/vendor/xspec-1.0.0/.gitignore +7 -0
  20. data/vendor/xspec-1.0.0/.travis.yml +57 -0
  21. data/vendor/xspec-1.0.0/LICENSE +21 -0
  22. data/vendor/xspec-1.0.0/README.md +26 -0
  23. data/vendor/xspec-1.0.0/appveyor.yml +77 -0
  24. data/vendor/xspec-1.0.0/bin/xspec.bat +620 -0
  25. data/vendor/xspec-1.0.0/bin/xspec.sh +403 -0
  26. data/vendor/xspec-1.0.0/build.xml +369 -0
  27. data/vendor/xspec-1.0.0/editors/emacs/README +31 -0
  28. data/vendor/xspec-1.0.0/editors/emacs/schemas.xml +6 -0
  29. data/vendor/xspec-1.0.0/editors/oxygen/.cvsignore +2 -0
  30. data/vendor/xspec-1.0.0/editors/oxygen/README +11 -0
  31. data/vendor/xspec-1.0.0/editors/oxygen/build.xml +38 -0
  32. data/vendor/xspec-1.0.0/editors/oxygen/templates/xspec.xml +17 -0
  33. data/vendor/xspec-1.0.0/editors/oxygen/xspec.framework +175 -0
  34. data/vendor/xspec-1.0.0/find-examples.xml +37 -0
  35. data/vendor/xspec-1.0.0/find-examples.xsl +615 -0
  36. data/vendor/xspec-1.0.0/graphics/3angle-down.gif +0 -0
  37. data/vendor/xspec-1.0.0/graphics/3angle-right.gif +0 -0
  38. data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class +0 -0
  39. data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java +209 -0
  40. data/vendor/xspec-1.0.0/src/ant/find-test-failure.xsl +17 -0
  41. data/vendor/xspec-1.0.0/src/ant/get-schematron-phase.xsl +17 -0
  42. data/vendor/xspec-1.0.0/src/ant/locate-schematron.xsl +28 -0
  43. data/vendor/xspec-1.0.0/src/ant/make-path.js +4 -0
  44. data/vendor/xspec-1.0.0/src/compiler/generate-common-tests.xsl +604 -0
  45. data/vendor/xspec-1.0.0/src/compiler/generate-query-helper.xsl +152 -0
  46. data/vendor/xspec-1.0.0/src/compiler/generate-query-tests.xsl +473 -0
  47. data/vendor/xspec-1.0.0/src/compiler/generate-query-utils.xql +263 -0
  48. data/vendor/xspec-1.0.0/src/compiler/generate-tests-helper.xsl +169 -0
  49. data/vendor/xspec-1.0.0/src/compiler/generate-tests-utils.xsl +479 -0
  50. data/vendor/xspec-1.0.0/src/compiler/generate-xspec-tests.xsl +503 -0
  51. data/vendor/xspec-1.0.0/src/harnesses/basex/basex-standalone-xquery-harness.xproc +135 -0
  52. data/vendor/xspec-1.0.0/src/harnesses/basex/basex-xquery-harness.xproc +133 -0
  53. data/vendor/xspec-1.0.0/src/harnesses/exist/exist-xquery-harness.xproc +161 -0
  54. data/vendor/xspec-1.0.0/src/harnesses/harness-lib.xpl +327 -0
  55. data/vendor/xspec-1.0.0/src/harnesses/marklogic/ml-xquery-harness.xproc +143 -0
  56. data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xquery-harness.xproc +108 -0
  57. data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xslt-harness.xproc +85 -0
  58. data/vendor/xspec-1.0.0/src/harnesses/zorba/zorba-xquery-harness.xproc +134 -0
  59. data/vendor/xspec-1.0.0/src/reporter/coverage-report.xsl +378 -0
  60. data/vendor/xspec-1.0.0/src/reporter/format-utils.xsl +220 -0
  61. data/vendor/xspec-1.0.0/src/reporter/format-xspec-report-folding.xsl +164 -0
  62. data/vendor/xspec-1.0.0/src/reporter/format-xspec-report.xsl +410 -0
  63. data/vendor/xspec-1.0.0/src/reporter/junit-report.xsl +93 -0
  64. data/vendor/xspec-1.0.0/src/reporter/test-report.css +469 -0
  65. data/vendor/xspec-1.0.0/src/schemas/find-examples.rnc +90 -0
  66. data/vendor/xspec-1.0.0/src/schemas/xspec.rnc +304 -0
  67. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_abstract_expand.xsl +313 -0
  68. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_dsdl_include.xsl +1519 -0
  69. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message.xsl +64 -0
  70. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message_xslt2.xsl +64 -0
  71. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_saxon.xsl +2306 -0
  72. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl +1851 -0
  73. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt1.xsl +614 -0
  74. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl +692 -0
  75. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/readme.txt +101 -0
  76. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-cs.xhtml +56 -0
  77. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-de.xhtml +55 -0
  78. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-en.xhtml +57 -0
  79. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-fr.xhtml +54 -0
  80. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-ja.xhtml +53 -0
  81. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-nl.xhtml +58 -0
  82. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/schematron-skeleton-api.htm +723 -0
  83. data/vendor/xspec-1.0.0/src/schematron/sch-location-compare.xsl +139 -0
  84. data/vendor/xspec-1.0.0/src/schematron/schut-to-xspec.xsl +179 -0
  85. data/vendor/xspec-1.0.0/test/Makefile +117 -0
  86. data/vendor/xspec-1.0.0/test/README +5 -0
  87. data/vendor/xspec-1.0.0/test/catalog/xspec-160_catalog.xml +4 -0
  88. data/vendor/xspec-1.0.0/test/catalog/xspec-160_schematron.xspec +6 -0
  89. data/vendor/xspec-1.0.0/test/catalog/xspec-160_xslt.xspec +5 -0
  90. data/vendor/xspec-1.0.0/test/end-to-end/README.md +42 -0
  91. data/vendor/xspec-1.0.0/test/end-to-end/cases/.gitignore +1 -0
  92. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/.gitignore +3 -0
  93. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-50-result-norm.html +74 -0
  94. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-55-result-norm.html +112 -0
  95. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-focus-1-result-norm.html +109 -0
  96. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-function-result-norm.html +118 -0
  97. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-import-result-norm.html +163 -0
  98. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-imported-result-norm.html +95 -0
  99. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-pending-result-norm.html +123 -0
  100. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-rule-result-norm.html +109 -0
  101. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-three-dots-result-norm.html +1237 -0
  102. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xsl +7 -0
  103. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xspec +10 -0
  104. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xsl +2 -0
  105. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xspec +18 -0
  106. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-focus-1.xspec +71 -0
  107. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-function.xspec +50 -0
  108. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-import.xspec +50 -0
  109. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-imported.xspec +48 -0
  110. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-pending.xspec +89 -0
  111. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-rule.xspec +76 -0
  112. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xsl +49 -0
  113. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xspec +527 -0
  114. data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.cmd +51 -0
  115. data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.sh +25 -0
  116. data/vendor/xspec-1.0.0/test/end-to-end/processor/_deserializer.xsl +53 -0
  117. data/vendor/xspec-1.0.0/test/end-to-end/processor/_normalizer.xsl +192 -0
  118. data/vendor/xspec-1.0.0/test/end-to-end/processor/_serializer.xsl +15 -0
  119. data/vendor/xspec-1.0.0/test/end-to-end/processor/_util.xsl +35 -0
  120. data/vendor/xspec-1.0.0/test/end-to-end/processor/compare.xsl +88 -0
  121. data/vendor/xspec-1.0.0/test/end-to-end/processor/normalize.xsl +28 -0
  122. data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.cmd +61 -0
  123. data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.sh +28 -0
  124. data/vendor/xspec-1.0.0/test/generate-tests-utils.xspec +636 -0
  125. data/vendor/xspec-1.0.0/test/generate-x-utils.xspec +173 -0
  126. data/vendor/xspec-1.0.0/test/generate-xspec-tests.xspec +64 -0
  127. data/vendor/xspec-1.0.0/test/run-xspec-tests.cmd +83 -0
  128. data/vendor/xspec-1.0.0/test/run-xspec-tests.sh +42 -0
  129. data/vendor/xspec-1.0.0/test/sch-location-compare.xspec +179 -0
  130. data/vendor/xspec-1.0.0/test/schematron/data/standards.xml +7 -0
  131. data/vendor/xspec-1.0.0/test/schematron/schematron-017.sch +9 -0
  132. data/vendor/xspec-1.0.0/test/schematron/schematron-018.sch +17 -0
  133. data/vendor/xspec-1.0.0/test/schematron/schematron-019.sch +13 -0
  134. data/vendor/xspec-1.0.0/test/schematron/schematron-020-01.sch +35 -0
  135. data/vendor/xspec-1.0.0/test/schematron/schematron-020.sch +32 -0
  136. data/vendor/xspec-1.0.0/test/schematron/schematron-021.sch +28 -0
  137. data/vendor/xspec-1.0.0/test/schematron/schematron-022.sch +18 -0
  138. data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-compile.xsl +8 -0
  139. data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-expand.xsl +8 -0
  140. data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-include.xsl +8 -0
  141. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-in.xspec +5 -0
  142. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-out.xspec +7 -0
  143. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-in.xspec +5 -0
  144. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-out.xspec +7 -0
  145. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002.sch +4 -0
  146. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-in.xspec +7 -0
  147. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-out.xspec +9 -0
  148. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-in.xspec +20 -0
  149. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-out.xspec +22 -0
  150. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-in.xspec +6 -0
  151. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-out.xspec +8 -0
  152. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-in.xspec +11 -0
  153. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-out.xspec +13 -0
  154. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-in.xspec +7 -0
  155. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-out.xspec +9 -0
  156. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007.xml +2 -0
  157. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-in.xspec +9 -0
  158. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-out.xspec +9 -0
  159. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-import-in.xspec +5 -0
  160. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-in.xspec +6 -0
  161. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-out.xspec +10 -0
  162. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-import.xspec +5 -0
  163. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-in.xspec +6 -0
  164. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-out.xspec +8 -0
  165. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-in.xspec +6 -0
  166. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-out.xspec +8 -0
  167. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-01.xml +4 -0
  168. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-02.xml +13 -0
  169. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-out.xspec +81 -0
  170. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-in.xspec +6 -0
  171. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-out.xspec +8 -0
  172. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch +4 -0
  173. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch.xsl +4 -0
  174. data/vendor/xspec-1.0.0/test/schematron-01.sch +17 -0
  175. data/vendor/xspec-1.0.0/test/schematron-01.xml +14 -0
  176. data/vendor/xspec-1.0.0/test/schematron-01.xspec +14 -0
  177. data/vendor/xspec-1.0.0/test/schematron-012.xspec +83 -0
  178. data/vendor/xspec-1.0.0/test/schematron-014-01.xml +10 -0
  179. data/vendor/xspec-1.0.0/test/schematron-014.sch +16 -0
  180. data/vendor/xspec-1.0.0/test/schematron-014.xspec +11 -0
  181. data/vendor/xspec-1.0.0/test/schematron-015.sch +16 -0
  182. data/vendor/xspec-1.0.0/test/schematron-015.xspec +11 -0
  183. data/vendor/xspec-1.0.0/test/schematron-016.sch +19 -0
  184. data/vendor/xspec-1.0.0/test/schematron-016.xspec +171 -0
  185. data/vendor/xspec-1.0.0/test/schematron-017.xspec +26 -0
  186. data/vendor/xspec-1.0.0/test/schematron-018.xspec +120 -0
  187. data/vendor/xspec-1.0.0/test/schematron-019.xspec +16 -0
  188. data/vendor/xspec-1.0.0/test/schematron-020.xspec +53 -0
  189. data/vendor/xspec-1.0.0/test/schematron-021.xspec +27 -0
  190. data/vendor/xspec-1.0.0/test/schematron-022.xspec +15 -0
  191. data/vendor/xspec-1.0.0/test/schematron-param-001.xspec +50 -0
  192. data/vendor/xspec-1.0.0/test/schut-to-xspec-012.sch +27 -0
  193. data/vendor/xspec-1.0.0/test/schut-to-xspec.xspec +85 -0
  194. data/vendor/xspec-1.0.0/test/unit-expect-xsl.xspec +28 -0
  195. data/vendor/xspec-1.0.0/test/xspec-26.xsl +19 -0
  196. data/vendor/xspec-1.0.0/test/xspec-26.xspec +17 -0
  197. data/vendor/xspec-1.0.0/test/xspec-30.xml +2 -0
  198. data/vendor/xspec-1.0.0/test/xspec-30.xsl +6 -0
  199. data/vendor/xspec-1.0.0/test/xspec-30.xspec +8 -0
  200. data/vendor/xspec-1.0.0/test/xspec-33.xsl +7 -0
  201. data/vendor/xspec-1.0.0/test/xspec-33.xspec +15 -0
  202. data/vendor/xspec-1.0.0/test/xspec-46.xsl +7 -0
  203. data/vendor/xspec-1.0.0/test/xspec-46.xspec +9 -0
  204. data/vendor/xspec-1.0.0/test/xspec-72.xsl +13 -0
  205. data/vendor/xspec-1.0.0/test/xspec-72.xspec +19 -0
  206. data/vendor/xspec-1.0.0/test/xspec-bat.cmd +757 -0
  207. data/vendor/xspec-1.0.0/test/xspec-focus-2.xspec +91 -0
  208. data/vendor/xspec-1.0.0/test/xspec-junit.xspec +78 -0
  209. data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xml +1003 -0
  210. data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xslt +10 -0
  211. data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xspec +13 -0
  212. data/vendor/xspec-1.0.0/test/xspec-tested.xql +44 -0
  213. data/vendor/xspec-1.0.0/test/xspec-tested.xsl +64 -0
  214. data/vendor/xspec-1.0.0/test/xspec-variable.xml +3 -0
  215. data/vendor/xspec-1.0.0/test/xspec-variable.xspec +58 -0
  216. data/vendor/xspec-1.0.0/test/xspec-xslt3.xsl +13 -0
  217. data/vendor/xspec-1.0.0/test/xspec-xslt3.xspec +12 -0
  218. data/vendor/xspec-1.0.0/test/xspec.bats +420 -0
  219. data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xslt +40 -0
  220. data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xspec +75 -0
  221. data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.sch +17 -0
  222. data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xml +11 -0
  223. data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xspec +14 -0
  224. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseA.xspec +11 -0
  225. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseB.xspec +12 -0
  226. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import1.xspec +10 -0
  227. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import2.xspec +8 -0
  228. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import3.xspec +10 -0
  229. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.sch +58 -0
  230. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.xml +19 -0
  231. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc1.xml +6 -0
  232. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc2.xml +7 -0
  233. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.sch +29 -0
  234. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.xspec +63 -0
  235. data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.sch +20 -0
  236. data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.xspec +33 -0
  237. data/vendor/xspec-1.0.0/tutorial/schematron/quickfix.sch +81 -0
  238. data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xq +8 -0
  239. data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xspec +16 -0
  240. data/vendor/xspec-1.0.0/xproject/project.xml +8 -0
  241. data/vendor/xspec-1.0.0/xproject/release-project.xsl +41 -0
  242. metadata +341 -0
@@ -0,0 +1,192 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:local="x-urn:xspec:test:end-to-end:processor:normalizer:local"
4
+ xmlns:normalizer="x-urn:xspec:test:end-to-end:processor:normalizer"
5
+ xmlns:util="x-urn:xspec:test:end-to-end:processor:util"
6
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7
+ xpath-default-namespace="http://www.w3.org/1999/xhtml">
8
+
9
+ <!--
10
+ This stylesheet module provides a primitive normalizer for the XSpec report HTML.
11
+ -->
12
+
13
+ <!--
14
+ Public functions
15
+ -->
16
+
17
+ <!-- Normalizes the transient parts of the document such as @href, @id, datetime and file path -->
18
+ <xsl:function as="document-node()" name="normalizer:normalize">
19
+ <xsl:param as="document-node()" name="doc" />
20
+
21
+ <xsl:apply-templates mode="local:normalize" select="$doc" />
22
+ </xsl:function>
23
+
24
+ <!--
25
+ Private templates
26
+ -->
27
+
28
+ <!-- Identity template, in lowest priority -->
29
+ <xsl:template as="node()" match="document-node() | attribute() | node()" mode="local:normalize"
30
+ priority="-1">
31
+ <xsl:copy>
32
+ <xsl:apply-templates mode="#current" select="attribute() | node()" />
33
+ </xsl:copy>
34
+ </xsl:template>
35
+
36
+ <!--
37
+ Removes comments and processing instructions
38
+ They are often ignored by fn:deep-equal(). So remove them explicitly in the first place.
39
+ -->
40
+ <xsl:template as="empty-sequence()" match="comment() | processing-instruction()"
41
+ mode="local:normalize" />
42
+
43
+ <!--
44
+ Normalizes the title text
45
+ Example:
46
+ in: <title>Test Report for /path/to/tested.xsl (passed: 2 / pending: 0 / failed: 1 / total: 3)</title>
47
+ out: <title>Test Report for tested.xsl (passed: 2 / pending: 0 / failed: 1 / total: 3)</title>
48
+ -->
49
+ <xsl:template as="text()" match="/html/head/title/text()" mode="local:normalize">
50
+ <xsl:analyze-string regex="^(Test Report for) (.+) (\([a-z0-9/: ]+\))$" select=".">
51
+ <xsl:matching-substring>
52
+ <xsl:value-of
53
+ select="
54
+ regex-group(1),
55
+ util:filename-and-extension(regex-group(2)),
56
+ regex-group(3)"
57
+ separator=" " />
58
+ </xsl:matching-substring>
59
+ </xsl:analyze-string>
60
+ </xsl:template>
61
+
62
+ <!--
63
+ Replaces the embedded CSS with the link to its source
64
+ For brevity. The details of style are not critical anyway.
65
+ -->
66
+ <xsl:template as="element(link)" match="/html/head/style" mode="local:normalize">
67
+ <link rel="stylesheet" type="text/css" xmlns="http://www.w3.org/1999/xhtml">
68
+ <xsl:attribute name="href">
69
+ <!-- Relative path to XSPEC_HOME from XSPEC_HOME/test/end-to-end/cases/*/*.html -->
70
+ <xsl:text>../../../../</xsl:text>
71
+
72
+ <!-- and down to the CSS source -->
73
+ <xsl:text>src/reporter/test-report.css</xsl:text>
74
+ </xsl:attribute>
75
+ </link>
76
+ </xsl:template>
77
+
78
+ <!--
79
+ Normalizes the link to the tested module
80
+ Example:
81
+ in: <a href="file:/path/to/tested.xsl">/path/to/tested.xsl</a>
82
+ out: <a href="tested.xsl">tested.xsl</a>
83
+ -->
84
+ <xsl:template as="element(a)" match="/html/body/p[1]/a" mode="local:normalize">
85
+ <xsl:copy>
86
+ <xsl:apply-templates mode="#current" select="attribute()" />
87
+ <xsl:attribute name="href" select="util:filename-and-extension(@href)" />
88
+
89
+ <xsl:value-of select="util:filename-and-extension(.)" />
90
+ </xsl:copy>
91
+ </xsl:template>
92
+
93
+ <!--
94
+ Normalizes datetime
95
+ Example:
96
+ in: <p>Tested: 23 February 2017 at 11:18</p>
97
+ out: <p>Tested: ONCE-UPON-A-TIME</p>
98
+ -->
99
+ <xsl:template as="text()" match="/html/body/p[2]/text()" mode="local:normalize">
100
+ <!-- Use analyze-string() so that the transformation will fail when nothing matches -->
101
+ <xsl:analyze-string regex="^(Tested:) .+$" select=".">
102
+ <xsl:matching-substring>
103
+ <xsl:value-of select="regex-group(1), 'ONCE-UPON-A-TIME'" />
104
+ </xsl:matching-substring>
105
+ </xsl:analyze-string>
106
+ </xsl:template>
107
+
108
+ <!-- Makes @id predictable -->
109
+ <xsl:template as="attribute(id)" match="@id" mode="local:normalize"
110
+ name="normalize-id-attribute">
111
+ <xsl:attribute name="{local-name()}" namespace="{namespace-uri()}"
112
+ select="local:generate-predictable-id(parent::element())" />
113
+ </xsl:template>
114
+
115
+ <!--
116
+ Makes the in-page link follow its target element
117
+ @id of the target element is normalized by the 'normalize-id-attribute' template. So @href has to follow it.
118
+ -->
119
+ <xsl:template as="attribute(href)" match="@href[starts-with(., '#')]" mode="local:normalize">
120
+ <!-- Substring after '#' -->
121
+ <xsl:variable as="xs:string" name="original-id" select="substring(., 2)" />
122
+
123
+ <xsl:variable as="element()?" name="target-element"
124
+ select="local:element-by-id(., $original-id)" />
125
+
126
+ <xsl:variable as="xs:string" name="predictable-id">
127
+ <xsl:choose>
128
+ <xsl:when test="$target-element">
129
+ <xsl:sequence select="local:generate-predictable-id($target-element)" />
130
+ </xsl:when>
131
+
132
+ <!-- @href's target element may not exist for pending scenarios: xspec/xspec#85 -->
133
+ <xsl:when test="parent::a/parent::th/parent::tr/@class eq 'pending'">
134
+ <!-- Assume that @href is always unique when the scenario is pending -->
135
+ <xsl:if test="count(//@href[. eq current()]) eq 1">
136
+ <!-- Use the current element's ID, prefixing 'PENDING_' to it -->
137
+ <xsl:sequence
138
+ select="concat('PENDING_', local:generate-predictable-id(parent::element()))"
139
+ />
140
+ </xsl:if>
141
+ </xsl:when>
142
+ </xsl:choose>
143
+ </xsl:variable>
144
+
145
+ <xsl:attribute name="{local-name()}" namespace="{namespace-uri()}"
146
+ select="concat('#', $predictable-id)" />
147
+ </xsl:template>
148
+
149
+ <!--
150
+ Private utility functions
151
+ -->
152
+
153
+ <!-- Gets the positional index (1~) of element -->
154
+ <xsl:function as="xs:integer" name="local:element-index">
155
+ <xsl:param as="element()" name="element" />
156
+
157
+ <xsl:sequence select="count($element/preceding::element()) + 1" />
158
+ </xsl:function>
159
+
160
+ <!--
161
+ Returns the element whose original @id is equal to the specified ID
162
+ If multiple elements satisfy the condition, returns the first element.
163
+ -->
164
+ <xsl:function as="element()?" name="local:element-by-id">
165
+ <xsl:param as="node()" name="context-node" />
166
+ <xsl:param as="xs:string" name="id" />
167
+
168
+ <xsl:variable as="document-node()" name="doc" select="root($context-node)" />
169
+ <xsl:sequence select="$doc/descendant::element()[@id eq $id][1]" />
170
+ </xsl:function>
171
+
172
+ <!--
173
+ Generates ID for element
174
+ Unlike fn:generate-id(), ID is generated solely from the element's positional index. So the ID value is predictable.
175
+ -->
176
+ <xsl:function as="xs:string" name="local:generate-predictable-id">
177
+ <xsl:param as="element()" name="element" />
178
+
179
+ <!--
180
+ Unfortunately the original @id is not always unique: xspec/xspec#78
181
+ So, for calculating the element index, you can't simply use the specified element. You have to determine which element to use.
182
+ -->
183
+ <xsl:variable as="element()" name="index-element"
184
+ select="
185
+ if ($element/@id) then
186
+ local:element-by-id($element, $element/@id)
187
+ else
188
+ $element" />
189
+
190
+ <xsl:sequence select="concat('ELEM-', local:element-index($index-element))" />
191
+ </xsl:function>
192
+ </xsl:stylesheet>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:serializer="x-urn:xspec:test:end-to-end:processor:serializer"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
+
6
+ <!--
7
+ This stylesheet module helps serialize the report HTML.
8
+ -->
9
+
10
+ <!--
11
+ Set of serialization parameters
12
+ The parameters must be in sync with XSPEC_HOME/src/reporter/format-xspec-report.xsl.
13
+ -->
14
+ <xsl:output name="serializer:output" />
15
+ </xsl:stylesheet>
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:util="x-urn:xspec:test:end-to-end:processor:util"
4
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
+
6
+ <!--
7
+ This stylesheet module is a collection of utilities.
8
+ -->
9
+
10
+ <!--
11
+ Extracts filename (with extension) from slash-delimited path
12
+ Example:
13
+ in: "file:/path/to/foo.bar.baz" or "/path/to/foo.bar.baz"
14
+ out: "foo.bar.baz"
15
+ -->
16
+ <xsl:function as="xs:string" name="util:filename-and-extension">
17
+ <xsl:param as="xs:string" name="uri" />
18
+
19
+ <xsl:sequence select="tokenize($uri, '/')[last()]" />
20
+ </xsl:function>
21
+
22
+ <!--
23
+ Extracts filename (without extension) from slash-delimited path
24
+ Example:
25
+ in: "file:/path/to/foo.bar.baz" or "/path/to/foo.bar.baz"
26
+ out: "foo.bar"
27
+ -->
28
+ <xsl:function as="xs:string" name="util:filename-without-extension">
29
+ <xsl:param as="xs:string" name="uri" />
30
+
31
+ <xsl:variable as="xs:string+" name="except-last"
32
+ select="tokenize(util:filename-and-extension($uri), '\.')[position() lt last()]" />
33
+ <xsl:sequence select="string-join($except-last, '.')" />
34
+ </xsl:function>
35
+ </xsl:stylesheet>
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:deserializer="x-urn:xspec:test:end-to-end:processor:deserializer"
4
+ xmlns:normalizer="x-urn:xspec:test:end-to-end:processor:normalizer"
5
+ xmlns:saxon="http://saxon.sf.net/"
6
+ xmlns:serializer="x-urn:xspec:test:end-to-end:processor:serializer"
7
+ xmlns:util="x-urn:xspec:test:end-to-end:processor:util"
8
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
9
+
10
+ <!--
11
+ This master stylesheet normalizes the input document and compares the normalized document with the expected HTML file.
12
+ Note: Comparison is performed by fn:deep-equal() which may ignore some comments and processing instructions.
13
+ -->
14
+
15
+ <xsl:include href="_deserializer.xsl" />
16
+ <xsl:include href="_normalizer.xsl" />
17
+ <xsl:include href="_serializer.xsl" />
18
+ <xsl:include href="_util.xsl" />
19
+
20
+ <xsl:output method="text" />
21
+
22
+ <!--
23
+ URI of the expected HTML file
24
+ Its content must be already normalized by the 'normalizer:normalize' template.
25
+ -->
26
+ <xsl:param as="xs:anyURI" name="EXPECTED-HTML"
27
+ select="
28
+ resolve-uri(
29
+ concat('../expected/', util:filename-without-extension(base-uri()), '-norm.html'),
30
+ base-uri())" />
31
+
32
+ <xsl:param as="xs:boolean" name="DEBUG" select="false()" />
33
+
34
+ <xsl:template as="text()+" match="document-node()">
35
+ <!-- Load the expected HTML -->
36
+ <xsl:variable as="document-node()" name="expected-doc"
37
+ select="deserializer:unindent(doc($EXPECTED-HTML))" />
38
+
39
+ <!-- Normalize the input document -->
40
+ <xsl:variable as="document-node()" name="input-doc" select="deserializer:unindent(.)" />
41
+ <xsl:variable as="document-node()" name="normalized-input-doc"
42
+ select="normalizer:normalize($input-doc)" />
43
+
44
+ <!-- Compare the normalized input document with the expected document -->
45
+ <xsl:variable as="xs:boolean" name="comparison-result"
46
+ select="deep-equal($normalized-input-doc, $expected-doc)" />
47
+
48
+ <!-- Diagnostic output -->
49
+ <xsl:if test="not($comparison-result) or $DEBUG">
50
+ <!-- Save the normalized input document -->
51
+ <xsl:variable as="xs:anyURI" name="normalized-input-html"
52
+ select="
53
+ resolve-uri(
54
+ concat(util:filename-without-extension(base-uri()), '-norm.html'),
55
+ base-uri())" />
56
+ <xsl:result-document format="serializer:output" href="{$normalized-input-html}">
57
+ <xsl:sequence select="$normalized-input-doc" />
58
+ </xsl:result-document>
59
+ <xsl:message select="'Saved the normalized input:', $normalized-input-html" />
60
+
61
+ <!-- Print the documents -->
62
+ <xsl:message select="'[NORMALIZED INPUT]', $normalized-input-doc" />
63
+ <xsl:message select="'[EXPECTED]', $expected-doc" />
64
+
65
+ <!-- Print the diff by passing '?' flag to saxon:deep-equal()-->
66
+ <xsl:if
67
+ test="
68
+ saxon:deep-equal($normalized-input-doc, $expected-doc, (), '?')
69
+ ne $comparison-result"
70
+ use-when="function-available('saxon:deep-equal') (: Requires Saxon-PE :)">
71
+ <!-- Terminate if saxon:deep-equal() contradicts the comparison result -->
72
+ <xsl:message terminate="yes" />
73
+ </xsl:if>
74
+ </xsl:if>
75
+
76
+ <!-- Output the comparison result -->
77
+ <xsl:value-of select="
78
+ if ($comparison-result) then
79
+ 'OK'
80
+ else
81
+ 'FAILED'" />
82
+ <xsl:text>: Compared </xsl:text>
83
+ <xsl:value-of select="base-uri()" />
84
+ <xsl:text> with </xsl:text>
85
+ <xsl:value-of select="$EXPECTED-HTML" />
86
+ <xsl:text>&#x0A;</xsl:text>
87
+ </xsl:template>
88
+ </xsl:stylesheet>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:deserializer="x-urn:xspec:test:end-to-end:processor:deserializer"
4
+ xmlns:normalizer="x-urn:xspec:test:end-to-end:processor:normalizer"
5
+ xmlns:serializer="x-urn:xspec:test:end-to-end:processor:serializer"
6
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7
+
8
+ <!--
9
+ This master stylesheet normalizes the input document.
10
+ -->
11
+
12
+ <xsl:include href="_deserializer.xsl" />
13
+ <xsl:include href="_normalizer.xsl" />
14
+ <xsl:include href="_serializer.xsl" />
15
+ <xsl:include href="_util.xsl" />
16
+
17
+ <xsl:template as="empty-sequence()" match="document-node()">
18
+ <xsl:message select="'Normalizing', base-uri()" />
19
+
20
+ <xsl:variable as="document-node()" name="input-doc" select="deserializer:unindent(.)" />
21
+
22
+ <xsl:result-document format="serializer:output">
23
+ <xsl:sequence select="normalizer:normalize($input-doc)" />
24
+ </xsl:result-document>
25
+
26
+ <xsl:message select="'Normalized'" />
27
+ </xsl:template>
28
+ </xsl:stylesheet>
@@ -0,0 +1,61 @@
1
+ @echo off
2
+
3
+ rem
4
+ rem Begin localization of environment changes.
5
+ rem Also make sure the command processor extensions are enabled.
6
+ rem
7
+ verify other 2> NUL
8
+ setlocal enableextensions
9
+ if errorlevel 1 (
10
+ echo Unable to enable extensions
11
+ exit /b %ERRORLEVEL%
12
+ )
13
+
14
+ rem
15
+ rem Go to the directory where this script resides
16
+ rem
17
+ pushd "%~dp0"
18
+
19
+ rem
20
+ rem .xspec files directory
21
+ rem
22
+ set CASES_DIR=cases
23
+
24
+ rem
25
+ rem XSpec output directory (same as default)
26
+ rem
27
+ set TEST_DIR=%CASES_DIR%\xspec
28
+
29
+ rem
30
+ rem Run test cases
31
+ rem
32
+ for %%I in ("%CASES_DIR%\*.xspec") do (
33
+ if /i "%APPVEYOR%"=="True" appveyor AddTest "%%~I" -Framework custom -Filename "%~nx0" -Outcome Running
34
+
35
+ rem
36
+ rem Generate the report HTML
37
+ rem
38
+ "%COMSPEC%" /c ..\..\bin\xspec.bat "%%~I" > NUL 2>&1
39
+
40
+ rem
41
+ rem Compare with the expected HTML
42
+ rem
43
+ java -classpath "%SAXON_CP%" net.sf.saxon.Transform -s:"%TEST_DIR%\%%~nI-result.html" -xsl:processor\compare.xsl | findstr /b /l /c:"OK: Compared "
44
+ if errorlevel 1 (
45
+ echo FAILED: %%~I
46
+ if /i "%APPVEYOR%"=="True" appveyor UpdateTest "%%~I" -Framework custom -Filename "%~nx0" -Outcome Failed -Duration 0
47
+ exit /b 1
48
+ )
49
+
50
+ if /i "%APPVEYOR%"=="True" appveyor UpdateTest "%%~I" -Framework custom -Filename "%~nx0" -Outcome Passed -Duration 0
51
+ )
52
+
53
+ rem
54
+ rem Go back to the initial directory
55
+ rem
56
+ popd
57
+
58
+ rem
59
+ rem Exit as success
60
+ rem
61
+ exit /b 0
@@ -0,0 +1,28 @@
1
+ #!/bin/bash
2
+
3
+ # This script must be run from the script's directory
4
+
5
+ # .xspec files directory
6
+ CASES_DIR=cases
7
+
8
+ # XSpec output directory (same as default)
9
+ export TEST_DIR=${CASES_DIR}/xspec
10
+
11
+ # Run test cases
12
+ for CASE_FILEPATH in ${CASES_DIR}/*.xspec
13
+ do
14
+ # Generate the report HTML
15
+ ../../bin/xspec.sh ${CASE_FILEPATH} > /dev/null 2>&1
16
+
17
+ # Compare with the expected HTML
18
+ CASE_FILENAME=${CASE_FILEPATH##*/}
19
+ CASE_BASENAME=${CASE_FILENAME%.xspec}
20
+ if java -classpath ${SAXON_CP} net.sf.saxon.Transform -s:${TEST_DIR}/${CASE_BASENAME}-result.html -xsl:processor/compare.xsl | grep '^OK: Compared '
21
+ then
22
+ # OK, nothing to do
23
+ :
24
+ else
25
+ echo "FAILED: ${CASE_FILEPATH}"
26
+ exit 1
27
+ fi
28
+ done