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.
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,403 @@
1
+ #! /bin/bash
2
+
3
+ ##############################################################################
4
+ ##
5
+ ## This script is used to compile a test suite to XSLT, run it, format
6
+ ## the report and open it in a browser.
7
+ ##
8
+ ## It relies on the environment variable $SAXON_HOME to be set to the
9
+ ## dir Saxon has been installed to (i.e. the containing the Saxon JAR
10
+ ## file), or on $SAXON_CP to be set to a full classpath containing
11
+ ## Saxon (and maybe more). The latter has precedence over the former.
12
+ ##
13
+ ## It also uses the environment variable XSPEC_HOME. It must be set
14
+ ## to the XSpec install directory. By default, it uses this script's
15
+ ## parent dir.
16
+ ##
17
+ ## Note: If you use the EXPath Packaging System with Saxon, then you
18
+ ## already have the script "saxon" shipped with expath-repo. In that
19
+ ## case you don't need to do anything, this script will be detected
20
+ ## and used instead. You just have to ensure it is visible from here
21
+ ## (aka "ensure it is in the $PATH"). Even without packaging support,
22
+ ## this script is a useful way to launch Saxon from the shell.
23
+ ##
24
+ ## TODO: With the Packaging System, there should be no need to set the
25
+ ## XSPEC_HOME, as we could use absolute public URIs for the public
26
+ ## components...
27
+ ##
28
+ ##############################################################################
29
+
30
+ ##
31
+ ## utility functions #########################################################
32
+ ##
33
+
34
+ usage() {
35
+ if test -n "$1"; then
36
+ echo "$1"
37
+ echo;
38
+ fi
39
+ echo "Usage: xspec [-t|-q|-s|-c|-j|-h] filename [coverage]"
40
+ echo
41
+ echo " filename the XSpec document"
42
+ echo " -t test an XSLT stylesheet (the default)"
43
+ echo " -q test an XQuery module (mutually exclusive with -t and -s)"
44
+ echo " -s test a Schematron schema (mutually exclusive with -t and -q)"
45
+ echo " -c output test coverage report"
46
+ echo " -j output JUnit report"
47
+ echo " -h display this help message"
48
+ echo " coverage deprecated, use -c instead"
49
+ }
50
+
51
+ die() {
52
+ echo
53
+ echo "*** $@" >&2
54
+ exit 1
55
+ }
56
+
57
+ # If there is a script called "saxon" and returning ok (status code 0)
58
+ # when called with "--help", we assume this is the EXPath Packaging
59
+ # script for Saxon [1]. If it is present, that means the user already
60
+ # configured it, so there is no point to duplicate the logic here.
61
+ # Just use it.
62
+
63
+ if which saxon > /dev/null 2>&1 && saxon --help | grep "EXPath Packaging" > /dev/null 2>&1; then
64
+ echo Saxon script found, use it.
65
+ echo
66
+ xslt() {
67
+ saxon --add-cp "${XSPEC_HOME}/java/" --xsl "$@"
68
+ }
69
+ xquery() {
70
+ saxon --add-cp "${XSPEC_HOME}/java/" --xq "$@"
71
+ }
72
+ else
73
+ echo Saxon script not found, invoking JVM directly instead.
74
+ echo
75
+ xslt() {
76
+ java -cp "$CP" net.sf.saxon.Transform "$@"
77
+ }
78
+ xquery() {
79
+ java -cp "$CP" net.sf.saxon.Query "$@"
80
+ }
81
+ fi
82
+
83
+ ##
84
+ ## some variables ############################################################
85
+ ##
86
+
87
+ # the command to use to open the final HTML report
88
+ if [ `uname` = "Darwin" ]; then
89
+ OPEN=open
90
+ else
91
+ OPEN=see
92
+ fi
93
+
94
+ # the classpath delimiter (aka ':', except ';' on Cygwin)
95
+ if uname | grep -i cygwin >/dev/null 2>&1; then
96
+ CP_DELIM=";"
97
+ else
98
+ CP_DELIM=":"
99
+ fi
100
+
101
+ # set XSPEC_HOME if it has not been set by the user (set it to the
102
+ # parent dir of this script)
103
+ if test -z "$XSPEC_HOME"; then
104
+ XSPEC_HOME=`dirname $0`;
105
+ XSPEC_HOME=`dirname $XSPEC_HOME`;
106
+ fi
107
+ # safety checks
108
+ if test \! -d "${XSPEC_HOME}"; then
109
+ echo "ERROR: XSPEC_HOME is not a directory: ${XSPEC_HOME}"
110
+ exit 1;
111
+ fi
112
+ if test \! -f "${XSPEC_HOME}/src/compiler/generate-common-tests.xsl"; then
113
+ echo "ERROR: XSPEC_HOME seems to be corrupted: ${XSPEC_HOME}"
114
+ exit 1;
115
+ fi
116
+
117
+ # set SAXON_CP (either it has been by the user, or set it from SAXON_HOME)
118
+
119
+ if test -z "$SAXON_CP"; then
120
+ # Set this variable in your environment or here, if you don't set SAXON_CP
121
+ # SAXON_HOME=/path/to/saxon/dir
122
+ if test -z "$SAXON_HOME"; then
123
+ echo "SAXON_CP and SAXON_HOME both not set!"
124
+ # die "SAXON_CP and SAXON_HOME both not set!"
125
+ fi
126
+ if test -f "${SAXON_HOME}/saxon9ee.jar"; then
127
+ SAXON_CP="${SAXON_HOME}/saxon9ee.jar";
128
+ elif test -f "${SAXON_HOME}/saxon9pe.jar"; then
129
+ SAXON_CP="${SAXON_HOME}/saxon9pe.jar";
130
+ elif test -f "${SAXON_HOME}/saxon9he.jar"; then
131
+ SAXON_CP="${SAXON_HOME}/saxon9he.jar";
132
+ elif test -f "${SAXON_HOME}/saxon9sa.jar"; then
133
+ SAXON_CP="${SAXON_HOME}/saxon9sa.jar";
134
+ elif test -f "${SAXON_HOME}/saxon9.jar"; then
135
+ SAXON_CP="${SAXON_HOME}/saxon9.jar";
136
+ elif test -f "${SAXON_HOME}/saxonb9-1-0-8.jar"; then
137
+ SAXON_CP="${SAXON_HOME}/saxonb9-1-0-8.jar";
138
+ elif test -f "${SAXON_HOME}/saxon8sa.jar"; then
139
+ SAXON_CP="${SAXON_HOME}/saxon8sa.jar";
140
+ elif test -f "${SAXON_HOME}/saxon8.jar"; then
141
+ SAXON_CP="${SAXON_HOME}/saxon8.jar";
142
+ else
143
+ echo "Saxon jar cannot be found in SAXON_HOME: $SAXON_HOME"
144
+ # die "Saxon jar cannot be found in SAXON_HOME: $SAXON_HOME"
145
+ fi
146
+ fi
147
+
148
+ CP="${SAXON_CP}${CP_DELIM}${XSPEC_HOME}/java/"
149
+
150
+ ##
151
+ ## options ###################################################################
152
+ ##
153
+
154
+ while echo "$1" | grep -- ^- >/dev/null 2>&1; do
155
+ case "$1" in
156
+ # XSLT
157
+ -t)
158
+ if test -n "$XQUERY"; then
159
+ usage "-t and -q are mutually exclusive"
160
+ exit 1
161
+ fi
162
+ if test -n "$SCHEMATRON"; then
163
+ usage "-s and -t are mutually exclusive"
164
+ exit 1
165
+ fi
166
+ XSLT=1;;
167
+ # XQuery
168
+ -q)
169
+ if test -n "$XSLT"; then
170
+ usage "-t and -q are mutually exclusive"
171
+ exit 1
172
+ fi
173
+ if test -n "$SCHEMATRON"; then
174
+ usage "-s and -q are mutually exclusive"
175
+ exit 1
176
+ fi
177
+ XQUERY=1;;
178
+ # Schematron
179
+ -s)
180
+ if test -n "$XQUERY"; then
181
+ usage "-s and -q are mutually exclusive"
182
+ exit 1
183
+ fi
184
+ if test -n "$XSLT"; then
185
+ usage "-s and -t are mutually exclusive"
186
+ exit 1
187
+ fi
188
+ SCHEMATRON=1;;
189
+ # Coverage
190
+ -c)
191
+ if [[ ${SAXON_CP} != *"saxon9pe"* && ${SAXON_CP} != *"saxon9ee"* ]]; then
192
+ echo "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
193
+ exit 1
194
+ fi
195
+ COVERAGE=1;;
196
+ # JUnit report
197
+ -j)
198
+ if [[ ${SAXON_CP} == *"saxon8"* || ${SAXON_CP} == *"saxon8sa"* ]]; then
199
+ echo "Saxon8 detected. JUnit report requires Saxon9."
200
+ exit 1
201
+ fi
202
+ JUNIT=1;;
203
+ # Help!
204
+ -h)
205
+ usage
206
+ exit 0;;
207
+ # Unknown option!
208
+ -*)
209
+ usage "Error: Unknown option: $1"
210
+ exit 1;;
211
+ esac
212
+ shift;
213
+ done
214
+
215
+ # set XSLT if XQuery has not been set (that's the default)
216
+ if test -z "$XQUERY"; then
217
+ XSLT=1;
218
+ fi
219
+
220
+ XSPEC=$1
221
+ if [ ! -f "$XSPEC" ]; then
222
+ usage "Error: File not found."
223
+ exit 1
224
+ fi
225
+
226
+ if [ -n "$2" ]; then
227
+ if [ "$2" != coverage ]; then
228
+ usage "Error: Extra option: $2"
229
+ exit 1
230
+ fi
231
+ echo "Long-form option 'coverage' deprecated, use '-c' instead."
232
+ if [[ ${SAXON_CP} != *"saxon9pe"* && ${SAXON_CP} != *"saxon9ee"* ]]; then
233
+ echo "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
234
+ exit 1
235
+ fi
236
+ COVERAGE=1
237
+ if [ -n "$3" ]; then
238
+ usage "Error: Extra option: $3"
239
+ exit 1
240
+ fi
241
+ fi
242
+
243
+ ##
244
+ ## files and dirs ############################################################
245
+ ##
246
+
247
+ if [ -z "$TEST_DIR" ]
248
+ then
249
+ TEST_DIR=$(dirname "$XSPEC")/xspec
250
+ fi
251
+ TARGET_FILE_NAME=$(basename "$XSPEC" | sed 's:\.[^.]*$::')
252
+
253
+ if test -n "$XSLT"; then
254
+ COMPILED=$TEST_DIR/$TARGET_FILE_NAME.xsl
255
+ else
256
+ COMPILED=$TEST_DIR/$TARGET_FILE_NAME.xq
257
+ fi
258
+ COVERAGE_XML=$TEST_DIR/$TARGET_FILE_NAME-coverage.xml
259
+ COVERAGE_HTML=$TEST_DIR/$TARGET_FILE_NAME-coverage.html
260
+ RESULT=$TEST_DIR/$TARGET_FILE_NAME-result.xml
261
+ HTML=$TEST_DIR/$TARGET_FILE_NAME-result.html
262
+ JUNIT_RESULT=$TEST_DIR/$TARGET_FILE_NAME-junit.xml
263
+ COVERAGE_CLASS=com.jenitennison.xslt.tests.XSLTCoverageTraceListener
264
+
265
+ if [ ! -d "$TEST_DIR" ]; then
266
+ echo "Creating XSpec Directory at $TEST_DIR..."
267
+ mkdir "$TEST_DIR"
268
+ echo
269
+ fi
270
+
271
+ ##
272
+ ## compile the suite #########################################################
273
+ ##
274
+
275
+ if test -n "$SCHEMATRON"; then
276
+ echo "Setting up Schematron..."
277
+
278
+ if test -z "$SCHEMATRON_XSLT_INCLUDE"; then
279
+ SCHEMATRON_XSLT_INCLUDE="$XSPEC_HOME/src/schematron/iso-schematron/iso_dsdl_include.xsl";
280
+ fi
281
+ if test -z "$SCHEMATRON_XSLT_EXPAND"; then
282
+ SCHEMATRON_XSLT_EXPAND="$XSPEC_HOME/src/schematron/iso-schematron/iso_abstract_expand.xsl";
283
+ fi
284
+ if test -z "$SCHEMATRON_XSLT_COMPILE"; then
285
+ SCHEMATRON_XSLT_COMPILE="$XSPEC_HOME/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl";
286
+ fi
287
+
288
+ # get URI to Schematron file and phase/parameters from the XSpec file
289
+ # Need to escape for sh in XQuery: dollar sign as \$
290
+ xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; iri-to-uri(concat(replace(document-uri(/), '(.*)/.*\$', '\$1'), '/', /*[local-name() = 'description']/@schematron))" -s:"$XSPEC" >"$TEST_DIR/$TARGET_FILE_NAME-var.txt" || die "Error getting Schematron location"
291
+ SCH=`cat "$TEST_DIR/$TARGET_FILE_NAME-var.txt"`
292
+
293
+ xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; declare function local:escape(\$v) { let \$w := if (matches(\$v,codepoints-to-string((91,92,115,93)))) then codepoints-to-string(34) else '' return concat(\$w, replace(\$v,codepoints-to-string((40,91,36,92,92,96,93,41)),codepoints-to-string((92,92,36,49))), \$w)}; string-join(for \$p in /*/*[local-name() = 'param'] return if (\$p/@select) then concat('?',\$p/@name,'=',local:escape(\$p/@select)) else concat(\$p/@name,'=',local:escape(\$p/string())),' ')" -s:"$XSPEC" >"$TEST_DIR/$TARGET_FILE_NAME-var.txt" || die "Error getting Schematron phase and parameters"
294
+ SCH_PARAMS=`cat "$TEST_DIR/$TARGET_FILE_NAME-var.txt"`
295
+ echo Parameters: $SCH_PARAMS
296
+ SCHUT=$XSPEC-compiled.xspec
297
+ SCH_COMPILED=$(echo "$SCH" | sed 's:^file\:::')-compiled.xsl
298
+
299
+ echo
300
+ echo "Compiling the Schematron..."
301
+ xslt -o:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp1.xml" -s:"$SCH" -xsl:"$SCHEMATRON_XSLT_INCLUDE" -versionmsg:off || die "Error compiling the Schematron on step 1"
302
+ xslt -o:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp2.xml" -s:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp1.xml" -xsl:"$SCHEMATRON_XSLT_EXPAND" -versionmsg:off || die "Error compiling the Schematron on step 2"
303
+ xslt -o:"$SCH_COMPILED" -s:"$TEST_DIR/$TARGET_FILE_NAME-sch-temp2.xml" -xsl:"$SCHEMATRON_XSLT_COMPILE" -versionmsg:off $SCH_PARAMS || die "Error compiling the Schematron on step 3"
304
+
305
+ # use XQuery to get full URI to compiled Schematron
306
+ # xquery -qs:"declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:method 'text'; replace(iri-to-uri(document-uri(/)), concat(codepoints-to-string(94), 'file:/'), '')" -s:"$SCH_COMPILED" >"$TEST_DIR/$TARGET_FILE_NAME-var.txt" || die "Error getting compiled Schematron location"
307
+ # SCH_COMPILED=`cat "$TEST_DIR/$TARGET_FILE_NAME-var.txt"`
308
+
309
+ echo
310
+ echo "Compiling the Schematron tests..."
311
+ xslt -o:"$SCHUT" -s:"$XSPEC" -xsl:"$XSPEC_HOME/src/schematron/schut-to-xspec.xsl" stylesheet="$SCH_COMPILED" || die "Error compiling the Schematron tests"
312
+ XSPEC=$SCHUT
313
+
314
+ echo
315
+ fi
316
+
317
+ if test -n "$XSLT"; then
318
+ COMPILE_SHEET=generate-xspec-tests.xsl
319
+ else
320
+ COMPILE_SHEET=generate-query-tests.xsl
321
+ fi
322
+ echo "Creating Test Stylesheet..."
323
+ xslt -o:"$COMPILED" -s:"$XSPEC" \
324
+ -xsl:"$XSPEC_HOME/src/compiler/$COMPILE_SHEET" \
325
+ || die "Error compiling the test suite"
326
+ echo
327
+
328
+ ##
329
+ ## run the suite #############################################################
330
+ ##
331
+
332
+ echo "Running Tests..."
333
+ if test -n "$XSLT"; then
334
+ # for XSLT
335
+ if test -n "$COVERAGE"; then
336
+ echo "Collecting test coverage data; suppressing progress report..."
337
+ xslt -T:$COVERAGE_CLASS \
338
+ -o:"$RESULT" -s:"$XSPEC" -xsl:"$COMPILED" \
339
+ -it:{http://www.jenitennison.com/xslt/xspec}main 2> "$COVERAGE_XML" \
340
+ || die "Error collecting test coverage data"
341
+ else
342
+ xslt -o:"$RESULT" -s:"$XSPEC" -xsl:"$COMPILED" \
343
+ -it:{http://www.jenitennison.com/xslt/xspec}main \
344
+ || die "Error running the test suite"
345
+ fi
346
+ else
347
+ # for XQuery
348
+ if test -n "$COVERAGE"; then
349
+ echo "Collecting test coverage data; suppressing progress report..."
350
+ xquery -T:$COVERAGE_CLASS \
351
+ -o:"$RESULT" -s:"$XSPEC" "$COMPILED" 2> "$COVERAGE_XML" \
352
+ || die "Error collecting test coverage data"
353
+ else
354
+ xquery -o:"$RESULT" -s:"$XSPEC" "$COMPILED" \
355
+ || die "Error running the test suite"
356
+ fi
357
+ fi
358
+
359
+ ##
360
+ ## format the report #########################################################
361
+ ##
362
+
363
+ echo
364
+ echo "Formatting Report..."
365
+ xslt -o:"$HTML" \
366
+ -s:"$RESULT" \
367
+ -xsl:"$XSPEC_HOME/src/reporter/format-xspec-report.xsl" \
368
+ inline-css=true \
369
+ || die "Error formating the report"
370
+ if test -n "$COVERAGE"; then
371
+ xslt -l:on \
372
+ -o:"$COVERAGE_HTML" \
373
+ -s:"$COVERAGE_XML" \
374
+ -xsl:"$XSPEC_HOME/src/reporter/coverage-report.xsl" \
375
+ "tests=$XSPEC" \
376
+ "pwd=file:`pwd`/" \
377
+ || die "Error formating the coverage report"
378
+ echo "Report available at $COVERAGE_HTML"
379
+ #$OPEN "$COVERAGE_HTML"
380
+ elif test -n "$JUNIT"; then
381
+ xslt -o:"$JUNIT_RESULT" \
382
+ -s:"$RESULT" \
383
+ -xsl:"$XSPEC_HOME/src/reporter/junit-report.xsl" \
384
+ || die "Error formating the JUnit report"
385
+ echo "Report available at $JUNIT_RESULT"
386
+ else
387
+ echo "Report available at $HTML"
388
+ #$OPEN "$HTML"
389
+ fi
390
+
391
+ ##
392
+ ## cleanup
393
+ ##
394
+ if test -n "$SCHEMATRON"; then
395
+ rm -f "$SCHUT"
396
+ rm -f "$TEST_DIR"/context-*.xml
397
+ rm -f "$TEST_DIR/$TARGET_FILE_NAME-var.txt"
398
+ rm -f "$TEST_DIR/$TARGET_FILE_NAME-sch-temp1.xml"
399
+ rm -f "$TEST_DIR/$TARGET_FILE_NAME-sch-temp2.xml"
400
+ rm -f "$SCH_COMPILED"
401
+ fi
402
+
403
+ echo "Done."