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,164 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- ===================================================================== -->
3
+ <!-- File: format-xspec-report-folding.xsl -->
4
+ <!-- Author: Jeni Tennsion -->
5
+ <!-- Tags: -->
6
+ <!-- Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) -->
7
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
8
+
9
+
10
+ <xsl:stylesheet version="2.0"
11
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
13
+ xmlns:x="http://www.jenitennison.com/xslt/xspec"
14
+ xmlns:test="http://www.jenitennison.com/xslt/unit-test"
15
+ exclude-result-prefixes="x xs test"
16
+ xmlns:pkg="http://expath.org/ns/pkg"
17
+ xmlns="http://www.w3.org/1999/xhtml">
18
+
19
+ <xsl:import href="format-xspec-report.xsl" />
20
+
21
+ <pkg:import-uri>http://www.jenitennison.com/xslt/xspec/format-xspec-report-folding.xsl</pkg:import-uri>
22
+
23
+ <xsl:template name="x:html-head-callback">
24
+ <script language="javascript" type="text/javascript">
25
+ function toggle(scenarioID) {
26
+ table = document.getElementById("t-"+scenarioID);
27
+ icon = document.getElementById("icon-"+scenarioID)
28
+ // need to:
29
+ // switch table.style.display between 'none' and 'block'
30
+ // switch between collapse and expand icons
31
+
32
+ if (table.style.display == "none") {
33
+ // This try/catch is to handle IE 7. It doesn't support table.style.display = "table"
34
+ try {
35
+ table.style.display = "table";
36
+ } catch(err) {
37
+ table.style.display = "block";
38
+ }
39
+ icon.src = "<xsl:value-of select="resolve-uri('graphics/3angle-down.gif', static-base-uri())"/>" ;
40
+ icon.alt = "collapse" ;
41
+ icon.title = "collapse" ;
42
+ }
43
+ else {
44
+ table.style.display = "none";
45
+ icon.src = "<xsl:value-of select="resolve-uri('graphics/3angle-right.gif', static-base-uri())"/>" ;
46
+ icon.alt = "expand" ;
47
+ icon.title = "expand" ;
48
+ };
49
+
50
+ return;
51
+ }
52
+ </script>
53
+ </xsl:template>
54
+
55
+ <xsl:template name="x:format-top-level-scenario">
56
+ <xsl:variable name="pending" as="xs:boolean"
57
+ select="exists(@pending)" />
58
+ <xsl:variable name="any-failure" as="xs:boolean"
59
+ select="exists(x:test[@successful = 'false'])" />
60
+ <xsl:variable name="any-descendant-failure" as="xs:boolean"
61
+ select="exists(.//x:test[@successful = 'false'])" />
62
+ <div id="{generate-id()}">
63
+ <h2 id="h-{generate-id()}"
64
+ class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
65
+ <a href="javascript:toggle('{generate-id()}')">
66
+ <img src="{resolve-uri(concat('graphics/', if ($any-descendant-failure) then '3angle-down.gif' else '3angle-right.gif'), static-base-uri())}"
67
+ alt="{if ($any-descendant-failure) then 'collapse' else 'expand'}" id="icon-{generate-id()}"/>
68
+ </a>
69
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
70
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
71
+ <span class="scenario-totals">
72
+ <xsl:call-template name="x:totals">
73
+ <xsl:with-param name="tests" select=".//x:test" />
74
+ </xsl:call-template>
75
+ </span>
76
+ </h2>
77
+ <table class="xspec" id="t-{generate-id()}" style="display: {if ($any-descendant-failure) then 'table' else 'none'}">
78
+ <col width="85%" />
79
+ <col width="15%" />
80
+ <tbody>
81
+ <tr class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
82
+ <th>
83
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
84
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
85
+ </th>
86
+ <th>
87
+ <xsl:call-template name="x:totals">
88
+ <xsl:with-param name="tests" select=".//x:test" />
89
+ </xsl:call-template>
90
+ </th>
91
+ </tr>
92
+ <xsl:apply-templates select="x:test" mode="x:html-summary" />
93
+ <xsl:for-each select=".//x:scenario[x:test]">
94
+ <xsl:variable name="pending" as="xs:boolean"
95
+ select="exists(@pending)" />
96
+ <xsl:variable name="any-failure" as="xs:boolean"
97
+ select="exists(x:test[@successful = 'false'])" />
98
+ <xsl:variable name="label" as="node()+">
99
+ <xsl:for-each select="ancestor-or-self::x:scenario[position() != last()]">
100
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
101
+ <xsl:if test="position() != last()">
102
+ <xsl:copy-of select="x:separator-callback()"/>
103
+ </xsl:if>
104
+ </xsl:for-each>
105
+ </xsl:variable>
106
+ <tr id="{generate-id()}"
107
+ class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
108
+ <th>
109
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
110
+ <xsl:choose>
111
+ <xsl:when test="$any-failure">
112
+ <a href="#{generate-id()}">
113
+ <xsl:sequence select="$label" />
114
+ </a>
115
+ </xsl:when>
116
+ <xsl:otherwise>
117
+ <xsl:sequence select="$label" />
118
+ </xsl:otherwise>
119
+ </xsl:choose>
120
+ </th>
121
+ <th>
122
+ <xsl:call-template name="x:totals">
123
+ <xsl:with-param name="tests" select="x:test" />
124
+ </xsl:call-template>
125
+ </th>
126
+ </tr>
127
+ <xsl:apply-templates select="x:test" mode="x:html-summary" />
128
+ </xsl:for-each>
129
+ </tbody>
130
+ </table>
131
+ <xsl:apply-templates select="descendant-or-self::x:scenario[x:test[@successful = 'false']]" mode="x:html-report" />
132
+ </div>
133
+ </xsl:template>
134
+
135
+ </xsl:stylesheet>
136
+
137
+
138
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
139
+ <!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
140
+ <!-- -->
141
+ <!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
142
+ <!-- -->
143
+ <!-- The contents of this file are subject to the MIT License (see the URI -->
144
+ <!-- http://www.opensource.org/licenses/mit-license.php for details). -->
145
+ <!-- -->
146
+ <!-- Permission is hereby granted, free of charge, to any person obtaining -->
147
+ <!-- a copy of this software and associated documentation files (the -->
148
+ <!-- "Software"), to deal in the Software without restriction, including -->
149
+ <!-- without limitation the rights to use, copy, modify, merge, publish, -->
150
+ <!-- distribute, sublicense, and/or sell copies of the Software, and to -->
151
+ <!-- permit persons to whom the Software is furnished to do so, subject to -->
152
+ <!-- the following conditions: -->
153
+ <!-- -->
154
+ <!-- The above copyright notice and this permission notice shall be -->
155
+ <!-- included in all copies or substantial portions of the Software. -->
156
+ <!-- -->
157
+ <!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
158
+ <!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
159
+ <!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
160
+ <!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
161
+ <!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
162
+ <!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
163
+ <!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
164
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -0,0 +1,410 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- ===================================================================== -->
3
+ <!-- File: format-xspec-report.xsl -->
4
+ <!-- Author: Jeni Tennsion -->
5
+ <!-- Tags: -->
6
+ <!-- Copyright (c) 2008, 2010 Jeni Tennsion (see end of file.) -->
7
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
8
+
9
+
10
+ <xsl:stylesheet version="2.0"
11
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
13
+ xmlns:x="http://www.jenitennison.com/xslt/xspec"
14
+ xmlns:test="http://www.jenitennison.com/xslt/unit-test"
15
+ exclude-result-prefixes="x xs test pkg"
16
+ xmlns:pkg="http://expath.org/ns/pkg"
17
+ xmlns="http://www.w3.org/1999/xhtml">
18
+
19
+ <xsl:import href="format-utils.xsl"/>
20
+
21
+ <pkg:import-uri>http://www.jenitennison.com/xslt/xspec/format-xspec-report.xsl</pkg:import-uri>
22
+
23
+ <xsl:param name="inline-css">false</xsl:param>
24
+
25
+ <xsl:param name="report-css-uri" select="
26
+ resolve-uri('test-report.css', static-base-uri())"/>
27
+
28
+ <xsl:function name="x:pending-callback" as="node()*">
29
+ <!-- returns formatted output for $pending. -->
30
+ <xsl:param name="pending" as="xs:string?"/>
31
+ <xsl:if test="$pending">
32
+ <xsl:text>(</xsl:text>
33
+ <strong><xsl:value-of select="$pending"/></strong>
34
+ <xsl:text>) </xsl:text>
35
+ </xsl:if>
36
+ </xsl:function>
37
+
38
+ <xsl:function name="x:separator-callback" as="node()*">
39
+ <!-- returns formatted output for separator between scenarios. -->
40
+ <xsl:text> </xsl:text>
41
+ </xsl:function>
42
+
43
+ <xsl:template name="x:html-head-callback" as="node()*"/>
44
+
45
+ <xsl:template name="x:format-top-level-scenario">
46
+ <xsl:variable name="pending" as="xs:boolean"
47
+ select="exists(@pending)" />
48
+ <xsl:variable name="any-failure" as="xs:boolean"
49
+ select="exists(x:test[@successful = 'false'])" />
50
+ <div id="{generate-id()}">
51
+ <h2 class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
52
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
53
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
54
+ <span class="scenario-totals">
55
+ <xsl:call-template name="x:totals">
56
+ <xsl:with-param name="tests" select=".//x:test[parent::x:scenario]" />
57
+ <xsl:with-param name="labels" select="true()"/>
58
+ </xsl:call-template>
59
+ </span>
60
+ </h2>
61
+ <table class="xspec" id="t-{generate-id()}">
62
+ <col width="75%" />
63
+ <col width="25%" />
64
+ <tbody>
65
+ <tr class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
66
+ <th>
67
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
68
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
69
+ </th>
70
+ <th>
71
+ <xsl:call-template name="x:totals">
72
+ <xsl:with-param name="tests" select=".//x:test[parent::x:scenario]" />
73
+ <xsl:with-param name="labels" select="true()"/>
74
+ </xsl:call-template>
75
+ </th>
76
+ </tr>
77
+ <xsl:apply-templates select="x:test" mode="x:html-summary" />
78
+ <xsl:for-each select=".//x:scenario[x:test]">
79
+ <xsl:variable name="pending" as="xs:boolean"
80
+ select="exists(@pending)" />
81
+ <xsl:variable name="any-failure" as="xs:boolean"
82
+ select="exists(x:test[@successful = 'false'])" />
83
+ <xsl:variable name="label" as="node()+">
84
+ <xsl:for-each select="ancestor-or-self::x:scenario[position() != last()]">
85
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
86
+ <xsl:if test="position() != last()">
87
+ <xsl:copy-of select="x:separator-callback()"/>
88
+ </xsl:if>
89
+ </xsl:for-each>
90
+ </xsl:variable>
91
+ <tr class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
92
+ <th>
93
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
94
+ <xsl:choose>
95
+ <xsl:when test="$any-failure">
96
+ <a href="#{generate-id()}">
97
+ <xsl:sequence select="$label" />
98
+ </a>
99
+ </xsl:when>
100
+ <xsl:otherwise>
101
+ <xsl:sequence select="$label" />
102
+ </xsl:otherwise>
103
+ </xsl:choose>
104
+ </th>
105
+ <th>
106
+ <xsl:call-template name="x:totals">
107
+ <xsl:with-param name="tests" select="x:test" />
108
+ <xsl:with-param name="labels" select="true()"/>
109
+ </xsl:call-template>
110
+ </th>
111
+ </tr>
112
+ <xsl:apply-templates select="x:test" mode="x:html-summary" />
113
+ </xsl:for-each>
114
+ </tbody>
115
+ </table>
116
+ <xsl:apply-templates select="descendant-or-self::x:scenario[x:test[@successful = 'false']]" mode="x:html-report" />
117
+ </div>
118
+ </xsl:template>
119
+
120
+ <xsl:template match="/">
121
+ <xsl:message>
122
+ <xsl:call-template name="x:totals">
123
+ <xsl:with-param name="tests" select="//x:scenario/x:test" />
124
+ <xsl:with-param name="labels" select="true()" />
125
+ </xsl:call-template>
126
+ </xsl:message>
127
+ <html>
128
+ <head>
129
+ <title>
130
+ <xsl:text>Test Report for </xsl:text>
131
+ <xsl:value-of select="x:report/test:format-URI(@stylesheet|@query)"/>
132
+ <xsl:text> (</xsl:text>
133
+ <xsl:call-template name="x:totals">
134
+ <xsl:with-param name="tests" select="//x:scenario/x:test"/>
135
+ <xsl:with-param name="labels" select="true()"/>
136
+ </xsl:call-template>
137
+ <xsl:text>)</xsl:text>
138
+ </title>
139
+ <xsl:if test="$inline-css = 'false'">
140
+ <link rel="stylesheet" type="text/css" href="{ $report-css-uri }"/>
141
+ </xsl:if>
142
+ <xsl:if test="not($inline-css = 'false')">
143
+ <style type="text/css">
144
+ <xsl:value-of select="unparsed-text($report-css-uri)" disable-output-escaping="yes"/>
145
+ </style>
146
+ </xsl:if>
147
+ <xsl:call-template name="x:html-head-callback"/>
148
+ </head>
149
+ <body>
150
+ <h1>Test Report</h1>
151
+ <xsl:apply-templates select="*"/>
152
+ </body>
153
+ </html>
154
+ </xsl:template>
155
+
156
+ <xsl:template match="x:report">
157
+ <xsl:apply-templates select="." mode="x:html-report"/>
158
+ </xsl:template>
159
+
160
+ <xsl:template match="x:report" mode="x:html-report">
161
+ <p>
162
+ <xsl:value-of select="if ( exists(@query) ) then 'Query: ' else 'Stylesheet: '"/>
163
+ <a href="{ @stylesheet|@query }">
164
+ <xsl:value-of select="test:format-URI(@stylesheet|@query)"/>
165
+ </a>
166
+ </p>
167
+ <p>
168
+ <xsl:text>Tested: </xsl:text>
169
+ <xsl:value-of select="format-dateTime(@date, '[D] [MNn] [Y] at [H01]:[m01]')" />
170
+ </p>
171
+ <h2>Contents</h2>
172
+ <table class="xspec">
173
+ <col width="75%" />
174
+ <col width="6.25%" />
175
+ <col width="6.25%" />
176
+ <col width="6.25%" />
177
+ <col width="6.25%" />
178
+ <thead>
179
+ <tr>
180
+ <xsl:variable name="totals" select="x:totals(//x:scenario/x:test)"/>
181
+ <th/>
182
+ <th class="totals">passed:&#xa0;<xsl:value-of select="$totals[1]"/></th>
183
+ <th class="totals">pending:&#xa0;<xsl:value-of select="$totals[2]"/></th>
184
+ <th class="totals">failed:&#xa0;<xsl:value-of select="$totals[3]"/></th>
185
+ <th class="totals">total:&#xa0;<xsl:value-of select="$totals[4]"/></th>
186
+ </tr>
187
+ </thead>
188
+ <tbody>
189
+ <xsl:for-each select="x:scenario">
190
+ <xsl:variable name="pending" as="xs:boolean"
191
+ select="exists(@pending)" />
192
+ <xsl:variable name="any-failure" as="xs:boolean"
193
+ select="exists(.//x:test[parent::x:scenario][@successful = 'false'])" />
194
+ <tr class="{if ($pending) then 'pending' else if ($any-failure) then 'failed' else 'successful'}">
195
+ <th>
196
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
197
+ <a href="#{generate-id()}">
198
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
199
+ </a>
200
+ </th>
201
+ <xsl:variable name="totals" select="x:totals(.//x:test[parent::x:scenario])"/>
202
+ <th class="totals"><xsl:value-of select="$totals[1]"/></th>
203
+ <th class="totals"><xsl:value-of select="$totals[2]"/></th>
204
+ <th class="totals"><xsl:value-of select="$totals[3]"/></th>
205
+ <th class="totals"><xsl:value-of select="$totals[4]"/></th>
206
+ </tr>
207
+ </xsl:for-each>
208
+ </tbody>
209
+ </table>
210
+ <xsl:for-each select="x:scenario[not(@pending)]">
211
+ <xsl:call-template name="x:format-top-level-scenario"/>
212
+ </xsl:for-each>
213
+ </xsl:template>
214
+
215
+ <xsl:template match="x:test[exists(@pending)]" mode="x:html-summary">
216
+ <tr class="pending">
217
+ <td>
218
+ <xsl:copy-of select="x:pending-callback(@pending)"/>
219
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
220
+ </td>
221
+ <td>Pending</td>
222
+ </tr>
223
+ </xsl:template>
224
+
225
+ <xsl:template match="x:test[@successful = 'true']" mode="x:html-summary">
226
+ <tr class="successful">
227
+ <td><xsl:apply-templates select="x:label" mode="x:html-report" /></td>
228
+ <td>Success</td>
229
+ </tr>
230
+ </xsl:template>
231
+
232
+ <xsl:template match="x:test[@successful = 'false']" mode="x:html-summary">
233
+ <tr class="failed">
234
+ <td>
235
+ <a href="#{generate-id()}">
236
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
237
+ </a>
238
+ </td>
239
+ <td>Failure</td>
240
+ </tr>
241
+ </xsl:template>
242
+
243
+ <xsl:template match="x:scenario" mode="x:html-report">
244
+ <h3 id="{generate-id()}">
245
+ <xsl:for-each select="ancestor-or-self::x:scenario">
246
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
247
+ <xsl:if test="position() != last()">
248
+ <xsl:copy-of select="x:separator-callback()"/>
249
+ </xsl:if>
250
+ </xsl:for-each>
251
+ </h3>
252
+ <xsl:apply-templates select="x:test[@successful = 'false']" mode="x:html-report" />
253
+ </xsl:template>
254
+
255
+ <xsl:template match="x:test" mode="x:html-report">
256
+ <xsl:variable name="result" as="element(x:result)"
257
+ select="if (x:result) then x:result else ../x:result" />
258
+ <h4 id="{generate-id()}">
259
+ <xsl:apply-templates select="x:label" mode="x:html-report" />
260
+ </h4>
261
+ <table class="xspecResult">
262
+ <thead>
263
+ <tr>
264
+ <th>Result</th>
265
+ <th>
266
+ <xsl:choose>
267
+ <xsl:when test="x:result">Expecting</xsl:when>
268
+ <xsl:otherwise>Expected Result</xsl:otherwise>
269
+ </xsl:choose>
270
+ </th>
271
+ </tr>
272
+ </thead>
273
+ <tbody>
274
+ <tr>
275
+ <td>
276
+ <xsl:apply-templates select="$result" mode="x:value">
277
+ <xsl:with-param name="comparison" select="x:expect" />
278
+ </xsl:apply-templates>
279
+ </td>
280
+ <td>
281
+ <xsl:choose>
282
+ <xsl:when test="not(x:result) and x:expect/@test">
283
+ <pre>
284
+ <xsl:value-of select="@test" />
285
+ </pre>
286
+ </xsl:when>
287
+ <xsl:otherwise>
288
+ <xsl:apply-templates select="x:expect" mode="x:value">
289
+ <xsl:with-param name="comparison" select="$result" />
290
+ </xsl:apply-templates>
291
+ </xsl:otherwise>
292
+ </xsl:choose>
293
+ </td>
294
+ </tr>
295
+ </tbody>
296
+ </table>
297
+ </xsl:template>
298
+
299
+ <xsl:template match="*" mode="x:value">
300
+ <xsl:param name="comparison" as="element()?" select="()" />
301
+ <xsl:variable name="expected" as="xs:boolean" select=". instance of element(x:expect)" />
302
+ <xsl:choose>
303
+ <xsl:when test="@href or node()">
304
+ <xsl:if test="@select">
305
+ <p>XPath <code><xsl:value-of select="@select" /></code> from:</p>
306
+ </xsl:if>
307
+ <xsl:choose>
308
+ <xsl:when test="@href">
309
+ <p><a href="{@href}"><xsl:value-of select="test:format-URI(@href)" /></a></p>
310
+ </xsl:when>
311
+ <xsl:otherwise>
312
+ <xsl:variable name="indentation"
313
+ select="string-length(substring-after(text()[1], '&#xA;'))" />
314
+ <pre>
315
+ <xsl:choose>
316
+ <xsl:when test="exists($comparison)">
317
+ <xsl:variable name="compare" as="node()*"
318
+ select="if ($comparison/@href)
319
+ then document($comparison/@href)/node()
320
+ else $comparison/(node() except text()[not(normalize-space())])" />
321
+ <xsl:for-each select="node() except text()[not(normalize-space())]">
322
+ <xsl:variable name="pos" as="xs:integer" select="position()" />
323
+ <xsl:apply-templates select="." mode="test:serialize">
324
+ <xsl:with-param name="indentation" tunnel="yes" select="$indentation" />
325
+ <xsl:with-param name="perform-comparison" tunnel="yes" select="true()" />
326
+ <xsl:with-param name="comparison" select="$compare[position() = $pos]" />
327
+ <xsl:with-param name="expected" select="$expected" />
328
+ </xsl:apply-templates>
329
+ </xsl:for-each>
330
+ </xsl:when>
331
+ <xsl:otherwise>
332
+ <xsl:apply-templates select="node() except text()[not(normalize-space())]" mode="test:serialize">
333
+ <xsl:with-param name="indentation" tunnel="yes"
334
+ select="$indentation" />
335
+ </xsl:apply-templates>
336
+ </xsl:otherwise>
337
+ </xsl:choose>
338
+ </pre>
339
+ </xsl:otherwise>
340
+ </xsl:choose>
341
+ </xsl:when>
342
+ <xsl:otherwise>
343
+ <pre><xsl:value-of select="@select" /></pre>
344
+ </xsl:otherwise>
345
+ </xsl:choose>
346
+ </xsl:template>
347
+
348
+ <xsl:template name="x:totals">
349
+ <xsl:param name="tests" as="element(x:test)*" required="yes" />
350
+ <xsl:param name="labels" as="xs:boolean" select="false()" />
351
+ <xsl:if test="$tests">
352
+ <xsl:variable name="counts" select="x:totals($tests)"/>
353
+ <xsl:if test="$labels">passed: </xsl:if>
354
+ <xsl:value-of select="$counts[1]"/>
355
+ <xsl:if test="$labels"><xsl:text> </xsl:text></xsl:if>
356
+ <xsl:text>/</xsl:text>
357
+ <xsl:if test="$labels"> pending: </xsl:if>
358
+ <xsl:value-of select="$counts[2]"/>
359
+ <xsl:if test="$labels"><xsl:text> </xsl:text></xsl:if>
360
+ <xsl:text>/</xsl:text>
361
+ <xsl:if test="$labels"> failed: </xsl:if>
362
+ <xsl:value-of select="$counts[3]"/>
363
+ <xsl:if test="$labels"><xsl:text> </xsl:text></xsl:if>
364
+ <xsl:text>/</xsl:text>
365
+ <xsl:if test="$labels"> total: </xsl:if>
366
+ <xsl:value-of select="$counts[4]"/>
367
+ </xsl:if>
368
+ </xsl:template>
369
+
370
+ <xsl:function name="x:totals" as="xs:integer+">
371
+ <xsl:param name="tests" as="element(x:test)*"/>
372
+ <xsl:variable name="passed" as="element(x:test)*" select="$tests[@successful = 'true']" />
373
+ <xsl:variable name="pending" as="element(x:test)*" select="$tests[exists(@pending)]" />
374
+ <xsl:variable name="failed" as="element(x:test)*" select="$tests[@successful = 'false']" />
375
+ <xsl:sequence select="count($passed)"/>
376
+ <xsl:sequence select="count($pending)"/>
377
+ <xsl:sequence select="count($failed)"/>
378
+ <xsl:sequence select="count($tests)"/>
379
+ </xsl:function>
380
+
381
+ </xsl:stylesheet>
382
+
383
+
384
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
385
+ <!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
386
+ <!-- -->
387
+ <!-- Copyright (c) 2008, 2010 Jeni Tennsion -->
388
+ <!-- -->
389
+ <!-- The contents of this file are subject to the MIT License (see the URI -->
390
+ <!-- http://www.opensource.org/licenses/mit-license.php for details). -->
391
+ <!-- -->
392
+ <!-- Permission is hereby granted, free of charge, to any person obtaining -->
393
+ <!-- a copy of this software and associated documentation files (the -->
394
+ <!-- "Software"), to deal in the Software without restriction, including -->
395
+ <!-- without limitation the rights to use, copy, modify, merge, publish, -->
396
+ <!-- distribute, sublicense, and/or sell copies of the Software, and to -->
397
+ <!-- permit persons to whom the Software is furnished to do so, subject to -->
398
+ <!-- the following conditions: -->
399
+ <!-- -->
400
+ <!-- The above copyright notice and this permission notice shall be -->
401
+ <!-- included in all copies or substantial portions of the Software. -->
402
+ <!-- -->
403
+ <!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
404
+ <!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
405
+ <!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
406
+ <!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
407
+ <!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
408
+ <!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
409
+ <!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
410
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
@@ -0,0 +1,93 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- =====================================================================
3
+
4
+ Usage: java -cp "$CP" net.sf.saxon.Transform
5
+ -o:"$JUNIT_RESULT" \
6
+ -s:"$RESULT" \
7
+ -xsl:"$XSPEC_HOME/src/reporter/junit-report.xsl"
8
+ Description: XSLT to convert XSpec XML report to JUnit report
9
+ Executed from bin/xspec.sh
10
+ Input: XSpec XML report
11
+ Output: JUnit report
12
+ Dependencies: It requires XSLT 3.0 for function fn:serialize()
13
+ Authors: Kal Ahmed, github.com/kal
14
+ Sandro Cirulli, github.com/cirulls
15
+ License: MIT License (https://opensource.org/licenses/MIT)
16
+
17
+ ======================================================================== -->
18
+ <xsl:stylesheet version="3.0"
19
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
21
+ xmlns:x="http://www.jenitennison.com/xslt/xspec"
22
+ xmlns:test="http://www.jenitennison.com/xslt/unit-test"
23
+ xmlns:pkg="http://expath.org/ns/pkg"
24
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
25
+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
26
+ exclude-result-prefixes="x xs test pkg xhtml fn">
27
+
28
+ <xsl:output name="escaped" method="xml" omit-xml-declaration="yes" indent="yes"/>
29
+
30
+ <xsl:template match="x:report">
31
+ <testsuites>
32
+ <xsl:apply-templates select="x:scenario"/>
33
+ </testsuites>
34
+ </xsl:template>
35
+
36
+ <xsl:template match="x:scenario">
37
+ <testsuite>
38
+ <xsl:attribute name="name" select="x:label"/>
39
+ <xsl:attribute name="tests" select="count(.//x:test)"/>
40
+ <xsl:attribute name="failures" select="count(.//x:test[@successful='false'])"/>
41
+ <xsl:apply-templates select="x:test"/>
42
+ <xsl:apply-templates select="x:scenario" mode="nested"/>
43
+ </testsuite>
44
+ </xsl:template>
45
+
46
+ <xsl:template match="x:scenario" mode="nested">
47
+ <xsl:param name="prefix" select="''"/>
48
+ <xsl:variable name="prefixed-label" select="concat($prefix, x:label, ' ')"/>
49
+ <xsl:apply-templates select="x:test">
50
+ <xsl:with-param name="prefix" select="$prefixed-label"/>
51
+ </xsl:apply-templates>
52
+ <xsl:apply-templates select="x:scenario" mode="nested">
53
+ <xsl:with-param name="prefix" select="$prefixed-label"/>
54
+ </xsl:apply-templates>
55
+ </xsl:template>
56
+
57
+ <xsl:template match="x:test">
58
+ <xsl:param name="prefix"/>
59
+ <testcase>
60
+ <xsl:attribute name="name" select="concat($prefix, x:label)"/>
61
+ <xsl:attribute name="status">
62
+ <xsl:choose>
63
+ <xsl:when test="@pending">skipped</xsl:when>
64
+ <xsl:when test="@successful='true'">passed</xsl:when>
65
+ <xsl:otherwise>failed</xsl:otherwise>
66
+ </xsl:choose>
67
+ </xsl:attribute>
68
+ <xsl:choose>
69
+ <xsl:when test="@pending"><skipped><xsl:value-of select="@pending"/></skipped></xsl:when>
70
+ <xsl:when test="@successful='false'">
71
+ <failure message="expect assertion failed">
72
+ <xsl:apply-templates select="x:expect"/>
73
+ </failure>
74
+ </xsl:when>
75
+ </xsl:choose>
76
+ </testcase>
77
+ </xsl:template>
78
+
79
+ <xsl:template match="x:expect[@select]">
80
+ <xsl:text>Expected: </xsl:text><xsl:value-of select="x:expect/@select"/>
81
+ </xsl:template>
82
+
83
+ <xsl:template match="x:expect">
84
+ <xsl:variable as="element(output:serialization-parameters)" name="serialization-parameters"
85
+ xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
86
+ <output:serialization-parameters>
87
+ <output:omit-xml-declaration value="yes"/>
88
+ </output:serialization-parameters>
89
+ </xsl:variable>
90
+ <xsl:value-of select="fn:serialize(., $serialization-parameters)"></xsl:value-of>
91
+ </xsl:template>
92
+
93
+ </xsl:stylesheet>