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,209 @@
1
+ /****************************************************************************/
2
+ /* File: XSLTCoverageTraceListener.java */
3
+ /* Author: Jeni Tennison */
4
+ /* URI: https://github.com/expath/xspec/ */
5
+ /* Tags: */
6
+ /* Copyright (c) 2008-2016 (see end of file.) */
7
+ /* ------------------------------------------------------------------------ */
8
+
9
+
10
+ package com.jenitennison.xslt.tests;
11
+
12
+ import net.sf.saxon.lib.TraceListener;
13
+ import net.sf.saxon.trace.InstructionInfo;
14
+ import net.sf.saxon.trace.LocationKind;
15
+ import net.sf.saxon.Controller;
16
+ import net.sf.saxon.expr.XPathContext;
17
+ import net.sf.saxon.om.Item;
18
+ import net.sf.saxon.om.StandardNames;
19
+ import java.lang.String;
20
+ import java.util.HashMap;
21
+ import java.util.HashSet;
22
+ import java.io.PrintStream;
23
+ import net.sf.saxon.lib.Logger;
24
+
25
+ /**
26
+ * A Simple trace listener for XSLT that writes messages (by default) to System.err
27
+ */
28
+
29
+ public class XSLTCoverageTraceListener implements TraceListener {
30
+
31
+ private PrintStream out = System.err;
32
+ private String xspecStylesheet = null;
33
+ private String utilsStylesheet = null;
34
+ private HashMap<String, Integer> modules = new HashMap<String, Integer>();
35
+ private HashSet<Integer> constructs = new HashSet<Integer>();
36
+ private int moduleCount = 0;
37
+
38
+ public XSLTCoverageTraceListener() {
39
+ System.out.println("****************************************");
40
+ }
41
+
42
+ /**
43
+ * Method called at the start of execution, that is, when the run-time transformation starts
44
+ */
45
+
46
+ public void open(Controller c) {
47
+ out.println("<trace>");
48
+ System.out.println("controller="+c);
49
+ }
50
+
51
+ /**
52
+ * Method that implements the output destination for SaxonEE/PE 9.7
53
+ */
54
+ public void setOutputDestination(Logger logger) {
55
+ }
56
+
57
+ /**
58
+ * Method called at the end of execution, that is, when the run-time execution ends
59
+ */
60
+
61
+ public void close() {
62
+ out.println("</trace>");
63
+ }
64
+
65
+ /**
66
+ * Method that is called when an instruction in the stylesheet gets processed.
67
+ * @param instruction gives information about the instruction being
68
+ * executed, and about the context in which it is executed. This object is mutable,
69
+ * so if information from the InstructionInfo is to be retained, it must be copied.
70
+ */
71
+
72
+ public void enter(InstructionInfo info, XPathContext context) {
73
+ int lineNumber = info.getLineNumber();
74
+ String systemId = info.getSystemId();
75
+ int constructType = info.getConstructType();
76
+ if (utilsStylesheet == null &&
77
+ systemId.indexOf("generate-tests-utils.xsl") != -1) {
78
+ utilsStylesheet = systemId;
79
+ out.println("<u u=\"" + systemId + "\" />");
80
+ } else if (xspecStylesheet == null &&
81
+ systemId.indexOf("/xspec/") != -1) {
82
+ xspecStylesheet = systemId;
83
+ out.println("<x u=\"" + systemId + "\" />");
84
+ }
85
+ if (systemId != xspecStylesheet && systemId != utilsStylesheet) {
86
+ Integer module;
87
+ if (modules.containsKey(systemId)) {
88
+ module = (Integer)modules.get(systemId);
89
+ } else {
90
+ module = new Integer(moduleCount);
91
+ moduleCount += 1;
92
+ modules.put(systemId, module);
93
+ out.println("<m id=\"" + module + "\" u=\"" + systemId + "\" />");
94
+ }
95
+ if (!constructs.contains(constructType)) {
96
+ String construct;
97
+ if (constructType < 1024) {
98
+ construct = StandardNames.getClarkName(constructType);
99
+ } else {
100
+ switch (constructType) {
101
+ case LocationKind.LITERAL_RESULT_ELEMENT:
102
+ construct = "LITERAL_RESULT_ELEMENT";
103
+ break;
104
+ case LocationKind.LITERAL_RESULT_ATTRIBUTE:
105
+ construct = "LITERAL_RESULT_ATTRIBUTE";
106
+ break;
107
+ case LocationKind.EXTENSION_INSTRUCTION:
108
+ construct = "EXTENSION_INSTRUCTION";
109
+ break;
110
+ case LocationKind.TEMPLATE:
111
+ construct = "TEMPLATE";
112
+ break;
113
+ case LocationKind.FUNCTION_CALL:
114
+ construct = "FUNCTION_CALL";
115
+ break;
116
+ case LocationKind.XPATH_IN_XSLT:
117
+ construct = "XPATH_IN_XSLT";
118
+ break;
119
+ case LocationKind.LET_EXPRESSION:
120
+ construct = "LET_EXPRESSION";
121
+ break;
122
+ case LocationKind.TRACE_CALL:
123
+ construct = "TRACE_CALL";
124
+ break;
125
+ case LocationKind.SAXON_EVALUATE:
126
+ construct = "SAXON_EVALUATE";
127
+ break;
128
+ case LocationKind.FUNCTION:
129
+ construct = "FUNCTION";
130
+ break;
131
+ case LocationKind.XPATH_EXPRESSION:
132
+ construct = "XPATH_EXPRESSION";
133
+ break;
134
+ default:
135
+ construct = "Other";
136
+ }
137
+ }
138
+ constructs.add(constructType);
139
+ out.println("<c id=\"" + constructType + "\" n=\"" + construct + "\" />");
140
+ }
141
+ out.println("<h l=\"" + lineNumber + "\" m=\"" + module + "\" c=\"" + constructType + "\" />");
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Method that is called after processing an instruction of the stylesheet,
147
+ * that is, after any child instructions have been processed.
148
+ * @param instruction gives the same information that was supplied to the
149
+ * enter method, though it is not necessarily the same object. Note that the
150
+ * line number of the instruction is that of the start tag in the source stylesheet,
151
+ * not the line number of the end tag.
152
+ */
153
+
154
+ public void leave(InstructionInfo instruction) {
155
+ // Do nothing
156
+ }
157
+
158
+ /**
159
+ * Method that is called by an instruction that changes the current item
160
+ * in the source document: that is, xsl:for-each, xsl:apply-templates, xsl:for-each-group.
161
+ * The method is called after the enter method for the relevant instruction, and is called
162
+ * once for each item processed.
163
+ * @param currentItem the new current item. Item objects are not mutable; it is safe to retain
164
+ * a reference to the Item for later use.
165
+ */
166
+
167
+ public void startCurrentItem(Item currentItem) {
168
+ // Do nothing
169
+ }
170
+
171
+ /**
172
+ * Method that is called when an instruction has finished processing a new current item
173
+ * and is ready to select a new current item or revert to the previous current item.
174
+ * The method will be called before the leave() method for the instruction that made this
175
+ * item current.
176
+ * @param currentItem the item that was current, whose processing is now complete. This will represent
177
+ * the same underlying item as the corresponding startCurrentItem() call, though it will
178
+ * not necessarily be the same actual object.
179
+ */
180
+
181
+ public void endCurrentItem(Item currentItem) {
182
+ // Do nothing
183
+ }
184
+
185
+ }
186
+
187
+
188
+ //
189
+ // The contents of this file are subject to the Mozilla Public License
190
+ // Version 1.0 (the "License"); you may not use this file except in
191
+ // compliance with the License. You may obtain a copy of the License
192
+ // at http://www.mozilla.org/MPL/
193
+ //
194
+ // Software distributed under the License is distributed on an "AS IS"
195
+ // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
196
+ // See the License for the specific language governing rights and
197
+ // limitations under the License.
198
+ //
199
+ // The Original Code is: all this file.
200
+ //
201
+ // The Initial Developer of the Original Code is Edwin Glaser
202
+ // (edwin@pannenleiter.de)
203
+ //
204
+ // Portions created by Jeni Tennison are Copyright (C) Jeni Tennison.
205
+ // All Rights Reserved.
206
+ //
207
+ // Contributor(s): Heavily modified by Michael Kay
208
+ // Methods implemented by Jeni Tennison
209
+ // Extended for Saxon 9.7 by Sandro Cirulli, github.com/cirulls
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:x="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
+
6
+ <!--
7
+ Finds any test failure in XSpec test result XML file.
8
+ Output XML structure is for Ant <xmlproperty> task.
9
+ -->
10
+ <xsl:template as="element(xspec)" match="document-node()">
11
+ <xspec>
12
+ <passed>
13
+ <xsl:value-of select="empty(//x:*[@successful = 'false'])" />
14
+ </passed>
15
+ </xspec>
16
+ </xsl:template>
17
+ </xsl:stylesheet>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
3
+ xmlns:x="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
+
6
+ <!--
7
+ Extracts Schematron phase from .xspec file.
8
+ Output XML structure is for Ant <xmlproperty> task.
9
+ -->
10
+ <xsl:template as="element(xspec)" match="document-node()">
11
+ <xspec>
12
+ <phase>
13
+ <xsl:value-of select="/x:description/x:param[@name = 'phase'][1]" />
14
+ </phase>
15
+ </xspec>
16
+ </xsl:template>
17
+ </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:x="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
+
6
+ <!--
7
+ Makes absolute URI from @schematron and resolves it with catalog.
8
+ Output XML structure is for Ant <xmlproperty> task.
9
+ -->
10
+ <xsl:template as="element(xspec)" match="document-node()">
11
+ <xspec>
12
+ <schematron>
13
+ <uri>
14
+ <!-- Resolve with node base URI -->
15
+ <xsl:variable as="xs:anyURI" name="schematron-uri"
16
+ select="/x:description/@schematron/resolve-uri(., base-uri())" />
17
+
18
+ <!-- Resolve with calalog -->
19
+ <xsl:variable as="xs:anyURI" name="schematron-uri"
20
+ select="doc($schematron-uri)/base-uri()" />
21
+
22
+ <!-- Can be 'file:C:/...' for some reason. Fix it. -->
23
+ <xsl:value-of select="replace($schematron-uri, '^(file:)([^/])', '$1/$2')" />
24
+ </uri>
25
+ </schematron>
26
+ </xspec>
27
+ </xsl:template>
28
+ </xsl:stylesheet>
@@ -0,0 +1,4 @@
1
+ var javaURL = new java.net.URL(attributes.get("url"));
2
+ var javaFile = new java.io.File(javaURL.toURI());
3
+ var path = javaFile.toString();
4
+ self.project.setProperty(attributes.get("property"), path);