leptris 1.9.201.0-arm-linux → 1.9.201.2-arm-linux

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 (1535) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/Rakefile +52 -12
  4. data/ext/leptris/native/extconf.rb +85 -0
  5. data/ext/leptris/native/native.c +1 -1
  6. data/lib/leptris/version.rb +1 -1
  7. data/lib/leptris/xml/ffi.rb +13 -0
  8. data/lib/leptris/xml/native.so +0 -0
  9. data/vendor-src/libleptris/CHANGELOG.md +8080 -0
  10. data/vendor-src/libleptris/CLAUDE.md +150 -0
  11. data/vendor-src/libleptris/CMakeLists.txt +379 -0
  12. data/vendor-src/libleptris/CMakePresets.json +61 -0
  13. data/vendor-src/libleptris/CODE_OF_CONDUCT.md +132 -0
  14. data/vendor-src/libleptris/CONTEXT.md +49 -0
  15. data/vendor-src/libleptris/LICENSE.md +33 -0
  16. data/vendor-src/libleptris/README.adoc +1197 -0
  17. data/vendor-src/libleptris/TODO.assemble/README.md +16 -0
  18. data/vendor-src/libleptris/TODO.bindings/01-mutation-construction.md +18 -0
  19. data/vendor-src/libleptris/TODO.bindings/02-incremental-iterparse.md +15 -0
  20. data/vendor-src/libleptris/TODO.bindings/03-compiled-xpath.md +15 -0
  21. data/vendor-src/libleptris/TODO.bindings/04-pull-stax-api.md +14 -0
  22. data/vendor-src/libleptris/TODO.bindings/05-per-parse-options.md +17 -0
  23. data/vendor-src/libleptris/TODO.bindings/06-serialize-encoding-guarantees.md +14 -0
  24. data/vendor-src/libleptris/TODO.bindings/README.md +36 -0
  25. data/vendor-src/libleptris/TODO.concurrency/01-thread-safe-errors.md +19 -0
  26. data/vendor-src/libleptris/TODO.concurrency/02-export-surface-gate.md +24 -0
  27. data/vendor-src/libleptris/TODO.concurrency/03-mixed-nodeset-batch.md +14 -0
  28. data/vendor-src/libleptris/TODO.concurrency/04-canonical-status-message.md +13 -0
  29. data/vendor-src/libleptris/TODO.concurrency/05-windows-dll-name.md +10 -0
  30. data/vendor-src/libleptris/TODO.concurrency/06-exslt-pack.md +26 -0
  31. data/vendor-src/libleptris/TODO.concurrency/07-ns-set-pairs.md +11 -0
  32. data/vendor-src/libleptris/TODO.concurrency/08-threading-contract.md +45 -0
  33. data/vendor-src/libleptris/TODO.engine/01-file-sources.md +11 -0
  34. data/vendor-src/libleptris/TODO.engine/02-compiled-contexts.md +10 -0
  35. data/vendor-src/libleptris/TODO.engine/03-rust-publish.md +9 -0
  36. data/vendor-src/libleptris/TODO.engine/04-ruby-release-input.md +8 -0
  37. data/vendor-src/libleptris/TODO.engine/05-todo-md-refresh.md +7 -0
  38. data/vendor-src/libleptris/TODO.engine/README.md +16 -0
  39. data/vendor-src/libleptris/TODO.hygiene/README.md +15 -0
  40. data/vendor-src/libleptris/TODO.max-perf/00-INDEX.md +22 -0
  41. data/vendor-src/libleptris/TODO.max-perf/1-simd-html-scanner.md +15 -0
  42. data/vendor-src/libleptris/TODO.max-perf/10-moxml-plan-followups.md +9 -0
  43. data/vendor-src/libleptris/TODO.max-perf/2-compiled-dispatch-tokenizer.md +8 -0
  44. data/vendor-src/libleptris/TODO.max-perf/3-iterparse-fixed-cost.md +5 -0
  45. data/vendor-src/libleptris/TODO.max-perf/4-compact-node-micro-opts.md +17 -0
  46. data/vendor-src/libleptris/TODO.max-perf/5-xslt-bench-profiling-rounds.md +13 -0
  47. data/vendor-src/libleptris/TODO.max-perf/6-language-tails.md +9 -0
  48. data/vendor-src/libleptris/TODO.max-perf/7-validate-bindings.md +6 -0
  49. data/vendor-src/libleptris/TODO.max-perf/8-native-xml-diff-consumer.md +5 -0
  50. data/vendor-src/libleptris/TODO.max-perf/9-prebuilt-gem-matrix.md +14 -0
  51. data/vendor-src/libleptris/TODO.md +33 -0
  52. data/vendor-src/libleptris/TODO.transform/README.md +39 -0
  53. data/vendor-src/libleptris/TODO.validate/README.md +32 -0
  54. data/vendor-src/libleptris/TODO.xpath2/README.md +91 -0
  55. data/vendor-src/libleptris/TODO.xslt-full/01-xpath-fn-sequences.md +27 -0
  56. data/vendor-src/libleptris/TODO.xslt-full/02-xpath-fn-regex.md +13 -0
  57. data/vendor-src/libleptris/TODO.xslt-full/03-xpath-fn-math.md +10 -0
  58. data/vendor-src/libleptris/TODO.xslt-full/04-xpath-fn-strings-qname-uri.md +97 -0
  59. data/vendor-src/libleptris/TODO.xslt-full/05-xpath-fn-dates.md +30 -0
  60. data/vendor-src/libleptris/TODO.xslt-full/06-xpath-grammar-3x.md +83 -0
  61. data/vendor-src/libleptris/TODO.xslt-full/07-xpath-function-items.md +124 -0
  62. data/vendor-src/libleptris/TODO.xslt-full/08-xpath-maps-arrays.md +79 -0
  63. data/vendor-src/libleptris/TODO.xslt-full/09-xslt-noop-fillins.md +35 -0
  64. data/vendor-src/libleptris/TODO.xslt-full/10-xslt-tunnel-params.md +9 -0
  65. data/vendor-src/libleptris/TODO.xslt-full/11-xquery-core.md +119 -0
  66. data/vendor-src/libleptris/TODO.xslt-full/12-xquery-31.md +65 -0
  67. data/vendor-src/libleptris/TODO.xslt-full/13-perf-inprocess.md +425 -0
  68. data/vendor-src/libleptris/TODO.xslt-full/14-html-mode.md +803 -0
  69. data/vendor-src/libleptris/TODO.xslt-full/15-binding-entries.md +19 -0
  70. data/vendor-src/libleptris/TODO.xslt-full/16-schematron.md +156 -0
  71. data/vendor-src/libleptris/TODO.xslt-full/17-xml-diff.md +52 -0
  72. data/vendor-src/libleptris/TODO.xslt-full/18-compact-nodes.md +278 -0
  73. data/vendor-src/libleptris/TODO.xslt-full/README.md +26 -0
  74. data/vendor-src/libleptris/TODO.xslt-full/REMAINING.md +163 -0
  75. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/00-triage.md +171 -0
  76. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/01-fragment-nodes.md +19 -0
  77. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/02-root-node-semantics.md +34 -0
  78. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/03-crashes.md +15 -0
  79. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/04-namespaces.md +14 -0
  80. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/05-number-attrset-sort.md +13 -0
  81. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/06-document-chains.md +10 -0
  82. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/07-charef-serializer.md +9 -0
  83. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/08-perf-gate.md +8 -0
  84. data/vendor-src/libleptris/TODO.xslt-full/legacy-v19/09-release.md +14 -0
  85. data/vendor-src/libleptris/VALIDATION.md +151 -0
  86. data/vendor-src/libleptris/benchmarks/CMakeLists.txt +259 -0
  87. data/vendor-src/libleptris/benchmarks/README.adoc +228 -0
  88. data/vendor-src/libleptris/benchmarks/README.md +212 -0
  89. data/vendor-src/libleptris/benchmarks/common/benchmark.c +252 -0
  90. data/vendor-src/libleptris/benchmarks/common/benchmark.h +77 -0
  91. data/vendor-src/libleptris/benchmarks/common/test_data.c +415 -0
  92. data/vendor-src/libleptris/benchmarks/common/test_data.h +18 -0
  93. data/vendor-src/libleptris/benchmarks/comprehensive/CMakeLists.txt +184 -0
  94. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_decomp.cpp +110 -0
  95. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_first_access.cpp +261 -0
  96. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_many_attrs.cpp +150 -0
  97. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_memory.cpp +185 -0
  98. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_parse.cpp +270 -0
  99. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_parse_ops.cpp +392 -0
  100. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_sax.c +106 -0
  101. data/vendor-src/libleptris/benchmarks/comprehensive/benchmark_write.cpp +351 -0
  102. data/vendor-src/libleptris/benchmarks/data/attrs.xml +303 -0
  103. data/vendor-src/libleptris/benchmarks/data/cdata_test.xml +13 -0
  104. data/vendor-src/libleptris/benchmarks/data/comment_test.xml +15 -0
  105. data/vendor-src/libleptris/benchmarks/data/deep.xml +205 -0
  106. data/vendor-src/libleptris/benchmarks/data/generate_attrs.rb +22 -0
  107. data/vendor-src/libleptris/benchmarks/data/generate_deep.rb +25 -0
  108. data/vendor-src/libleptris/benchmarks/data/generate_large.rb +33 -0
  109. data/vendor-src/libleptris/benchmarks/data/generate_wide.rb +18 -0
  110. data/vendor-src/libleptris/benchmarks/data/large.xml +21003 -0
  111. data/vendor-src/libleptris/benchmarks/data/large_workflow.xml +4003 -0
  112. data/vendor-src/libleptris/benchmarks/data/medium.xml +67 -0
  113. data/vendor-src/libleptris/benchmarks/data/medium_workflow.xml +353 -0
  114. data/vendor-src/libleptris/benchmarks/data/pi_test.xml +9 -0
  115. data/vendor-src/libleptris/benchmarks/data/small.xml +10 -0
  116. data/vendor-src/libleptris/benchmarks/data/small_workflow.xml +36 -0
  117. data/vendor-src/libleptris/benchmarks/data/wide.xml +5003 -0
  118. data/vendor-src/libleptris/benchmarks/dom/bench_document_lifecycle.c +69 -0
  119. data/vendor-src/libleptris/benchmarks/dom/bench_leptris.c +184 -0
  120. data/vendor-src/libleptris/benchmarks/dom/bench_libxml2.c +176 -0
  121. data/vendor-src/libleptris/benchmarks/dom/bench_text_borrowed.c +74 -0
  122. data/vendor-src/libleptris/benchmarks/dom/dom_benchmark_v2.cpp +314 -0
  123. data/vendor-src/libleptris/benchmarks/fixtures/large.xml +4003 -0
  124. data/vendor-src/libleptris/benchmarks/fixtures/large_catalog.xml +50003 -0
  125. data/vendor-src/libleptris/benchmarks/fixtures/libxml2/eve.xml +6 -0
  126. data/vendor-src/libleptris/benchmarks/fixtures/libxml2/slashdot.rdf +66 -0
  127. data/vendor-src/libleptris/benchmarks/fixtures/libxml2/wap.xml +27 -0
  128. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/4rects.xml +11 -0
  129. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/a-valid.xml +10 -0
  130. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/a-wf.xml +9 -0
  131. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/bike.xml +41 -0
  132. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/circle.xml +11 -0
  133. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/defs.xml +14 -0
  134. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/desc.xml +14 -0
  135. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/ellipse.xml +10 -0
  136. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/flower2.xml +44 -0
  137. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/gradient.xml +16 -0
  138. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/group01.xml +15 -0
  139. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/group02.xml +13 -0
  140. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/group03.xml +13 -0
  141. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/image-valid.xml +11 -0
  142. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/image-wf.xml +11 -0
  143. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/lin-gradient.xml +16 -0
  144. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/marker.xml +28 -0
  145. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/mask.xml +13 -0
  146. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/mathswitch.xml +32 -0
  147. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/parentns.xml +12 -0
  148. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/path01.xml +5 -0
  149. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/path02.xml +10 -0
  150. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/patternfill.xml +12 -0
  151. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/polyline.xml +9 -0
  152. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/private.xml +19 -0
  153. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/rad-gradient.xml +17 -0
  154. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/rectangle.xml +10 -0
  155. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/richdesc.xml +12 -0
  156. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/script.xml +13 -0
  157. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/structure01.xml +10 -0
  158. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/style.xml +11 -0
  159. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/switch.xml +21 -0
  160. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/symbol-use.xml +28 -0
  161. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/template.xml +9 -0
  162. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/text01.xml +12 -0
  163. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/text02.xml +17 -0
  164. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/text03.xml +8 -0
  165. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/toap01.xml +10 -0
  166. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/toap02.xml +33 -0
  167. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/transform.xml +26 -0
  168. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/trivial.xml +6 -0
  169. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/twin-gradients.xml +19 -0
  170. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/v-template.xml +9 -0
  171. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/viewport-nest.xml +13 -0
  172. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/viewport-transform.xml +46 -0
  173. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/viewport.xml +11 -0
  174. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_svg/wf-template.xml +7 -0
  175. data/vendor-src/libleptris/benchmarks/fixtures/libxml2_xsdtest.xml +5286 -0
  176. data/vendor-src/libleptris/benchmarks/fixtures/medium.xml +403 -0
  177. data/vendor-src/libleptris/benchmarks/fixtures/medium_catalog.xml +3003 -0
  178. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/empty.xml +0 -0
  179. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/large.xml +1 -0
  180. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/latintest_latin1.xml +1 -0
  181. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/latintest_utf8.xml +1 -0
  182. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/multiline.xml +3 -0
  183. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/small.xml +1 -0
  184. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/truncation.xml +19 -0
  185. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_be.xml +0 -0
  186. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_be_bom.xml +0 -0
  187. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_be_clean.xml +0 -0
  188. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_be_nodecl.xml +0 -0
  189. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_le.xml +0 -0
  190. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_le_bom.xml +0 -0
  191. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_le_clean.xml +0 -0
  192. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf16_le_nodecl.xml +0 -0
  193. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_be.xml +0 -0
  194. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_be_bom.xml +0 -0
  195. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_be_clean.xml +0 -0
  196. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_be_nodecl.xml +0 -0
  197. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_le.xml +0 -0
  198. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_le_bom.xml +0 -0
  199. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_le_clean.xml +0 -0
  200. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf32_le_nodecl.xml +0 -0
  201. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf8.xml +87 -0
  202. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf8_bom.xml +87 -0
  203. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf8_clean.xml +84 -0
  204. data/vendor-src/libleptris/benchmarks/fixtures/pugixml/utftest_utf8_nodecl.xml +86 -0
  205. data/vendor-src/libleptris/benchmarks/fixtures/pugixml//321/202/320/265/321/201/321/202.xml +1 -0
  206. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/empty.xml +0 -0
  207. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/large.xml +1 -0
  208. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/latintest_latin1.xml +1 -0
  209. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/latintest_utf8.xml +1 -0
  210. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/multiline.xml +3 -0
  211. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/small.xml +1 -0
  212. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/truncation.xml +19 -0
  213. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_be.xml +0 -0
  214. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_be_bom.xml +0 -0
  215. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_be_clean.xml +0 -0
  216. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_be_nodecl.xml +0 -0
  217. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_le.xml +0 -0
  218. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_le_bom.xml +0 -0
  219. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_le_clean.xml +0 -0
  220. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf16_le_nodecl.xml +0 -0
  221. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_be.xml +0 -0
  222. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_be_bom.xml +0 -0
  223. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_be_clean.xml +0 -0
  224. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_be_nodecl.xml +0 -0
  225. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_le.xml +0 -0
  226. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_le_bom.xml +0 -0
  227. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_le_clean.xml +0 -0
  228. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf32_le_nodecl.xml +0 -0
  229. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf8.xml +87 -0
  230. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf8_bom.xml +87 -0
  231. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf8_clean.xml +84 -0
  232. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests/utftest_utf8_nodecl.xml +86 -0
  233. data/vendor-src/libleptris/benchmarks/fixtures/pugixml_tests//321/202/320/265/321/201/321/202.xml +1 -0
  234. data/vendor-src/libleptris/benchmarks/fixtures/small.xml +38 -0
  235. data/vendor-src/libleptris/benchmarks/html/bench_html_parse.c +111 -0
  236. data/vendor-src/libleptris/benchmarks/html/gen_nokogiri_reference.rb +112 -0
  237. data/vendor-src/libleptris/benchmarks/html/nokogiri_html_parse.rb +64 -0
  238. data/vendor-src/libleptris/benchmarks/matrix/README.md +71 -0
  239. data/vendor-src/libleptris/benchmarks/matrix/bench2html.rb +316 -0
  240. data/vendor-src/libleptris/benchmarks/matrix/bench_matrix.cpp +724 -0
  241. data/vendor-src/libleptris/benchmarks/modification/bench_leptris_modify.c +211 -0
  242. data/vendor-src/libleptris/benchmarks/modification/bench_node_creation.c +130 -0
  243. data/vendor-src/libleptris/benchmarks/results/BENCHMARK_REPORT.md +226 -0
  244. data/vendor-src/libleptris/benchmarks/results/baseline_report.md +219 -0
  245. data/vendor-src/libleptris/benchmarks/results/benchmark_20251223_134550.json +13 -0
  246. data/vendor-src/libleptris/benchmarks/results/benchmark_20260129_225844.json +13 -0
  247. data/vendor-src/libleptris/benchmarks/results/leptris_dom_output.txt +24 -0
  248. data/vendor-src/libleptris/benchmarks/results/leptris_modify.json +36 -0
  249. data/vendor-src/libleptris/benchmarks/results/leptris_modify_optimized.json +36 -0
  250. data/vendor-src/libleptris/benchmarks/results/leptris_modify_session1.json +36 -0
  251. data/vendor-src/libleptris/benchmarks/results/leptris_modify_session2.json +36 -0
  252. data/vendor-src/libleptris/benchmarks/results/leptris_serialize.json +34 -0
  253. data/vendor-src/libleptris/benchmarks/results/leptris_xpath_output.txt +24 -0
  254. data/vendor-src/libleptris/benchmarks/results/libxml2_dom_output.txt +24 -0
  255. data/vendor-src/libleptris/benchmarks/results/libxml2_xpath_output.txt +24 -0
  256. data/vendor-src/libleptris/benchmarks/results/phase16_session2.json +21 -0
  257. data/vendor-src/libleptris/benchmarks/results/phase17.5_session1.json +30 -0
  258. data/vendor-src/libleptris/benchmarks/results/phase17_session1.json +30 -0
  259. data/vendor-src/libleptris/benchmarks/results/pugixml_dom_output.txt +51 -0
  260. data/vendor-src/libleptris/benchmarks/results/xpath_axes_leptris.json +318 -0
  261. data/vendor-src/libleptris/benchmarks/results/xpath_axes_libxml2.json +318 -0
  262. data/vendor-src/libleptris/benchmarks/results/xpath_functions_leptris.json +222 -0
  263. data/vendor-src/libleptris/benchmarks/results/xpath_functions_libxml2.json +222 -0
  264. data/vendor-src/libleptris/benchmarks/sax/bench_iterparse.c +115 -0
  265. data/vendor-src/libleptris/benchmarks/sax/bench_leptris.c +124 -0
  266. data/vendor-src/libleptris/benchmarks/sax/bench_libxml2.c +115 -0
  267. data/vendor-src/libleptris/benchmarks/serialization/bench_leptris_serialize.c +198 -0
  268. data/vendor-src/libleptris/benchmarks/src/benchmark_base.h +175 -0
  269. data/vendor-src/libleptris/benchmarks/twins/mutation_leptris.c +37 -0
  270. data/vendor-src/libleptris/benchmarks/twins/mutation_pugixml.cpp +28 -0
  271. data/vendor-src/libleptris/benchmarks/twins/parse_leptris.c +35 -0
  272. data/vendor-src/libleptris/benchmarks/twins/parse_pugixml.cpp +35 -0
  273. data/vendor-src/libleptris/benchmarks/utils.c +171 -0
  274. data/vendor-src/libleptris/benchmarks/utils.h +70 -0
  275. data/vendor-src/libleptris/benchmarks/workflows/bench_dom_modify.c +325 -0
  276. data/vendor-src/libleptris/benchmarks/workflows/bench_end_to_end.c +529 -0
  277. data/vendor-src/libleptris/benchmarks/xpath/bench_axes.c +411 -0
  278. data/vendor-src/libleptris/benchmarks/xpath/bench_axes_libxml2.c +108 -0
  279. data/vendor-src/libleptris/benchmarks/xpath/bench_diagnostic.c +431 -0
  280. data/vendor-src/libleptris/benchmarks/xpath/bench_functions.c +271 -0
  281. data/vendor-src/libleptris/benchmarks/xpath/bench_functions_libxml2.c +123 -0
  282. data/vendor-src/libleptris/benchmarks/xpath/bench_leptris.c +78 -0
  283. data/vendor-src/libleptris/benchmarks/xpath/bench_libxml2.c +98 -0
  284. data/vendor-src/libleptris/benchmarks/xpath/bench_pugixml.cpp +117 -0
  285. data/vendor-src/libleptris/benchmarks/xpath/bench_scalar_eval.c +86 -0
  286. data/vendor-src/libleptris/benchmarks/xpath/bench_scalar_eval_libxml2.c +70 -0
  287. data/vendor-src/libleptris/benchmarks/xpath/bench_xslt_transform.c +48 -0
  288. data/vendor-src/libleptris/benchmarks/xslt/bench_dispatch.c +52 -0
  289. data/vendor-src/libleptris/benchmarks/xslt/bench_dispatch_heavy.c +82 -0
  290. data/vendor-src/libleptris/benchmarks/xslt/bench_dispatch_pred.c +34 -0
  291. data/vendor-src/libleptris/benchmarks/xslt/bench_subtree_copy.c +55 -0
  292. data/vendor-src/libleptris/benchmarks/xslt/bench_valueof.c +46 -0
  293. data/vendor-src/libleptris/benchmarks/xslt/heavy_lxml.py +48 -0
  294. data/vendor-src/libleptris/benchmarks/xslt/scorecard_lxml.py +169 -0
  295. data/vendor-src/libleptris/bindings/ruby/leptris.gemspec +22 -0
  296. data/vendor-src/libleptris/bindings/ruby/lib/leptris/document.rb +60 -0
  297. data/vendor-src/libleptris/bindings/ruby/lib/leptris/element.rb +86 -0
  298. data/vendor-src/libleptris/bindings/ruby/lib/leptris/error.rb +6 -0
  299. data/vendor-src/libleptris/bindings/ruby/lib/leptris/node.rb +73 -0
  300. data/vendor-src/libleptris/bindings/ruby/lib/leptris/sax.rb +189 -0
  301. data/vendor-src/libleptris/bindings/ruby/lib/leptris/xpath.rb +44 -0
  302. data/vendor-src/libleptris/bindings/ruby/lib/leptris.rb +137 -0
  303. data/vendor-src/libleptris/bindings/ruby/spec/leptris_spec.rb +113 -0
  304. data/vendor-src/libleptris/bindings/ruby/spec/sax_spec.rb +141 -0
  305. data/vendor-src/libleptris/bindings/ruby/spec/spec_helper.rb +7 -0
  306. data/vendor-src/libleptris/bindings/ruby/test_full.rb +21 -0
  307. data/vendor-src/libleptris/bindings/rust/Cargo.lock +7 -0
  308. data/vendor-src/libleptris/bindings/rust/Cargo.toml +13 -0
  309. data/vendor-src/libleptris/bindings/rust/README.md +61 -0
  310. data/vendor-src/libleptris/bindings/rust/build.rs +74 -0
  311. data/vendor-src/libleptris/bindings/rust/src/ffi.rs +204 -0
  312. data/vendor-src/libleptris/bindings/rust/src/lib.rs +580 -0
  313. data/vendor-src/libleptris/bindings/rust/tests/integration.rs +156 -0
  314. data/vendor-src/libleptris/cli/ARCHITECTURE_REVIEW.md +514 -0
  315. data/vendor-src/libleptris/cli/CLI_ARCHITECTURE.md +851 -0
  316. data/vendor-src/libleptris/cli/CMakeLists.txt +46 -0
  317. data/vendor-src/libleptris/cli/cli.c +115 -0
  318. data/vendor-src/libleptris/cli/cli.h +232 -0
  319. data/vendor-src/libleptris/cli/commands/diff.c +208 -0
  320. data/vendor-src/libleptris/cli/commands/format.c +379 -0
  321. data/vendor-src/libleptris/cli/commands/parse.c +343 -0
  322. data/vendor-src/libleptris/cli/commands/validate.c +284 -0
  323. data/vendor-src/libleptris/cli/commands/version.c +49 -0
  324. data/vendor-src/libleptris/cli/commands/xpath.c +428 -0
  325. data/vendor-src/libleptris/cli/commands/xquery.c +188 -0
  326. data/vendor-src/libleptris/cli/completion/leptris.bash +86 -0
  327. data/vendor-src/libleptris/cli/completion/leptris.zsh +74 -0
  328. data/vendor-src/libleptris/cli/error.c +394 -0
  329. data/vendor-src/libleptris/cli/error.h +360 -0
  330. data/vendor-src/libleptris/cli/leptris +0 -0
  331. data/vendor-src/libleptris/cli/main.c +127 -0
  332. data/vendor-src/libleptris/cli/man/leptris-format.1.adoc +226 -0
  333. data/vendor-src/libleptris/cli/man/leptris-parse.1.adoc +213 -0
  334. data/vendor-src/libleptris/cli/man/leptris-xpath.1.adoc +479 -0
  335. data/vendor-src/libleptris/cli/man/leptris.1.adoc +192 -0
  336. data/vendor-src/libleptris/cli/options.c +451 -0
  337. data/vendor-src/libleptris/cli/options.h +378 -0
  338. data/vendor-src/libleptris/cli/output.c +841 -0
  339. data/vendor-src/libleptris/cli/output.h +361 -0
  340. data/vendor-src/libleptris/cmake/FindUtf8proc.cmake +56 -0
  341. data/vendor-src/libleptris/cmake/leptris-config.cmake.in +14 -0
  342. data/vendor-src/libleptris/cmake/leptris.pc.in +11 -0
  343. data/vendor-src/libleptris/cmake/modules/AdocMan.cmake +132 -0
  344. data/vendor-src/libleptris/docs/ARCHITECTURE_REVIEW.md +280 -0
  345. data/vendor-src/libleptris/docs/Doxyfile +47 -0
  346. data/vendor-src/libleptris/docs/FFI.md +165 -0
  347. data/vendor-src/libleptris/docs/README.md +47 -0
  348. data/vendor-src/libleptris/docs/ROADMAP-SAXON-PARITY.md +194 -0
  349. data/vendor-src/libleptris/docs/guide/building.md +199 -0
  350. data/vendor-src/libleptris/docs/guide/getting-started.md +134 -0
  351. data/vendor-src/libleptris/docs/guide/parsing.md +315 -0
  352. data/vendor-src/libleptris/docs/guide/xpath-queries.md +444 -0
  353. data/vendor-src/libleptris/examples/c/CMakeLists.txt +58 -0
  354. data/vendor-src/libleptris/examples/c/README.md +345 -0
  355. data/vendor-src/libleptris/examples/c/basic_example.c +80 -0
  356. data/vendor-src/libleptris/examples/c/dom_traversal_example.c +58 -0
  357. data/vendor-src/libleptris/examples/c/error_handling_example.c +121 -0
  358. data/vendor-src/libleptris/examples/c/namespace_example.c +49 -0
  359. data/vendor-src/libleptris/examples/c/xpath_example.c +74 -0
  360. data/vendor-src/libleptris/ports/leptris/portfile.cmake +41 -0
  361. data/vendor-src/libleptris/ports/leptris/usage +28 -0
  362. data/vendor-src/libleptris/scripts/check_dll_exports.py +54 -0
  363. data/vendor-src/libleptris/scripts/check_export_surface.py +84 -0
  364. data/vendor-src/libleptris/scripts/check_ffi_mirrors.py +163 -0
  365. data/vendor-src/libleptris/scripts/check_formatting.sh +30 -0
  366. data/vendor-src/libleptris/scripts/check_shared_exports.sh +120 -0
  367. data/vendor-src/libleptris/scripts/check_trailing_whitespace.sh +18 -0
  368. data/vendor-src/libleptris/scripts/gen-api-docs.sh +31 -0
  369. data/vendor-src/libleptris/scripts/run_static_analysis.sh +16 -0
  370. data/vendor-src/libleptris/scripts/validate.sh +199 -0
  371. data/vendor-src/libleptris/scripts/xslt_triage.sh +72 -0
  372. data/vendor-src/libleptris/src/CMakeLists.txt +597 -0
  373. data/vendor-src/libleptris/src/include/leptris/descriptor.h +178 -0
  374. data/vendor-src/libleptris/src/include/leptris/dom/document.h +213 -0
  375. data/vendor-src/libleptris/src/include/leptris/dom/element.h +435 -0
  376. data/vendor-src/libleptris/src/include/leptris/dom/serialize.h +133 -0
  377. data/vendor-src/libleptris/src/include/leptris/dtd.h +178 -0
  378. data/vendor-src/libleptris/src/include/leptris/error.h +97 -0
  379. data/vendor-src/libleptris/src/include/leptris/sax/sax.h +584 -0
  380. data/vendor-src/libleptris/src/include/leptris/types.h +386 -0
  381. data/vendor-src/libleptris/src/include/leptris/xpath/xpath.h +250 -0
  382. data/vendor-src/libleptris/src/include/leptris/xquery/xquery.h +80 -0
  383. data/vendor-src/libleptris/src/include/leptris.h +3701 -0
  384. data/vendor-src/libleptris/src/leptris/chartype.h +124 -0
  385. data/vendor-src/libleptris/src/leptris/common/chartype.c +90 -0
  386. data/vendor-src/libleptris/src/leptris/common/chartype.h +44 -0
  387. data/vendor-src/libleptris/src/leptris/common/cpu.c +40 -0
  388. data/vendor-src/libleptris/src/leptris/common/cpu.h +63 -0
  389. data/vendor-src/libleptris/src/leptris/common/entities.c +329 -0
  390. data/vendor-src/libleptris/src/leptris/common/entities.h +79 -0
  391. data/vendor-src/libleptris/src/leptris/common/format_number.c +273 -0
  392. data/vendor-src/libleptris/src/leptris/common/format_number.h +29 -0
  393. data/vendor-src/libleptris/src/leptris/common/port.h +171 -0
  394. data/vendor-src/libleptris/src/leptris/common/simd_text.c +237 -0
  395. data/vendor-src/libleptris/src/leptris/common/simd_text.h +104 -0
  396. data/vendor-src/libleptris/src/leptris/common/simd_text_avx2.c +105 -0
  397. data/vendor-src/libleptris/src/leptris/common/simd_text_neon.c +280 -0
  398. data/vendor-src/libleptris/src/leptris/common/string_view.c +204 -0
  399. data/vendor-src/libleptris/src/leptris/common/string_view.h +68 -0
  400. data/vendor-src/libleptris/src/leptris/common/types_internal.h +31 -0
  401. data/vendor-src/libleptris/src/leptris/core.c +201 -0
  402. data/vendor-src/libleptris/src/leptris/descriptor/plan.c +527 -0
  403. data/vendor-src/libleptris/src/leptris/diff/diff.c +491 -0
  404. data/vendor-src/libleptris/src/leptris/dom/cdata.c +47 -0
  405. data/vendor-src/libleptris/src/leptris/dom/cdata.h +73 -0
  406. data/vendor-src/libleptris/src/leptris/dom/comment.c +48 -0
  407. data/vendor-src/libleptris/src/leptris/dom/comment.h +74 -0
  408. data/vendor-src/libleptris/src/leptris/dom/compact.c +397 -0
  409. data/vendor-src/libleptris/src/leptris/dom/compact.h +307 -0
  410. data/vendor-src/libleptris/src/leptris/dom/diag.c +58 -0
  411. data/vendor-src/libleptris/src/leptris/dom/diag.h +75 -0
  412. data/vendor-src/libleptris/src/leptris/dom/digest.c +255 -0
  413. data/vendor-src/libleptris/src/leptris/dom/doctype.c +137 -0
  414. data/vendor-src/libleptris/src/leptris/dom/doctype.h +52 -0
  415. data/vendor-src/libleptris/src/leptris/dom/document_node.c +13 -0
  416. data/vendor-src/libleptris/src/leptris/dom/document_node.h +21 -0
  417. data/vendor-src/libleptris/src/leptris/dom/edges.h +60 -0
  418. data/vendor-src/libleptris/src/leptris/dom/element.c +1114 -0
  419. data/vendor-src/libleptris/src/leptris/dom/element.h +1109 -0
  420. data/vendor-src/libleptris/src/leptris/dom/element_index.c +444 -0
  421. data/vendor-src/libleptris/src/leptris/dom/element_index.h +135 -0
  422. data/vendor-src/libleptris/src/leptris/dom/element_modify.c +2185 -0
  423. data/vendor-src/libleptris/src/leptris/dom/element_query.c +1468 -0
  424. data/vendor-src/libleptris/src/leptris/dom/entity_ref.c +57 -0
  425. data/vendor-src/libleptris/src/leptris/dom/entity_ref.h +70 -0
  426. data/vendor-src/libleptris/src/leptris/dom/node.c +420 -0
  427. data/vendor-src/libleptris/src/leptris/dom/node.h +170 -0
  428. data/vendor-src/libleptris/src/leptris/dom/node_public.c +937 -0
  429. data/vendor-src/libleptris/src/leptris/dom/node_vtable.c +138 -0
  430. data/vendor-src/libleptris/src/leptris/dom/pi.c +70 -0
  431. data/vendor-src/libleptris/src/leptris/dom/pi.h +80 -0
  432. data/vendor-src/libleptris/src/leptris/dom/root_doc_map.c +310 -0
  433. data/vendor-src/libleptris/src/leptris/dom/root_doc_map.h +30 -0
  434. data/vendor-src/libleptris/src/leptris/dom/text.c +157 -0
  435. data/vendor-src/libleptris/src/leptris/dom/text.h +119 -0
  436. data/vendor-src/libleptris/src/leptris/dtd/content_check.c +300 -0
  437. data/vendor-src/libleptris/src/leptris/dtd/model.c +533 -0
  438. data/vendor-src/libleptris/src/leptris/dtd/model.h +354 -0
  439. data/vendor-src/libleptris/src/leptris/dtd/parser.c +827 -0
  440. data/vendor-src/libleptris/src/leptris/dtd/resolver.c +354 -0
  441. data/vendor-src/libleptris/src/leptris/dtd/validator.c +668 -0
  442. data/vendor-src/libleptris/src/leptris/encoding/encoders.c +346 -0
  443. data/vendor-src/libleptris/src/leptris/encoding/encoders.h +61 -0
  444. data/vendor-src/libleptris/src/leptris/encoding/encoding.c +451 -0
  445. data/vendor-src/libleptris/src/leptris/encoding/encoding.h +118 -0
  446. data/vendor-src/libleptris/src/leptris/encoding/unicode.c +317 -0
  447. data/vendor-src/libleptris/src/leptris/encoding/unicode.h +64 -0
  448. data/vendor-src/libleptris/src/leptris/encoding/utf16.c +204 -0
  449. data/vendor-src/libleptris/src/leptris/encoding/utf16.h +78 -0
  450. data/vendor-src/libleptris/src/leptris/encoding/wrapper.c +243 -0
  451. data/vendor-src/libleptris/src/leptris/error.c +134 -0
  452. data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +1935 -0
  453. data/vendor-src/libleptris/src/leptris/flat/direct_parse.h +41 -0
  454. data/vendor-src/libleptris/src/leptris/html/html_parse.c +8040 -0
  455. data/vendor-src/libleptris/src/leptris/leptris.c +1264 -0
  456. data/vendor-src/libleptris/src/leptris/leptris_internal.h +910 -0
  457. data/vendor-src/libleptris/src/leptris/leptris_memory.c +179 -0
  458. data/vendor-src/libleptris/src/leptris/leptris_memory.h +180 -0
  459. data/vendor-src/libleptris/src/leptris/leptris_parse.h +195 -0
  460. data/vendor-src/libleptris/src/leptris/memory/arena.c +243 -0
  461. data/vendor-src/libleptris/src/leptris/memory/arena.h +93 -0
  462. data/vendor-src/libleptris/src/leptris/memory/pool.c +1055 -0
  463. data/vendor-src/libleptris/src/leptris/memory/pool.h +426 -0
  464. data/vendor-src/libleptris/src/leptris/rng/parse.c +814 -0
  465. data/vendor-src/libleptris/src/leptris/rng/rng_internal.h +112 -0
  466. data/vendor-src/libleptris/src/leptris/rng/rng_public.c +159 -0
  467. data/vendor-src/libleptris/src/leptris/rng/rng_regex.c +453 -0
  468. data/vendor-src/libleptris/src/leptris/rng/validate.c +1923 -0
  469. data/vendor-src/libleptris/src/leptris/sax/iterparse.c +435 -0
  470. data/vendor-src/libleptris/src/leptris/sax/parser.c +105 -0
  471. data/vendor-src/libleptris/src/leptris/sax/pull.c +489 -0
  472. data/vendor-src/libleptris/src/leptris/sax/recorder.c +252 -0
  473. data/vendor-src/libleptris/src/leptris/sax/sax_internal.h +163 -0
  474. data/vendor-src/libleptris/src/leptris/sax/streaming.c +1469 -0
  475. data/vendor-src/libleptris/src/leptris/sch/schematron.c +1588 -0
  476. data/vendor-src/libleptris/src/leptris/serialize/c14n.c +1143 -0
  477. data/vendor-src/libleptris/src/leptris/serialize/serialize.c +2333 -0
  478. data/vendor-src/libleptris/src/leptris/serialize/serialize.h +188 -0
  479. data/vendor-src/libleptris/src/leptris/simd_helpers.h +447 -0
  480. data/vendor-src/libleptris/src/leptris/unicode/unicode.c +237 -0
  481. data/vendor-src/libleptris/src/leptris/unicode/unicode.h +113 -0
  482. data/vendor-src/libleptris/src/leptris/xinclude/xinclude.c +794 -0
  483. data/vendor-src/libleptris/src/leptris/xpath/bytecode.h +229 -0
  484. data/vendor-src/libleptris/src/leptris/xpath/compiler.c +1478 -0
  485. data/vendor-src/libleptris/src/leptris/xpath/evaluator.c +1099 -0
  486. data/vendor-src/libleptris/src/leptris/xpath/evaluator.h +189 -0
  487. data/vendor-src/libleptris/src/leptris/xpath/evaluator_axes.c +787 -0
  488. data/vendor-src/libleptris/src/leptris/xpath/evaluator_internal.h +112 -0
  489. data/vendor-src/libleptris/src/leptris/xpath/evaluator_operators.c +2138 -0
  490. data/vendor-src/libleptris/src/leptris/xpath/evaluator_path.c +1312 -0
  491. data/vendor-src/libleptris/src/leptris/xpath/evaluator_types.c +294 -0
  492. data/vendor-src/libleptris/src/leptris/xpath/functions.c +2544 -0
  493. data/vendor-src/libleptris/src/leptris/xpath/functions.h +161 -0
  494. data/vendor-src/libleptris/src/leptris/xpath/functions_exslt.c +545 -0
  495. data/vendor-src/libleptris/src/leptris/xpath/functions_ext31.c +4316 -0
  496. data/vendor-src/libleptris/src/leptris/xpath/lexer.c +636 -0
  497. data/vendor-src/libleptris/src/leptris/xpath/lexer.h +25 -0
  498. data/vendor-src/libleptris/src/leptris/xpath/parser.c +2992 -0
  499. data/vendor-src/libleptris/src/leptris/xpath/parser.h +28 -0
  500. data/vendor-src/libleptris/src/leptris/xpath/vm.c +2903 -0
  501. data/vendor-src/libleptris/src/leptris/xpath/xpath_ast_cache.c +319 -0
  502. data/vendor-src/libleptris/src/leptris/xpath/xpath_compiled.c +263 -0
  503. data/vendor-src/libleptris/src/leptris/xpath/xpath_internal.h +134 -0
  504. data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +1139 -0
  505. data/vendor-src/libleptris/src/leptris/xpath/xpath_variables.c +410 -0
  506. data/vendor-src/libleptris/src/leptris/xpath/xpath_variables.h +230 -0
  507. data/vendor-src/libleptris/src/leptris/xquery/xquery.c +2641 -0
  508. data/vendor-src/libleptris/src/leptris/xslt/xslt_exec.c +4887 -0
  509. data/vendor-src/libleptris/src/leptris/xslt/xslt_functions.c +1612 -0
  510. data/vendor-src/libleptris/src/leptris/xslt/xslt_internal.h +862 -0
  511. data/vendor-src/libleptris/src/leptris/xslt/xslt_parse.c +2418 -0
  512. data/vendor-src/libleptris/src/leptris/xslt/xslt_pattern.c +441 -0
  513. data/vendor-src/libleptris/src/leptris/xslt/xslt_public.c +710 -0
  514. data/vendor-src/libleptris/src/leptris.symvers +16 -0
  515. data/vendor-src/libleptris/src/man/libleptris.5.adoc +961 -0
  516. data/vendor-src/libleptris/test/CMakeLists.txt +234 -0
  517. data/vendor-src/libleptris/test/README.md +59 -0
  518. data/vendor-src/libleptris/test/abi/test_descriptor.cpp +441 -0
  519. data/vendor-src/libleptris/test/abi/test_doctype_api.cpp +51 -0
  520. data/vendor-src/libleptris/test/abi/test_dom_deep_copy.cpp +110 -0
  521. data/vendor-src/libleptris/test/abi/test_dom_mutation_bugs.cpp +210 -0
  522. data/vendor-src/libleptris/test/abi/test_header_hygiene.cpp +269 -0
  523. data/vendor-src/libleptris/test/abi/test_namespace_mutation_and_create.cpp +198 -0
  524. data/vendor-src/libleptris/test/abi/test_node_get_xpath.cpp +128 -0
  525. data/vendor-src/libleptris/test/abi/test_nokogiri_api.cpp +392 -0
  526. data/vendor-src/libleptris/test/abi/test_parse_fragment.cpp +114 -0
  527. data/vendor-src/libleptris/test/abi/test_previous_sibling_and_c14n_ex.cpp +299 -0
  528. data/vendor-src/libleptris/test/abi/test_public_surface.cpp +463 -0
  529. data/vendor-src/libleptris/test/abi/test_serialize_abi.cpp +67 -0
  530. data/vendor-src/libleptris/test/abi/test_v0_5_14_bugs.cpp +299 -0
  531. data/vendor-src/libleptris/test/abi/test_xpath_custom_fns.cpp +106 -0
  532. data/vendor-src/libleptris/test/cli/test_cli.cpp +493 -0
  533. data/vendor-src/libleptris/test/common/test_simd_spans.cpp +88 -0
  534. data/vendor-src/libleptris/test/common/test_simd_text.cpp +142 -0
  535. data/vendor-src/libleptris/test/concurrency/test_concurrency.cpp +218 -0
  536. data/vendor-src/libleptris/test/diff/test_diff.cpp +244 -0
  537. data/vendor-src/libleptris/test/dom/test_compact.cpp +339 -0
  538. data/vendor-src/libleptris/test/dom/test_digest.cpp +111 -0
  539. data/vendor-src/libleptris/test/dom/test_document_children.cpp +270 -0
  540. data/vendor-src/libleptris/test/dom/test_dom.cpp +2310 -0
  541. data/vendor-src/libleptris/test/dom/test_map_lifecycle.cpp +111 -0
  542. data/vendor-src/libleptris/test/dom/test_node_surface_parity.cpp +268 -0
  543. data/vendor-src/libleptris/test/dom/test_text_borrowed.cpp +126 -0
  544. data/vendor-src/libleptris/test/dom/test_vtable.cpp +108 -0
  545. data/vendor-src/libleptris/test/dtd/test_dtd_validate.cpp +1227 -0
  546. data/vendor-src/libleptris/test/dtd/test_w3c_conformance.cpp +212 -0
  547. data/vendor-src/libleptris/test/fixtures/basic.xml +13 -0
  548. data/vendor-src/libleptris/test/fixtures/cdata.xml +5 -0
  549. data/vendor-src/libleptris/test/fixtures/malformed.xml +2 -0
  550. data/vendor-src/libleptris/test/fixtures/namespaces.xml +11 -0
  551. data/vendor-src/libleptris/test/fixtures/utf16_decl.xml +5 -0
  552. data/vendor-src/libleptris/test/fuzz/fuzz_parse.c +40 -0
  553. data/vendor-src/libleptris/test/html/html5lib-redlist.txt +1366 -0
  554. data/vendor-src/libleptris/test/html/html5lib-tests/LICENSE +21 -0
  555. data/vendor-src/libleptris/test/html/html5lib-tests/README.md +11 -0
  556. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/adoption01.dat +354 -0
  557. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/adoption02.dat +39 -0
  558. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/blocks.dat +695 -0
  559. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/comments01.dat +217 -0
  560. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/doctype01.dat +474 -0
  561. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/domjs-unsafe.dat +0 -0
  562. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/entities01.dat +943 -0
  563. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/entities02.dat +309 -0
  564. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/foreign-fragment.dat +645 -0
  565. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/html5test-com.dat +301 -0
  566. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/inbody01.dat +54 -0
  567. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/isindex.dat +49 -0
  568. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/main-element.dat +46 -0
  569. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/math.dat +104 -0
  570. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/menuitem-element.dat +240 -0
  571. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/namespace-sensitivity.dat +22 -0
  572. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/noscript01.dat +237 -0
  573. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/pending-spec-changes-plain-text-unsafe.dat +0 -0
  574. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/pending-spec-changes.dat +46 -0
  575. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/plain-text-unsafe.dat +0 -0
  576. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/ruby.dat +302 -0
  577. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/scriptdata01.dat +372 -0
  578. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/search-element.dat +46 -0
  579. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/svg.dat +104 -0
  580. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tables01.dat +308 -0
  581. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/template.dat +1673 -0
  582. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests1.dat +1956 -0
  583. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests10.dat +849 -0
  584. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests11.dat +523 -0
  585. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests12.dat +62 -0
  586. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests14.dat +75 -0
  587. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests15.dat +216 -0
  588. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests16.dat +2602 -0
  589. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests17.dat +179 -0
  590. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests18.dat +558 -0
  591. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests19.dat +1398 -0
  592. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests2.dat +821 -0
  593. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests20.dat +842 -0
  594. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests21.dat +306 -0
  595. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests22.dat +190 -0
  596. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests23.dat +168 -0
  597. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests24.dat +79 -0
  598. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests25.dat +288 -0
  599. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests26.dat +453 -0
  600. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests3.dat +305 -0
  601. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests4.dat +58 -0
  602. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests5.dat +210 -0
  603. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests6.dat +663 -0
  604. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests7.dat +417 -0
  605. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests8.dat +165 -0
  606. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests9.dat +472 -0
  607. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tests_innerHTML_1.dat +843 -0
  608. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/tricky01.dat +336 -0
  609. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/webkit01.dat +785 -0
  610. data/vendor-src/libleptris/test/html/html5lib-tests/tree-construction/webkit02.dat +554 -0
  611. data/vendor-src/libleptris/test/html/html5lib_cases.h.in +6 -0
  612. data/vendor-src/libleptris/test/html/nokogiri-parity-redlist.txt +1183 -0
  613. data/vendor-src/libleptris/test/html/nokogiri-tree-tests.dat +18107 -0
  614. data/vendor-src/libleptris/test/html/test_html.cpp +2191 -0
  615. data/vendor-src/libleptris/test/html/test_html5lib.cpp +831 -0
  616. data/vendor-src/libleptris/test/memory/test_arena.cpp +252 -0
  617. data/vendor-src/libleptris/test/memory/test_oom_injection.cpp +170 -0
  618. data/vendor-src/libleptris/test/memory/test_pool.cpp +331 -0
  619. data/vendor-src/libleptris/test/memory/test_pool_arena.cpp +180 -0
  620. data/vendor-src/libleptris/test/parser/test_encoding.cpp +282 -0
  621. data/vendor-src/libleptris/test/parser/test_large_documents.cpp +346 -0
  622. data/vendor-src/libleptris/test/parser/test_parser.cpp +565 -0
  623. data/vendor-src/libleptris/test/parser/test_simd_count.cpp +70 -0
  624. data/vendor-src/libleptris/test/perf/test_perf.cpp +362 -0
  625. data/vendor-src/libleptris/test/perf/test_stress_high_doc_count.cpp +67 -0
  626. data/vendor-src/libleptris/test/rng/include-cases/bad-construct.rng +7 -0
  627. data/vendor-src/libleptris/test/rng/include-cases/bad-override.rng +6 -0
  628. data/vendor-src/libleptris/test/rng/include-cases/bad-start-override.rng +5 -0
  629. data/vendor-src/libleptris/test/rng/include-cases/ext-lib.rng +3 -0
  630. data/vendor-src/libleptris/test/rng/include-cases/ext-main.rng +7 -0
  631. data/vendor-src/libleptris/test/rng/include-cases/lib.rng +5 -0
  632. data/vendor-src/libleptris/test/rng/include-cases/lib2.rng +6 -0
  633. data/vendor-src/libleptris/test/rng/include-cases/main.rng +4 -0
  634. data/vendor-src/libleptris/test/rng/include-cases/no-href.rng +4 -0
  635. data/vendor-src/libleptris/test/rng/include-cases/override.rng +8 -0
  636. data/vendor-src/libleptris/test/rng/include-cases/self-include.rng +4 -0
  637. data/vendor-src/libleptris/test/rng/include-cases/start-override.rng +5 -0
  638. data/vendor-src/libleptris/test/rng/jing-cases/000.bad.xml +1 -0
  639. data/vendor-src/libleptris/test/rng/jing-cases/000.ok.xml +1 -0
  640. data/vendor-src/libleptris/test/rng/jing-cases/000.rng +1 -0
  641. data/vendor-src/libleptris/test/rng/jing-cases/001.bad.xml +1 -0
  642. data/vendor-src/libleptris/test/rng/jing-cases/001.ok.xml +1 -0
  643. data/vendor-src/libleptris/test/rng/jing-cases/001.rng +1 -0
  644. data/vendor-src/libleptris/test/rng/jing-cases/002.bad.xml +1 -0
  645. data/vendor-src/libleptris/test/rng/jing-cases/002.ok.xml +1 -0
  646. data/vendor-src/libleptris/test/rng/jing-cases/002.rng +1 -0
  647. data/vendor-src/libleptris/test/rng/jing-cases/003.bad.xml +1 -0
  648. data/vendor-src/libleptris/test/rng/jing-cases/003.ok.xml +1 -0
  649. data/vendor-src/libleptris/test/rng/jing-cases/003.rng +1 -0
  650. data/vendor-src/libleptris/test/rng/jing-cases/004.bad.xml +1 -0
  651. data/vendor-src/libleptris/test/rng/jing-cases/004.ok.xml +1 -0
  652. data/vendor-src/libleptris/test/rng/jing-cases/004.rng +1 -0
  653. data/vendor-src/libleptris/test/rng/jing-cases/005.bad.xml +1 -0
  654. data/vendor-src/libleptris/test/rng/jing-cases/005.ok.xml +1 -0
  655. data/vendor-src/libleptris/test/rng/jing-cases/005.rng +1 -0
  656. data/vendor-src/libleptris/test/rng/jing-cases/006.bad.xml +1 -0
  657. data/vendor-src/libleptris/test/rng/jing-cases/006.ok.xml +1 -0
  658. data/vendor-src/libleptris/test/rng/jing-cases/006.rng +1 -0
  659. data/vendor-src/libleptris/test/rng/jing-cases/007.bad.xml +1 -0
  660. data/vendor-src/libleptris/test/rng/jing-cases/007.ok.xml +1 -0
  661. data/vendor-src/libleptris/test/rng/jing-cases/007.rng +1 -0
  662. data/vendor-src/libleptris/test/rng/jing-cases/008.bad.xml +1 -0
  663. data/vendor-src/libleptris/test/rng/jing-cases/008.ok.xml +1 -0
  664. data/vendor-src/libleptris/test/rng/jing-cases/008.rng +1 -0
  665. data/vendor-src/libleptris/test/rng/jing-cases/009.bad.xml +1 -0
  666. data/vendor-src/libleptris/test/rng/jing-cases/009.ok.xml +1 -0
  667. data/vendor-src/libleptris/test/rng/jing-cases/009.rng +1 -0
  668. data/vendor-src/libleptris/test/rng/jing-cases/010.bad.xml +1 -0
  669. data/vendor-src/libleptris/test/rng/jing-cases/010.ok.xml +1 -0
  670. data/vendor-src/libleptris/test/rng/jing-cases/010.rng +1 -0
  671. data/vendor-src/libleptris/test/rng/jing-cases/011.bad.xml +1 -0
  672. data/vendor-src/libleptris/test/rng/jing-cases/011.ok.xml +1 -0
  673. data/vendor-src/libleptris/test/rng/jing-cases/011.rng +1 -0
  674. data/vendor-src/libleptris/test/rng/jing-cases/012.bad.xml +1 -0
  675. data/vendor-src/libleptris/test/rng/jing-cases/012.ok.xml +1 -0
  676. data/vendor-src/libleptris/test/rng/jing-cases/012.rng +1 -0
  677. data/vendor-src/libleptris/test/rng/jing-cases/013.bad.xml +1 -0
  678. data/vendor-src/libleptris/test/rng/jing-cases/013.ok.xml +1 -0
  679. data/vendor-src/libleptris/test/rng/jing-cases/013.rng +1 -0
  680. data/vendor-src/libleptris/test/rng/jing-cases/014.bad.xml +1 -0
  681. data/vendor-src/libleptris/test/rng/jing-cases/014.ok.xml +1 -0
  682. data/vendor-src/libleptris/test/rng/jing-cases/014.rng +1 -0
  683. data/vendor-src/libleptris/test/rng/jing-cases/015.bad.xml +1 -0
  684. data/vendor-src/libleptris/test/rng/jing-cases/015.ok.xml +1 -0
  685. data/vendor-src/libleptris/test/rng/jing-cases/015.rng +1 -0
  686. data/vendor-src/libleptris/test/rng/jing-cases/016.bad.xml +1 -0
  687. data/vendor-src/libleptris/test/rng/jing-cases/016.ok.xml +1 -0
  688. data/vendor-src/libleptris/test/rng/jing-cases/016.rng +1 -0
  689. data/vendor-src/libleptris/test/rng/jing-cases/017.bad.xml +1 -0
  690. data/vendor-src/libleptris/test/rng/jing-cases/017.ok.xml +1 -0
  691. data/vendor-src/libleptris/test/rng/jing-cases/017.rng +1 -0
  692. data/vendor-src/libleptris/test/rng/jing-cases/018.bad.xml +1 -0
  693. data/vendor-src/libleptris/test/rng/jing-cases/018.ok.xml +1 -0
  694. data/vendor-src/libleptris/test/rng/jing-cases/018.rng +1 -0
  695. data/vendor-src/libleptris/test/rng/jing-cases/019.bad.xml +1 -0
  696. data/vendor-src/libleptris/test/rng/jing-cases/019.ok.xml +1 -0
  697. data/vendor-src/libleptris/test/rng/jing-cases/019.rng +7 -0
  698. data/vendor-src/libleptris/test/rng/jing-cases/020-book.rng +4 -0
  699. data/vendor-src/libleptris/test/rng/jing-cases/020.bad.xml +1 -0
  700. data/vendor-src/libleptris/test/rng/jing-cases/020.ok.xml +1 -0
  701. data/vendor-src/libleptris/test/rng/jing-cases/020.rng +3 -0
  702. data/vendor-src/libleptris/test/rng/jing-cases/README.md +32 -0
  703. data/vendor-src/libleptris/test/rng/jing-cases/jing-ref.json +212 -0
  704. data/vendor-src/libleptris/test/rng/jing-cases/meta.json +1 -0
  705. data/vendor-src/libleptris/test/rng/test_rng.cpp +1365 -0
  706. data/vendor-src/libleptris/test/rng/test_rng_corpus.cpp +133 -0
  707. data/vendor-src/libleptris/test/rng/test_rng_corpus_msg.cpp +233 -0
  708. data/vendor-src/libleptris/test/sax/test_iterparse.cpp +203 -0
  709. data/vendor-src/libleptris/test/sax/test_pull.cpp +214 -0
  710. data/vendor-src/libleptris/test/sax/test_pull_batch.cpp +201 -0
  711. data/vendor-src/libleptris/test/sax/test_recorder.cpp +265 -0
  712. data/vendor-src/libleptris/test/sax/test_sax.cpp +665 -0
  713. data/vendor-src/libleptris/test/sax/test_streaming.cpp +434 -0
  714. data/vendor-src/libleptris/test/sch/conformance-cases/README.md +15 -0
  715. data/vendor-src/libleptris/test/sch/conformance-cases/extends-baseuri-fixup-01.xml +28 -0
  716. data/vendor-src/libleptris/test/sch/conformance-cases/extends-recursive-01.xml +27 -0
  717. data/vendor-src/libleptris/test/sch/conformance-cases/include-baseuri-fixup-01.xml +24 -0
  718. data/vendor-src/libleptris/test/sch/conformance-cases/include-recursive-01.xml +24 -0
  719. data/vendor-src/libleptris/test/sch/conformance-cases/let-name-collision-error-01.xml +20 -0
  720. data/vendor-src/libleptris/test/sch/conformance-cases/let-name-collision-error-02.xml +20 -0
  721. data/vendor-src/libleptris/test/sch/conformance-cases/let-name-collision-error-03.xml +20 -0
  722. data/vendor-src/libleptris/test/sch/conformance-cases/let-name-collision-error-04.xml +23 -0
  723. data/vendor-src/libleptris/test/sch/conformance-cases/let-name-collision-error-05.xml +20 -0
  724. data/vendor-src/libleptris/test/sch/conformance-cases/let-name-collision-error-06.xml +25 -0
  725. data/vendor-src/libleptris/test/sch/conformance-cases/let-pattern-global-01.xml +24 -0
  726. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-01.xml +18 -0
  727. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-02.xml +18 -0
  728. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-03.xml +18 -0
  729. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-04.xml +19 -0
  730. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-05.xml +20 -0
  731. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-06.xml +20 -0
  732. data/vendor-src/libleptris/test/sch/conformance-cases/let-reference-undefined-07.xml +18 -0
  733. data/vendor-src/libleptris/test/sch/conformance-cases/let-rule-global-01.xml +20 -0
  734. data/vendor-src/libleptris/test/sch/conformance-cases/let-rule-global-02.xml +23 -0
  735. data/vendor-src/libleptris/test/sch/conformance-cases/let-scope-pattern-01.xml +25 -0
  736. data/vendor-src/libleptris/test/sch/conformance-cases/let-scope-phase-01.xml +23 -0
  737. data/vendor-src/libleptris/test/sch/conformance-cases/let-scope-rule-01.xml +23 -0
  738. data/vendor-src/libleptris/test/sch/conformance-cases/let-value-element-content-01.xml +33 -0
  739. data/vendor-src/libleptris/test/sch/conformance-cases/pattern-abstract-01.xml +22 -0
  740. data/vendor-src/libleptris/test/sch/conformance-cases/pattern-subordinate-document-01.xml +21 -0
  741. data/vendor-src/libleptris/test/sch/conformance-cases/pattern-subordinate-document-02.xml +21 -0
  742. data/vendor-src/libleptris/test/sch/conformance-cases/rule-abstract-01.xml +21 -0
  743. data/vendor-src/libleptris/test/sch/conformance-cases/rule-abstract-02.xml +23 -0
  744. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-attribute-01.xml +18 -0
  745. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-comment-01.xml +20 -0
  746. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-element-01.xml +18 -0
  747. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-pi-01.xml +20 -0
  748. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-root-01.xml +18 -0
  749. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-text-01.xml +18 -0
  750. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-variable-01.xml +22 -0
  751. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-variable-02.xml +25 -0
  752. data/vendor-src/libleptris/test/sch/conformance-cases/rule-context-variable-03.xml +22 -0
  753. data/vendor-src/libleptris/test/sch/conformance-cases/rule-order-01.xml +21 -0
  754. data/vendor-src/libleptris/test/sch/conformance-cases/schema-default-phase-01.xml +26 -0
  755. data/vendor-src/libleptris/test/sch/conformance-cases/schema-default-phase-02.xml +25 -0
  756. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-diagnostic-01.xml +28 -0
  757. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-diagnostic-02.xml +25 -0
  758. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-name-nopath-01.xml +23 -0
  759. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-name-path-01.xml +23 -0
  760. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-property-01.xml +28 -0
  761. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-property-copy-of.xml +26 -0
  762. data/vendor-src/libleptris/test/sch/conformance-cases/svrl-value-of-01.xml +23 -0
  763. data/vendor-src/libleptris/test/sch/conformance-cases/xslt-key-01.xml +19 -0
  764. data/vendor-src/libleptris/test/sch/conformance-cases/xslt-key-element-content-01.xml +21 -0
  765. data/vendor-src/libleptris/test/sch/test_schematron.cpp +337 -0
  766. data/vendor-src/libleptris/test/sch/test_schematron_corpus.cpp +421 -0
  767. data/vendor-src/libleptris/test/serializer/test_c14n.cpp +539 -0
  768. data/vendor-src/libleptris/test/serializer/test_serialize.cpp +890 -0
  769. data/vendor-src/libleptris/test/smoke/test_smoke.cpp +41 -0
  770. data/vendor-src/libleptris/test/xinclude/test_xinclude.cpp +903 -0
  771. data/vendor-src/libleptris/test/xpath/test_bytecode_vm.cpp +755 -0
  772. data/vendor-src/libleptris/test/xpath/test_compiled.cpp +171 -0
  773. data/vendor-src/libleptris/test/xpath/test_exslt.cpp +141 -0
  774. data/vendor-src/libleptris/test/xpath/test_xpath.cpp +2433 -0
  775. data/vendor-src/libleptris/test/xpath/test_xpath_conformance.cpp +570 -0
  776. data/vendor-src/libleptris/test/xpath/test_xslt.cpp +4245 -0
  777. data/vendor-src/libleptris/test/xquery/books.xml +1 -0
  778. data/vendor-src/libleptris/test/xquery/qt3/README.md +28 -0
  779. data/vendor-src/libleptris/test/xquery/qt3/fn/concat.xml +878 -0
  780. data/vendor-src/libleptris/test/xquery/qt3/fn/contains.xml +795 -0
  781. data/vendor-src/libleptris/test/xquery/qt3/fn/ends-with.xml +556 -0
  782. data/vendor-src/libleptris/test/xquery/qt3/fn/starts-with.xml +644 -0
  783. data/vendor-src/libleptris/test/xquery/qt3/fn/substring/concepts.xml +1 -0
  784. data/vendor-src/libleptris/test/xquery/qt3/fn/substring.xml +449 -0
  785. data/vendor-src/libleptris/test/xquery/test_qt3.cpp +324 -0
  786. data/vendor-src/libleptris/test/xquery/test_xquery.cpp +768 -0
  787. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/ATTRIBUTION.md +12 -0
  788. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/array.out +4 -0
  789. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/array.xml +7 -0
  790. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/array.xsl +26 -0
  791. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-1-.out +6 -0
  792. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-1-.xml +7 -0
  793. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-1-.xsl +21 -0
  794. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-10-.out +2 -0
  795. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-10-.xml +3 -0
  796. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-10-.xsl +10 -0
  797. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-100.out +2 -0
  798. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-100.xml +1 -0
  799. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-100.xsl +9 -0
  800. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-101.out +2 -0
  801. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-101.xml +1 -0
  802. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-101.xsl +8 -0
  803. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-102-inc.xsl +21 -0
  804. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-102.out +3 -0
  805. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-102.xml +1 -0
  806. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-102.xsl +10 -0
  807. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-103.out +2 -0
  808. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-103.xml +1 -0
  809. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-103.xsl +13 -0
  810. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-104.out +2 -0
  811. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-104.xml +1 -0
  812. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-104.xsl +10 -0
  813. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-105.out +2 -0
  814. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-105.xml +1 -0
  815. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-105.xsl +8 -0
  816. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-106.out +2 -0
  817. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-106.xml +2 -0
  818. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-106.xsl +12 -0
  819. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-107.out +8 -0
  820. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-107.xml +7 -0
  821. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-107.xsl +11 -0
  822. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-108.out +25 -0
  823. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-108.xml +4 -0
  824. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-108.xsl +21 -0
  825. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-109.out +3 -0
  826. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-109.xml +4 -0
  827. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-109.xsl +7 -0
  828. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-11-.out +1 -0
  829. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-11-.xml +4 -0
  830. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-11-.xsl +12 -0
  831. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-110.ent +1 -0
  832. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-110.out +1 -0
  833. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-110.xml +9 -0
  834. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-110.xsl +20 -0
  835. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-111.out +6 -0
  836. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-111.xml +17 -0
  837. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-111.xsl +45 -0
  838. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-112.out +2 -0
  839. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-112.xml +1 -0
  840. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-112.xsl +22 -0
  841. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-113.out +4 -0
  842. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-113.xml +7 -0
  843. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-113.xsl +15 -0
  844. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-114.out +3 -0
  845. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-114.xml +7 -0
  846. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-114.xsl +16 -0
  847. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-115.out +2 -0
  848. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-115.xml +1 -0
  849. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-115.xsl +19 -0
  850. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-116.out +2 -0
  851. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-116.xml +1 -0
  852. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-116.xsl +22 -0
  853. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-117.out +5 -0
  854. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-117.xml +10 -0
  855. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-117.xsl +59 -0
  856. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-118.out +3 -0
  857. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-118.xml +6 -0
  858. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-118.xsl +14 -0
  859. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-119.out +10 -0
  860. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-119.xml +12 -0
  861. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-119.xsl +12 -0
  862. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-12-.out +2 -0
  863. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-12-.xml +9 -0
  864. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-12-.xsl +16 -0
  865. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-120.out +8 -0
  866. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-120.xml +15 -0
  867. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-120.xsl +27 -0
  868. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-121.out +1 -0
  869. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-121.xml +1 -0
  870. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-121.xsl +8 -0
  871. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-122.out +2 -0
  872. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-122.xml +11 -0
  873. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-122.xsl +17 -0
  874. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-123.out +2 -0
  875. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-123.xml +2 -0
  876. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-123.xsl +14 -0
  877. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-124.out +2 -0
  878. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-124.xml +6 -0
  879. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-124.xsl +14 -0
  880. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-125.out +351 -0
  881. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-125.xml +118 -0
  882. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-125.xsl +99 -0
  883. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-126.out +9 -0
  884. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-126.xml +1 -0
  885. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-126.xsl +17 -0
  886. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-127.out +1 -0
  887. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-127.xml +1 -0
  888. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-127.xsl +18 -0
  889. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-128.out +5 -0
  890. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-128.xml +26 -0
  891. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-128.xsl +26 -0
  892. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-129.out +6 -0
  893. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-129.xml +6 -0
  894. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-129.xsl +10 -0
  895. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-13-.out +2 -0
  896. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-13-.xml +1 -0
  897. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-13-.xsl +10 -0
  898. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130-imp1.imp +25 -0
  899. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130-imp2.imp +14 -0
  900. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130-imp3.imp +16 -0
  901. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130-imp4.imp +22 -0
  902. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130.doc +7 -0
  903. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130.out +1 -0
  904. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130.xml +4 -0
  905. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-130.xsl +22 -0
  906. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-131-imp.imp +19 -0
  907. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-131.out +2 -0
  908. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-131.xml +3 -0
  909. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-131.xsl +13 -0
  910. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-132.out +6 -0
  911. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-132.xml +6 -0
  912. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-132.xsl +13 -0
  913. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-133.out +6 -0
  914. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-133.xml +7 -0
  915. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-133.xsl +32 -0
  916. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-134.out +2 -0
  917. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-134.xml +5 -0
  918. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-134.xsl +12 -0
  919. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-135.out +2 -0
  920. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-135.xml +5 -0
  921. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-135.xsl +10 -0
  922. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-136.out +4 -0
  923. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-136.xml +4 -0
  924. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-136.xsl +8 -0
  925. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-137.imp +12 -0
  926. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-137.out +2 -0
  927. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-137.xml +1 -0
  928. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-137.xsl +8 -0
  929. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-138.out +23 -0
  930. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-138.xml +15 -0
  931. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-138.xsl +28 -0
  932. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-139.out +4 -0
  933. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-139.xml +9 -0
  934. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-139.xsl +14 -0
  935. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-14-.out +4 -0
  936. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-14-.xml +7 -0
  937. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-14-.xsl +23 -0
  938. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-140.out +4 -0
  939. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-140.xml +6 -0
  940. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-140.xsl +32 -0
  941. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-141.out +46 -0
  942. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-141.xml +9 -0
  943. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-141.xsl +25 -0
  944. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-142.out +35 -0
  945. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-142.xml +65 -0
  946. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-142.xsl +85 -0
  947. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-143.out +2 -0
  948. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-143.xml +1 -0
  949. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-143.xsl +10 -0
  950. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-144.out +2 -0
  951. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-144.xml +1 -0
  952. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-144.xsl +10 -0
  953. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-145.err +5 -0
  954. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-145.xml +10 -0
  955. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-145.xsl +10 -0
  956. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147-1.imp +11 -0
  957. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147-2.imp +11 -0
  958. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147-3.imp +57 -0
  959. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147-4.imp +15 -0
  960. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147-5.imp +27 -0
  961. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147-6.imp +31 -0
  962. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147.out +17 -0
  963. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147.xml +21 -0
  964. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-147.xsl +29 -0
  965. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-148.out +2 -0
  966. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-148.xml +1 -0
  967. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-148.xsl +13 -0
  968. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-149.out +2 -0
  969. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-149.xml +1 -0
  970. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-149.xsl +11 -0
  971. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-15-.out +5 -0
  972. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-15-.xml +5 -0
  973. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-15-.xsl +15 -0
  974. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-150.out +2 -0
  975. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-150.xml +1 -0
  976. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-150.xsl +9 -0
  977. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-151.xml +1 -0
  978. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-151.xsl +15 -0
  979. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-152.out +12 -0
  980. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-152.xml +1 -0
  981. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-152.xsl +30 -0
  982. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-153.doc +4 -0
  983. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-153.out +2 -0
  984. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-153.xml +9 -0
  985. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-153.xsl +19 -0
  986. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-154.xml +1 -0
  987. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-154.xsl +4 -0
  988. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-155.out +3 -0
  989. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-155.xml +5 -0
  990. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-155.xsl +10 -0
  991. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-156.err +2 -0
  992. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-156.imp1.imp +16 -0
  993. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-156.imp2.imp +10 -0
  994. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-156.xml +1 -0
  995. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-156.xsl +12 -0
  996. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-157.err +3 -0
  997. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-157.out +9 -0
  998. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-157.xml +6 -0
  999. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-157.xsl +22 -0
  1000. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-158.doc +3 -0
  1001. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-158.out +4 -0
  1002. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-158.xml +2 -0
  1003. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-158.xsl +19 -0
  1004. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-159.out +8 -0
  1005. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-159.xml +1 -0
  1006. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-159.xsl +17 -0
  1007. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-16-.out +14 -0
  1008. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-16-.xml +17 -0
  1009. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-16-.xsl +13 -0
  1010. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-160.out +7 -0
  1011. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-160.xml +8 -0
  1012. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-160.xsl +14 -0
  1013. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-161.out +6 -0
  1014. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-161.xml +5 -0
  1015. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-161.xsl +18 -0
  1016. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-163.out +2 -0
  1017. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-163.xml +5 -0
  1018. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-163.xsl +6 -0
  1019. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-164.out +4 -0
  1020. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-164.xml +4 -0
  1021. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-164.xsl +13 -0
  1022. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-165.err +6 -0
  1023. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-165.xml +10 -0
  1024. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-165.xsl +9 -0
  1025. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-166.out +15256 -0
  1026. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-166.xml +15255 -0
  1027. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-166.xsl +131 -0
  1028. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-167.out +1 -0
  1029. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-167.xml +1 -0
  1030. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-167.xsl +20 -0
  1031. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-168.out +2 -0
  1032. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-168.xml +9 -0
  1033. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-168.xsl +9 -0
  1034. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-169.imp +5 -0
  1035. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-169.out +2 -0
  1036. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-169.xml +1 -0
  1037. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-169.xsl +11 -0
  1038. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-17-.out +2 -0
  1039. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-17-.xml +1 -0
  1040. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-17-.xsl +7 -0
  1041. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-170.out +4 -0
  1042. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-170.xml +3 -0
  1043. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-170.xsl +6 -0
  1044. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-171.out +2 -0
  1045. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-171.xml +4 -0
  1046. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-171.xsl +7 -0
  1047. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-172.out +6 -0
  1048. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-172.xml +6 -0
  1049. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-172.xsl +22 -0
  1050. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-173.out +1 -0
  1051. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-173.xml +1 -0
  1052. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-173.xsl +11 -0
  1053. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-174.err +1 -0
  1054. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-174.xml +1 -0
  1055. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-174.xsl +18 -0
  1056. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-175.err +2 -0
  1057. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-175.out +8 -0
  1058. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-175.xml +1 -0
  1059. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-175.xsl +33 -0
  1060. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-176.out +2 -0
  1061. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-176.xml +1 -0
  1062. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-176.xsl +11 -0
  1063. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-177.out +2 -0
  1064. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-177.xml +1 -0
  1065. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-177.xsl +7 -0
  1066. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-178.out +2 -0
  1067. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-178.xml +1 -0
  1068. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-178.xsl +18 -0
  1069. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-179.out +9 -0
  1070. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-179.xml +1 -0
  1071. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-179.xsl +24 -0
  1072. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-18-.out +2 -0
  1073. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-18-.xml +3 -0
  1074. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-18-.xsl +17 -0
  1075. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-180.err +4 -0
  1076. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-180.xml +2 -0
  1077. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-180.xsl +8 -0
  1078. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-181.out +5 -0
  1079. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-181.xml +4 -0
  1080. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-181.xsl +13 -0
  1081. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-182.out +2 -0
  1082. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-182.xml +4 -0
  1083. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-182.xsl +21 -0
  1084. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-183.out +2 -0
  1085. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-183.xml +5 -0
  1086. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-183.xsl +9 -0
  1087. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-184.err +6 -0
  1088. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-184.xml +1 -0
  1089. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-184.xsl +8 -0
  1090. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-186.out +5 -0
  1091. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-186.xml +4 -0
  1092. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-186.xsl +7 -0
  1093. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-187.err +6 -0
  1094. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-187.out +14 -0
  1095. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-187.xml +1 -0
  1096. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-187.xsl +42 -0
  1097. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-188-imp.xsl +8 -0
  1098. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-188.out +4 -0
  1099. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-188.xml +1 -0
  1100. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-188.xsl +20 -0
  1101. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-189.out +5 -0
  1102. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-189.xml +1 -0
  1103. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-189.xsl +25 -0
  1104. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-19-.out +2 -0
  1105. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-19-.xml +3 -0
  1106. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-19-.xsl +17 -0
  1107. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-190-imp.xsl +10 -0
  1108. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-190.out +4 -0
  1109. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-190.xml +1 -0
  1110. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-190.xsl +16 -0
  1111. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-191-imp.xsl +8 -0
  1112. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-191.err +2 -0
  1113. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-191.xml +1 -0
  1114. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-191.xsl +9 -0
  1115. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-192.out +1 -0
  1116. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-192.xml +1 -0
  1117. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-192.xsl +33 -0
  1118. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-193.out +2 -0
  1119. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-193.xml +1 -0
  1120. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-193.xsl +11 -0
  1121. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-194.err +9 -0
  1122. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-194.xml +1 -0
  1123. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-194.xsl +8 -0
  1124. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-195.out +8 -0
  1125. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-195.xml +9 -0
  1126. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-195.xsl +19 -0
  1127. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-196.out +7 -0
  1128. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-196.xml +9 -0
  1129. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-196.xsl +19 -0
  1130. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-197.out +6 -0
  1131. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-197.xml +6 -0
  1132. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-197.xsl +16 -0
  1133. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-198.out +2 -0
  1134. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-198.xml +2 -0
  1135. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-198.xsl +17 -0
  1136. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-199.out +6 -0
  1137. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-199.xml +6 -0
  1138. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-199.xsl +18 -0
  1139. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-2-.out +8 -0
  1140. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-2-.xml +12 -0
  1141. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-2-.xsl +16 -0
  1142. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-20-.out +4 -0
  1143. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-20-.xml +7 -0
  1144. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-20-.xsl +22 -0
  1145. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-200.out +2 -0
  1146. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-200.xml +1 -0
  1147. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-200.xsl +5 -0
  1148. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-201.err +6 -0
  1149. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-201.xml +1 -0
  1150. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-201.xsl +16 -0
  1151. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-202.err +2 -0
  1152. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-202.xml +1 -0
  1153. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-202.xsl +5 -0
  1154. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-203.err +1 -0
  1155. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-203.xml +1 -0
  1156. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-203.xsl +5 -0
  1157. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-204.err +2 -0
  1158. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-204.xml +1 -0
  1159. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-204.xsl +6 -0
  1160. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-205.out +2 -0
  1161. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-205.xml +1 -0
  1162. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-205.xsl +10 -0
  1163. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-206.out +2 -0
  1164. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-206.xml +1 -0
  1165. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-206.xsl +9 -0
  1166. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-207.out +2 -0
  1167. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-207.xml +1 -0
  1168. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-207.xsl +61 -0
  1169. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-208.err +6 -0
  1170. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-208.xml +8 -0
  1171. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-208.xsl +8 -0
  1172. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-209.out +2 -0
  1173. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-209.xml +1 -0
  1174. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-209.xsl +21 -0
  1175. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-21-.out +2 -0
  1176. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-21-.xml +8 -0
  1177. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-21-.xsl +7 -0
  1178. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-210.out +2 -0
  1179. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-210.xml +1 -0
  1180. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-210.xsl +20 -0
  1181. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-211.out +2 -0
  1182. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-211.xml +1 -0
  1183. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-211.xsl +26 -0
  1184. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-212.out +1 -0
  1185. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-212.xml +1 -0
  1186. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-212.xsl +25 -0
  1187. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-213.out +1 -0
  1188. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-213.xml +1 -0
  1189. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-213.xsl +26 -0
  1190. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-214.out +6 -0
  1191. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-214.xml +6 -0
  1192. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-214.xsl +25 -0
  1193. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-215.err +5 -0
  1194. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-215.xml +1 -0
  1195. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-215.xsl +6 -0
  1196. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-216.out +2 -0
  1197. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-216.xml +1 -0
  1198. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-216.xsl +11 -0
  1199. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-217.out +2 -0
  1200. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-217.xml +1 -0
  1201. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-217.xsl +24 -0
  1202. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-218.out +2 -0
  1203. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-218.xml +1 -0
  1204. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-218.xsl +8 -0
  1205. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-219.out +68 -0
  1206. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-219.xml +22 -0
  1207. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-219.xsl +17 -0
  1208. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-22-.out +12 -0
  1209. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-22-.xml +18 -0
  1210. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-22-.xsl +19 -0
  1211. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-220.out +2 -0
  1212. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-220.xml +1 -0
  1213. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-220.xsl +15 -0
  1214. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-221.out +2 -0
  1215. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-221.xml +9 -0
  1216. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-221.xsl +15 -0
  1217. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-222.out +2 -0
  1218. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-222.xml +1 -0
  1219. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-222.xsl +6 -0
  1220. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-223-imp.xsl +12 -0
  1221. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-223-inc.xsl +12 -0
  1222. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-223.out +1 -0
  1223. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-223.xml +1 -0
  1224. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-223.xsl +17 -0
  1225. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-224.out +9 -0
  1226. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-224.xml +8 -0
  1227. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-224.xsl +28 -0
  1228. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-225.out +2 -0
  1229. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-225.xml +1 -0
  1230. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-225.xsl +32 -0
  1231. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-23-.out +15 -0
  1232. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-23-.xml +21 -0
  1233. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-23-.xsl +20 -0
  1234. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-24-.out +27 -0
  1235. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-24-.xml +2419 -0
  1236. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-24-.xsl +22 -0
  1237. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-25-.out +3 -0
  1238. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-25-.xml +1 -0
  1239. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-25-.xsl +10 -0
  1240. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-26-.out +2 -0
  1241. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-26-.xml +1 -0
  1242. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-26-.xsl +9 -0
  1243. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-27-.out +2 -0
  1244. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-27-.xml +1 -0
  1245. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-27-.xsl +14 -0
  1246. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-28-.out +1 -0
  1247. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-28-.xml +1 -0
  1248. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-28-.xsl +9 -0
  1249. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-29-.ent +7 -0
  1250. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-29-.out +10 -0
  1251. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-29-.xml +5 -0
  1252. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-29-.xsl +16 -0
  1253. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-3-.out +2 -0
  1254. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-3-.xml +1 -0
  1255. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-3-.xsl +13 -0
  1256. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-30-.out +2 -0
  1257. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-30-.xml +1 -0
  1258. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-30-.xsl +7 -0
  1259. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-31-.out +3 -0
  1260. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-31-.xml +4 -0
  1261. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-31-.xsl +10 -0
  1262. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-32-.out +2 -0
  1263. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-32-.xml +1 -0
  1264. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-32-.xsl +17 -0
  1265. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-33-.out +16 -0
  1266. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-33-.xml +14 -0
  1267. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-33-.xsl +29 -0
  1268. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-35-.out +2 -0
  1269. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-35-.xml +1 -0
  1270. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-35-.xsl +10 -0
  1271. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-36-.out +4 -0
  1272. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-36-.xml +5 -0
  1273. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-36-.xsl +8 -0
  1274. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-36-inc.xsl +16 -0
  1275. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-37-.out +4 -0
  1276. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-37-.xml +5 -0
  1277. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-37-.xsl +8 -0
  1278. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-37-inc.xsl +15 -0
  1279. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-38-.out +2 -0
  1280. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-38-.xml +17 -0
  1281. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-38-.xsl +17 -0
  1282. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-39-.out +3 -0
  1283. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-39-.xml +3 -0
  1284. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-39-.xsl +34 -0
  1285. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-4-.out +6 -0
  1286. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-4-.xml +38 -0
  1287. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-4-.xsl +12 -0
  1288. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-40-.out +2 -0
  1289. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-40-.xml +1 -0
  1290. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-40-.xsl +16 -0
  1291. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-41-.out +2 -0
  1292. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-41-.xml +1 -0
  1293. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-41-.xsl +19 -0
  1294. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-42-.out +2 -0
  1295. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-42-.xml +1 -0
  1296. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-42-.xsl +16 -0
  1297. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-43-.out +2 -0
  1298. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-43-.xml +1 -0
  1299. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-43-.xsl +19 -0
  1300. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-44-.out +2 -0
  1301. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-44-.xml +1 -0
  1302. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-44-.xsl +19 -0
  1303. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-45-.out +2 -0
  1304. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-45-.xml +1 -0
  1305. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-45-.xsl +27 -0
  1306. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-46-.out +2 -0
  1307. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-46-.xml +1 -0
  1308. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-46-.xsl +16 -0
  1309. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-47-.out +2 -0
  1310. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-47-.xml +1 -0
  1311. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-47-.xsl +18 -0
  1312. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-48-.out +2 -0
  1313. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-48-.xml +1 -0
  1314. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-48-.xsl +24 -0
  1315. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-49-.out +2 -0
  1316. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-49-.xml +1 -0
  1317. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-49-.xsl +15 -0
  1318. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-5-.out +954 -0
  1319. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-5-.xml +475 -0
  1320. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-5-.xsl +158 -0
  1321. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-50-.out +7 -0
  1322. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-50-.xml +3 -0
  1323. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-50-.xsl +14 -0
  1324. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-52.out +3 -0
  1325. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-52.xml +12 -0
  1326. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-52.xsl +16 -0
  1327. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-53.out +1 -0
  1328. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-53.xml +6 -0
  1329. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-53.xsl +11 -0
  1330. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-54.out +2 -0
  1331. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-54.xml +2 -0
  1332. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-54.xsl +22 -0
  1333. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-55.out +2 -0
  1334. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-55.xml +3 -0
  1335. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-55.xsl +9 -0
  1336. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-56.out +3 -0
  1337. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-56.xml +1 -0
  1338. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-56.xsl +28 -0
  1339. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-57.out +2 -0
  1340. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-57.xml +8 -0
  1341. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-57.xsl +21 -0
  1342. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-58.xsl +274 -0
  1343. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-59.out +2 -0
  1344. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-59.xml +1 -0
  1345. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-59.xsl +9 -0
  1346. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-6-.out +4 -0
  1347. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-6-.xml +6 -0
  1348. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-6-.xsl +32 -0
  1349. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-60.err +2 -0
  1350. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-60.out +2 -0
  1351. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-60.xml +1 -0
  1352. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-60.xsl +15 -0
  1353. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-61.out +10 -0
  1354. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-61.xml +1 -0
  1355. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-61.xsl +14 -0
  1356. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-62-inc.xsl +4 -0
  1357. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-62.out +2 -0
  1358. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-62.xml +1 -0
  1359. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-62.xsl +8 -0
  1360. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-63.out +22 -0
  1361. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-63.xml +13 -0
  1362. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-63.xsl +13 -0
  1363. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-64.out +2 -0
  1364. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-64.xml +1 -0
  1365. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-64.xsl +8 -0
  1366. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-65.ent +7 -0
  1367. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-65.out +8 -0
  1368. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-65.xml +5 -0
  1369. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-65.xsl +26 -0
  1370. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-66.out +2 -0
  1371. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-66.xml +8 -0
  1372. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-66.xsl +12 -0
  1373. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-68.out +1 -0
  1374. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-68.xml +1 -0
  1375. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-68.xsl +8 -0
  1376. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-69.out +2 -0
  1377. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-69.xml +2 -0
  1378. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-69.xsl +12 -0
  1379. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-7-.out +2 -0
  1380. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-7-.xml +3 -0
  1381. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-7-.xsl +11 -0
  1382. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-70.out +9 -0
  1383. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-70.xml +10 -0
  1384. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-70.xsl +13 -0
  1385. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-71.out +2 -0
  1386. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-71.xml +1 -0
  1387. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-71.xsl +17 -0
  1388. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-72.out +6 -0
  1389. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-72.xml +3 -0
  1390. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-72.xsl +31 -0
  1391. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-73.out +3 -0
  1392. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-73.xml +5 -0
  1393. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-73.xsl +17 -0
  1394. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-74.out +2 -0
  1395. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-74.xml +3 -0
  1396. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-74.xsl +12 -0
  1397. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-75.out +6 -0
  1398. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-75.xml +1 -0
  1399. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-75.xsl +9 -0
  1400. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-76.out +4 -0
  1401. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-76.xml +4 -0
  1402. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-76.xsl +16 -0
  1403. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-77.out +5 -0
  1404. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-77.xml +4 -0
  1405. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-77.xsl +18 -0
  1406. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-78.out +3 -0
  1407. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-78.xml +8 -0
  1408. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-78.xsl +17 -0
  1409. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-79.out +5 -0
  1410. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-79.xml +4 -0
  1411. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-79.xsl +4 -0
  1412. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-8-.out +3 -0
  1413. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-8-.xml +5 -0
  1414. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-8-.xsl +13 -0
  1415. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-80.out +2 -0
  1416. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-80.xml +6 -0
  1417. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-80.xsl +29 -0
  1418. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-81.out +4 -0
  1419. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-81.xml +12 -0
  1420. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-81.xsl +18 -0
  1421. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-82.out +5 -0
  1422. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-82.xml +4 -0
  1423. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-82.xsl +12 -0
  1424. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-83.out +1 -0
  1425. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-83.xml +1 -0
  1426. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-83.xsl +14 -0
  1427. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-84.out +15 -0
  1428. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-84.xml +22 -0
  1429. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-84.xsl +14 -0
  1430. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-86.out +6 -0
  1431. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-86.xml +7 -0
  1432. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-86.xsl +7 -0
  1433. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-87.out +5 -0
  1434. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-87.xml +6 -0
  1435. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-87.xsl +16 -0
  1436. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-88.out +2 -0
  1437. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-88.xml +1 -0
  1438. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-88.xsl +6 -0
  1439. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-89.out +12 -0
  1440. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-89.xml +13 -0
  1441. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-89.xsl +105 -0
  1442. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-9-.out +2 -0
  1443. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-9-.xml +3 -0
  1444. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-9-.xsl +10 -0
  1445. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-90.out +13 -0
  1446. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-90.xml +15 -0
  1447. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-90.xsl +35 -0
  1448. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-91.out +3 -0
  1449. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-91.xml +4 -0
  1450. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-91.xsl +8 -0
  1451. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-92.out +15 -0
  1452. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-92.xml +19 -0
  1453. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-92.xsl +19 -0
  1454. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-93-inc.xsl +12 -0
  1455. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-93.out +3 -0
  1456. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-93.xml +1 -0
  1457. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-93.xsl +7 -0
  1458. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-94.out +2 -0
  1459. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-94.xml +9 -0
  1460. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-94.xsl +35 -0
  1461. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-95.out +4 -0
  1462. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-95.xml +5 -0
  1463. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-95.xsl +22 -0
  1464. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-96.out +5 -0
  1465. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-96.xml +5 -0
  1466. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-96.xsl +10 -0
  1467. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-97.out +9 -0
  1468. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-97.xml +16 -0
  1469. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-97.xsl +32 -0
  1470. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-98.out +6 -0
  1471. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-98.xml +10 -0
  1472. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-98.xsl +31 -0
  1473. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-99.out +2 -0
  1474. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-99.xml +1 -0
  1475. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/bug-99.xsl +16 -0
  1476. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/character.out +2 -0
  1477. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/character.xml +23 -0
  1478. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/character.xsl +16 -0
  1479. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/date_add.out +9 -0
  1480. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/date_add.xml +1 -0
  1481. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/date_add.xsl +16 -0
  1482. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/doc.dtd +7 -0
  1483. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/doc.out +16 -0
  1484. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/doc.xml +17 -0
  1485. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/doc.xsl +62 -0
  1486. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/inner.xsl +12 -0
  1487. data/vendor-src/libleptris/test/xslt/libxslt_suite_general/items.xml +34 -0
  1488. data/vendor-src/libleptris/test/xslt/open_cases.txt +0 -0
  1489. data/vendor-src/libleptris/test/xslt/test_libxslt_suite.cpp +398 -0
  1490. data/vendor-src/libleptris/vcpkg.json +29 -0
  1491. data/vendor-src/utf8proc/CMakeLists.txt +133 -0
  1492. data/vendor-src/utf8proc/Doxyfile +2765 -0
  1493. data/vendor-src/utf8proc/LICENSE.md +93 -0
  1494. data/vendor-src/utf8proc/MANIFEST +9 -0
  1495. data/vendor-src/utf8proc/Makefile +203 -0
  1496. data/vendor-src/utf8proc/NEWS.md +479 -0
  1497. data/vendor-src/utf8proc/README.md +143 -0
  1498. data/vendor-src/utf8proc/appveyor.yml +46 -0
  1499. data/vendor-src/utf8proc/bench/Makefile +40 -0
  1500. data/vendor-src/utf8proc/bench/bench.c +56 -0
  1501. data/vendor-src/utf8proc/bench/icu.c +61 -0
  1502. data/vendor-src/utf8proc/bench/unistring.c +60 -0
  1503. data/vendor-src/utf8proc/bench/util.c +39 -0
  1504. data/vendor-src/utf8proc/bench/util.h +22 -0
  1505. data/vendor-src/utf8proc/cmake/utf8proc-config.cmake.in +5 -0
  1506. data/vendor-src/utf8proc/data/Makefile +62 -0
  1507. data/vendor-src/utf8proc/data/Manifest.toml +16 -0
  1508. data/vendor-src/utf8proc/data/Project.toml +2 -0
  1509. data/vendor-src/utf8proc/data/data_generator.jl +498 -0
  1510. data/vendor-src/utf8proc/libutf8proc.pc.cmakein +10 -0
  1511. data/vendor-src/utf8proc/libutf8proc.pc.in +10 -0
  1512. data/vendor-src/utf8proc/lump.md +27 -0
  1513. data/vendor-src/utf8proc/test/app/CMakeLists.txt +6 -0
  1514. data/vendor-src/utf8proc/test/app/app.c +9 -0
  1515. data/vendor-src/utf8proc/test/case.c +76 -0
  1516. data/vendor-src/utf8proc/test/charwidth.c +91 -0
  1517. data/vendor-src/utf8proc/test/custom.c +28 -0
  1518. data/vendor-src/utf8proc/test/fuzz_main.c +54 -0
  1519. data/vendor-src/utf8proc/test/fuzzer.c +97 -0
  1520. data/vendor-src/utf8proc/test/graphemetest.c +136 -0
  1521. data/vendor-src/utf8proc/test/iscase.c +63 -0
  1522. data/vendor-src/utf8proc/test/iterate.c +168 -0
  1523. data/vendor-src/utf8proc/test/maxdecomposition.c +22 -0
  1524. data/vendor-src/utf8proc/test/misc.c +51 -0
  1525. data/vendor-src/utf8proc/test/normtest.c +64 -0
  1526. data/vendor-src/utf8proc/test/ossfuzz.sh +13 -0
  1527. data/vendor-src/utf8proc/test/printproperty.c +68 -0
  1528. data/vendor-src/utf8proc/test/tests.c +60 -0
  1529. data/vendor-src/utf8proc/test/tests.h +27 -0
  1530. data/vendor-src/utf8proc/test/valid.c +41 -0
  1531. data/vendor-src/utf8proc/utf8proc.c +834 -0
  1532. data/vendor-src/utf8proc/utf8proc.h +794 -0
  1533. data/vendor-src/utf8proc/utf8proc_data.c +17141 -0
  1534. data/vendor-src/utf8proc/utils.cmake +20 -0
  1535. metadata +1528 -2
@@ -0,0 +1,2333 @@
1
+ /* lib/src/serialize/serialize.c - XML Serialization Implementation
2
+ * Copyright (c) 2024, Ribose Inc.
3
+ *
4
+ * CRITICAL PRINCIPLES:
5
+ * 1. Character-perfect output - must match input exactly
6
+ * 2. No escaping in CDATA - CDATA content is literal
7
+ * 3. Proper escaping elsewhere - text needs <>&"' escaped
8
+ * 4. Document order - traverse children in correct order
9
+ */
10
+
11
+ #include "serialize.h"
12
+ #include "../include/leptris.h" /* LEPTRIS_API (visibility attribute) */
13
+ #include "../dom/node.h" /* LeptrisNodeVTable + leptris_node_vtable_for */
14
+ #include "../leptris_internal.h"
15
+ #include "../common/entities.h"
16
+ #include "../common/string_view.h"
17
+ #include "../common/simd_text.h"
18
+ /* LeptrisSerializeOptions comes from leptris/types.h via leptris_internal.h's
19
+ * pool.h include. No local redefinition — it would conflict with the
20
+ * public type. */
21
+ #include <string.h>
22
+ #include <stdio.h>
23
+ #include <stdint.h>
24
+ #include <stddef.h>
25
+ #include <ctype.h>
26
+
27
+ /* Initial buffer capacity */
28
+ #define INITIAL_BUFFER_CAPACITY 1024
29
+
30
+ /* ============================================================================
31
+ * Buffer Management
32
+ * ============================================================================ */
33
+
34
+ SerializeBuffer* buffer_create(int indent_spaces) {
35
+ SerializeBuffer* buf = LEPTRIS_ALLOC(SerializeBuffer);
36
+ if (!buf) return NULL;
37
+
38
+ buf->capacity = INITIAL_BUFFER_CAPACITY;
39
+ buf->data = LEPTRIS_ALLOC_N(char, buf->capacity);
40
+ if (!buf->data) {
41
+ LEPTRIS_FREE(buf);
42
+ return NULL;
43
+ }
44
+
45
+ buf->size = 0;
46
+ buf->data[0] = '\0';
47
+ buf->indent = 0;
48
+ buf->indent_spaces = indent_spaces;
49
+ buf->indent_unit = NULL; /* #633: callers opt in per unit string */
50
+ buf->html_method = 0;
51
+ buf->indent_text = 0;
52
+ buf->expand_empty = 0;
53
+ buf->at_line_start = 0;
54
+ /* Leave the xhtml mode OFF until a caller with extended options
55
+ * enables it — an unset flag here otherwise serializes empties as
56
+ * <x></x> wherever the malloc garbage is nonzero (Linux ASAN). */
57
+ buf->xhtml = 0;
58
+ buf->xhtml_encoding = NULL;
59
+ buf->ws_mixed = 0;
60
+ buf->cdata_names = NULL; /* callers with cdata-section-elements
61
+ * install theirs; every other buffer
62
+ * must read "none", not heap garbage */
63
+ buf->cdata_count = 0;
64
+ buf->alloc_failed = 0;
65
+
66
+ return buf;
67
+ }
68
+
69
+ void buffer_ensure_capacity(SerializeBuffer* buf, size_t needed) {
70
+ /* Invariant: buf->size <= buf->capacity. Use subtraction so the
71
+ * remaining-space check can never wrap. */
72
+ if (needed <= buf->capacity - buf->size) return;
73
+
74
+ /* Grow by doubling, overflow-safe. If doubling would exceed SIZE_MAX,
75
+ * clamp to SIZE_MAX — caller's append will fail to find space and the
76
+ * alloc_failed flag will be set. */
77
+ size_t new_cap = buf->capacity > 0 ? buf->capacity : INITIAL_BUFFER_CAPACITY;
78
+ while (new_cap - buf->size < needed) {
79
+ if (new_cap > (SIZE_MAX / 2)) {
80
+ new_cap = SIZE_MAX;
81
+ break;
82
+ }
83
+ new_cap *= 2;
84
+ }
85
+
86
+ /* If we still don't fit (only possible if new_cap == SIZE_MAX and the
87
+ * request is genuinely too large), bail without touching buf->capacity. */
88
+ if (new_cap - buf->size < needed) {
89
+ buf->alloc_failed = 1;
90
+ return;
91
+ }
92
+
93
+ char* new_data = LEPTRIS_REALLOC_N(buf->data, char, new_cap);
94
+ if (!new_data) {
95
+ /* Realloc failed: buf->data and buf->capacity are unchanged
96
+ * (preserves the valid state). Mark the failure so the caller
97
+ * can detect it; subsequent appends will silently truncate. */
98
+ buf->alloc_failed = 1;
99
+ return;
100
+ }
101
+
102
+ buf->data = new_data;
103
+ buf->capacity = new_cap;
104
+ }
105
+
106
+ void buffer_append(SerializeBuffer* buf, const char* str) {
107
+ if (!str) return;
108
+
109
+ size_t len = strlen(str);
110
+ buffer_ensure_capacity(buf, len + 1);
111
+
112
+ memcpy(buf->data + buf->size, str, len);
113
+ buf->size += len;
114
+ buf->data[buf->size] = '\0';
115
+ }
116
+
117
+ void buffer_append_len(SerializeBuffer* buf, const char* str, size_t len) {
118
+ if (!str || len == 0) return;
119
+
120
+ buffer_ensure_capacity(buf, len + 1);
121
+
122
+ memcpy(buf->data + buf->size, str, len);
123
+ buf->size += len;
124
+ buf->data[buf->size] = '\0';
125
+ buf->at_line_start = (len > 0 && str[len - 1] == '\n');
126
+ }
127
+
128
+ void buffer_append_char(SerializeBuffer* buf, char c) {
129
+ buffer_ensure_capacity(buf, 2);
130
+
131
+ buf->data[buf->size++] = c;
132
+ buf->data[buf->size] = '\0';
133
+ buf->at_line_start = (c == '\n');
134
+ }
135
+
136
+ void buffer_append_indent(SerializeBuffer* buf) {
137
+ if (!buf || buf->indent_spaces <= 0) return;
138
+ /* §16.2 html method: newline-only layout — libxml2's HTML dump
139
+ * never nests with spaces. */
140
+ if (buf->html_method) return;
141
+
142
+ if (buf->indent_unit && buf->indent_unit[0]) {
143
+ size_t ul = strlen(buf->indent_unit);
144
+ int levels = buf->indent;
145
+ buffer_ensure_capacity(buf, levels * ul + 1);
146
+ for (int i = 0; i < levels; i++) {
147
+ memcpy(buf->data + buf->size, buf->indent_unit, ul);
148
+ buf->size += ul;
149
+ }
150
+ buf->data[buf->size] = '\0';
151
+ return;
152
+ }
153
+
154
+ int spaces = buf->indent * buf->indent_spaces;
155
+ buffer_ensure_capacity(buf, spaces + 1);
156
+
157
+ for (int i = 0; i < spaces; i++) {
158
+ buf->data[buf->size++] = ' ';
159
+ }
160
+ buf->data[buf->size] = '\0';
161
+ }
162
+
163
+ void buffer_append_newline(SerializeBuffer* buf) {
164
+ if (!buf || buf->indent_spaces <= 0) return;
165
+ /* #129 indent_text collapses consecutive breaks; every other
166
+ * mode keeps the historical (stacking) newline sites — html
167
+ * layout relies on them. */
168
+ if (buf->indent_text && buf->at_line_start) return;
169
+ buffer_append_char(buf, '\n');
170
+ }
171
+
172
+ char* buffer_to_string(SerializeBuffer* buf) {
173
+ if (!buf) return NULL;
174
+
175
+ /* Allocate exact size needed */
176
+ char* result = LEPTRIS_ALLOC_N(char, buf->size + 1);
177
+ if (result) {
178
+ memcpy(result, buf->data, buf->size + 1);
179
+ }
180
+
181
+ return result;
182
+ }
183
+
184
+ void buffer_free(SerializeBuffer* buf) {
185
+ if (buf) {
186
+ if (buf->data) {
187
+ LEPTRIS_FREE(buf->data);
188
+ }
189
+ LEPTRIS_FREE(buf);
190
+ }
191
+ }
192
+
193
+ int buffer_has_error(SerializeBuffer* buf) {
194
+ return buf ? buf->alloc_failed : 1;
195
+ }
196
+
197
+ /* ============================================================================
198
+ * XML Entity Escaping
199
+ * ============================================================================ */
200
+
201
+
202
+ /* Inline escaped-text emitter (TODO 194d): writes into a caller-
203
+ * reserved worst-case buffer (6 bytes per input byte), preserving
204
+ * the entity semantics of the previous per-run walkers — entity
205
+ * references emit as-is (text mode), bare & escapes, quotes are
206
+ * ordinary in text mode and escaped in attribute mode. */
207
+ /* Escape-class table (serialize endgame): the run scan was 3-4
208
+ * compares per byte — the dominant serializer cost at 57% of the
209
+ * text-heavy profile. One indexed load + one test per byte, the
210
+ * same chartype-table shape as the parser (common/chartype.h) and
211
+ * pugixml's g_escape_table. Bit 1 = must escape in text mode
212
+ * (& < >), bit 2 = additional attr-mode chars (" '). */
213
+ static const unsigned char leptris_escape_table[256] = {
214
+ ['&'] = 3, ['<'] = 3, ['>'] = 3,
215
+ ['"'] = 2, ['\''] = 2,
216
+ };
217
+
218
+ /* Long-run threshold (round 20): three SIMD finds cost ~60ns of
219
+ * dispatch; the per-byte table scan reaches that around 256 bytes
220
+ * of run. Text-heavy documents (one multi-hundred-KB text node,
221
+ * no specials) spent their entire serialize time in the per-byte
222
+ * scan — this is the shape the matrix benchmark loses 1.27x on. */
223
+ #define ESCAPE_SIMD_RUN 256
224
+
225
+ static char* emit_escaped_inline(char* out, const char* content,
226
+ size_t len, int attr_mode) {
227
+ unsigned mode = attr_mode ? 3u : 1u;
228
+ /* Control characters escape as numeric references: attributes
229
+ * escape \t \n \r (attribute-value normalization would eat
230
+ * them); text escapes \r (newline translation). libxslt-
231
+ * verified behavior. Rare: pre-scan and take the plain path
232
+ * when absent so the SIMD hot loop is untouched. */
233
+ int has_ctrl = 0;
234
+ for (size_t k = 0; k < len; k++) {
235
+ char c = content[k];
236
+ if (c == '\r' || (attr_mode && (c == '\t' || c == '\n'))) {
237
+ has_ctrl = 1;
238
+ break;
239
+ }
240
+ }
241
+ size_t i = 0;
242
+ if (has_ctrl) {
243
+ while (i < len) {
244
+ char c = content[i];
245
+ if (c == '\r' || (attr_mode && (c == '\t' || c == '\n'))) {
246
+ out += sprintf(out, "&#%d;", (int)(unsigned char)c);
247
+ } else if (c == '&') {
248
+ memcpy(out, "&amp;", 5); out += 5;
249
+ } else if (c == '<') {
250
+ memcpy(out, "&lt;", 4); out += 4;
251
+ } else if (c == '>') {
252
+ memcpy(out, "&gt;", 4); out += 4;
253
+ } else if (attr_mode && c == '"') {
254
+ memcpy(out, "&quot;", 6); out += 6;
255
+ } else if (attr_mode && c == '\'') {
256
+ /* libxml2 leaves apostrophes raw in double-quoted
257
+ * attribute values (bug-86). */
258
+ *out++ = c;
259
+ } else {
260
+ *out++ = c;
261
+ }
262
+ i++;
263
+ }
264
+ return out;
265
+ }
266
+ while (i < len) {
267
+ size_t run = i;
268
+ if (!attr_mode && len - i >= ESCAPE_SIMD_RUN) {
269
+ /* Text mode over a long remainder: SIMD-find the first
270
+ * of & < > (three passes beat one per-byte pass by an
271
+ * order of magnitude at multi-KB lengths). */
272
+ size_t rem = len - i;
273
+ ptrdiff_t h1 = leptris_text_find(&content[i], rem, '&');
274
+ ptrdiff_t h2 = leptris_text_find(&content[i], rem, '<');
275
+ ptrdiff_t h3 = leptris_text_find(&content[i], rem, '>');
276
+ ptrdiff_t best = -1;
277
+ if (h1 >= 0) best = h1;
278
+ if (h2 >= 0 && (best < 0 || h2 < best)) best = h2;
279
+ if (h3 >= 0 && (best < 0 || h3 < best)) best = h3;
280
+ if (best < 0) {
281
+ memcpy(out, &content[i], rem);
282
+ out += rem;
283
+ break;
284
+ }
285
+ run = i + (size_t)best;
286
+ } else {
287
+ while (run < len &&
288
+ !(leptris_escape_table[(unsigned char)content[run]] & mode)) {
289
+ run++;
290
+ }
291
+ }
292
+ if (run > i) {
293
+ memcpy(out, &content[i], run - i);
294
+ out += run - i;
295
+ i = run;
296
+ if (i >= len) break;
297
+ }
298
+
299
+ if (content[i] == '&') {
300
+ size_t j = i + 1;
301
+ int found_semicolon = 0;
302
+ while (j < len && j < i + 12) {
303
+ if (content[j] == ';') { found_semicolon = 1; break; }
304
+ if (!isalnum((unsigned char)content[j]) && content[j] != '#' && content[j] != '-') break;
305
+ j++;
306
+ }
307
+ if (!attr_mode && found_semicolon && j > i + 1) {
308
+ size_t n = j - i + 1;
309
+ memcpy(out, &content[i], n);
310
+ out += n;
311
+ i = j + 1;
312
+ } else {
313
+ memcpy(out, "&amp;", 5);
314
+ out += 5;
315
+ i++;
316
+ }
317
+ continue;
318
+ }
319
+ if (content[i] == '<') { memcpy(out, "&lt;", 4); out += 4; }
320
+ else if (content[i] == '>') { memcpy(out, "&gt;", 4); out += 4; }
321
+ else if (attr_mode && content[i] == '"') { memcpy(out, "&quot;", 6); out += 6; }
322
+ else { *out++ = content[i]; } /* apostrophe: raw (libxml2) */
323
+ i++;
324
+ }
325
+ return out;
326
+ }
327
+
328
+ /* Escape special XML characters in text content.
329
+ * Ordinary-character RUNS are bulk-appended (one capacity check +
330
+ * one memcpy per run) instead of per-character appends — the
331
+ * per-byte path was the serializer's dominant cost (TODO 194). */
332
+ /* ============================================================================
333
+ * Node Serialization Functions
334
+ * ============================================================================ */
335
+
336
+ /* §16.1 cdata-section-elements: does this element's QName match? */
337
+ static int is_cdata_element(SerializeBuffer* buf, LeptrisElement e) {
338
+ if (!buf || !buf->cdata_count || !e) return 0;
339
+ const char* local = leptris_element_get_name(e);
340
+ if (!local) return 0;
341
+ const char* prefix = leptris_element_get_prefix(e);
342
+ int has_pfx = prefix && *prefix;
343
+ char qn[256];
344
+ if (has_pfx)
345
+ snprintf(qn, sizeof(qn), "%s:%s", prefix, local);
346
+ else
347
+ snprintf(qn, sizeof(qn), "%s", local);
348
+ for (size_t i = 0; i < buf->cdata_count; i++) {
349
+ if (!buf->cdata_names[i]) continue;
350
+ if (strcmp(buf->cdata_names[i], qn) == 0) return 1;
351
+ /* An unprefixed entry also matches a no-namespace element. */
352
+ if (!strchr(buf->cdata_names[i], ':') && !has_pfx &&
353
+ strcmp(buf->cdata_names[i], local) == 0) return 1;
354
+ }
355
+ return 0;
356
+ }
357
+
358
+ /* §16.2 HTML element descriptor table (libxml2 html40ElementTable
359
+ * parity, sorted for bsearch). EMPTY mirrors the table's empty flag;
360
+ * INLINE mirrors its isinline flag (values 1 and 2 both inline).
361
+ * Absent elements return 0 — unknown markup never joins the HTML
362
+ * indent decisions. */
363
+ typedef struct {
364
+ const char* name;
365
+ unsigned char flags;
366
+ } HtmlElemFlags;
367
+
368
+ static const HtmlElemFlags kHtmlElems[] = {
369
+ { "a", HTML_F_INLINE }, { "abbr", HTML_F_INLINE },
370
+ { "acronym", HTML_F_INLINE }, { "address", HTML_F_BLOCK },
371
+ { "applet", HTML_F_INLINE }, { "area", HTML_F_EMPTY | HTML_F_BLOCK },
372
+ { "b", HTML_F_INLINE }, { "base", HTML_F_EMPTY | HTML_F_BLOCK },
373
+ { "basefont", HTML_F_EMPTY | HTML_F_INLINE },
374
+ { "bdo", HTML_F_INLINE },
375
+ { "bgsound", HTML_F_EMPTY | HTML_F_BLOCK },
376
+ { "big", HTML_F_INLINE }, { "blockquote", HTML_F_BLOCK },
377
+ { "body", HTML_F_BLOCK },
378
+ { "br", HTML_F_EMPTY | HTML_F_INLINE }, { "button", HTML_F_INLINE },
379
+ { "caption", HTML_F_BLOCK }, { "center", HTML_F_BLOCK },
380
+ { "cite", HTML_F_INLINE },
381
+ { "code", HTML_F_INLINE }, { "col", HTML_F_EMPTY | HTML_F_BLOCK },
382
+ { "colgroup", HTML_F_BLOCK }, { "dd", HTML_F_BLOCK },
383
+ { "del", HTML_F_INLINE },
384
+ { "dfn", HTML_F_INLINE }, { "dir", HTML_F_BLOCK },
385
+ { "div", HTML_F_BLOCK }, { "dl", HTML_F_BLOCK },
386
+ { "dt", HTML_F_BLOCK }, { "em", HTML_F_INLINE },
387
+ { "embed", HTML_F_EMPTY | HTML_F_INLINE },
388
+ { "fieldset", HTML_F_BLOCK },
389
+ { "font", HTML_F_INLINE }, { "form", HTML_F_BLOCK },
390
+ { "frame", HTML_F_EMPTY | HTML_F_BLOCK },
391
+ { "frameset", HTML_F_BLOCK }, { "h1", HTML_F_BLOCK },
392
+ { "h2", HTML_F_BLOCK }, { "h3", HTML_F_BLOCK },
393
+ { "h4", HTML_F_BLOCK }, { "h5", HTML_F_BLOCK },
394
+ { "h6", HTML_F_BLOCK }, { "head", HTML_F_BLOCK },
395
+ { "hr", HTML_F_EMPTY | HTML_F_BLOCK }, { "html", HTML_F_BLOCK },
396
+ { "i", HTML_F_INLINE }, { "iframe", HTML_F_INLINE | HTML_F_RAW },
397
+ { "img", HTML_F_EMPTY | HTML_F_INLINE },
398
+ { "input", HTML_F_EMPTY | HTML_F_INLINE }, { "ins", HTML_F_INLINE },
399
+ { "isindex", HTML_F_EMPTY | HTML_F_BLOCK },
400
+ { "kbd", HTML_F_INLINE },
401
+ { "keygen", HTML_F_EMPTY | HTML_F_BLOCK },
402
+ { "label", HTML_F_INLINE },
403
+ { "legend", HTML_F_BLOCK }, { "li", HTML_F_BLOCK },
404
+ { "link", HTML_F_EMPTY | HTML_F_BLOCK },
405
+ { "map", HTML_F_INLINE }, { "menu", HTML_F_BLOCK },
406
+ { "meta", HTML_F_EMPTY | HTML_F_BLOCK },
407
+ { "noembed", HTML_F_BLOCK | HTML_F_RAW }, { "noframes", HTML_F_BLOCK | HTML_F_RAW },
408
+ { "noscript", HTML_F_BLOCK },
409
+ { "object", HTML_F_INLINE }, { "ol", HTML_F_BLOCK },
410
+ { "optgroup", HTML_F_BLOCK },
411
+ { "option", HTML_F_BLOCK }, { "p", HTML_F_BLOCK },
412
+ { "param", HTML_F_EMPTY | HTML_F_BLOCK },
413
+ { "plaintext", HTML_F_BLOCK | HTML_F_RAW }, { "pre", HTML_F_BLOCK },
414
+ { "q", HTML_F_INLINE }, { "s", HTML_F_INLINE },
415
+ { "samp", HTML_F_INLINE },
416
+ { "script", HTML_F_INLINE | HTML_F_RAW }, { "select", HTML_F_INLINE },
417
+ { "small", HTML_F_INLINE },
418
+ { "source", HTML_F_EMPTY | HTML_F_BLOCK },
419
+ { "span", HTML_F_INLINE }, { "strike", HTML_F_INLINE },
420
+ { "strong", HTML_F_INLINE }, { "style", HTML_F_BLOCK | HTML_F_RAW },
421
+ { "sub", HTML_F_INLINE },
422
+ { "sup", HTML_F_INLINE }, { "table", HTML_F_BLOCK },
423
+ { "tbody", HTML_F_BLOCK },
424
+ { "td", HTML_F_BLOCK }, { "textarea", HTML_F_INLINE },
425
+ { "tfoot", HTML_F_BLOCK },
426
+ { "th", HTML_F_BLOCK }, { "thead", HTML_F_BLOCK },
427
+ { "title", HTML_F_BLOCK }, { "tr", HTML_F_BLOCK },
428
+ { "track", HTML_F_EMPTY | HTML_F_BLOCK }, { "tt", HTML_F_INLINE },
429
+ { "u", HTML_F_INLINE }, { "ul", HTML_F_BLOCK },
430
+ { "var", HTML_F_INLINE },
431
+ { "wbr", HTML_F_EMPTY | HTML_F_BLOCK }, { "xmp", HTML_F_INLINE | HTML_F_RAW },
432
+ };
433
+
434
+ int html_elem_flags(const char* name, size_t len) {
435
+ if (!name || !len) return 0;
436
+ size_t lo = 0, hi = sizeof(kHtmlElems) / sizeof(kHtmlElems[0]);
437
+ while (lo < hi) {
438
+ size_t mid = lo + (hi - lo) / 2;
439
+ int c = strncmp(kHtmlElems[mid].name, name, len);
440
+ if (c == 0 && kHtmlElems[mid].name[len] == '\0')
441
+ return (int)kHtmlElems[mid].flags;
442
+ if (c < 0) lo = mid + 1;
443
+ else hi = mid;
444
+ }
445
+ return 0;
446
+ }
447
+
448
+ /* HTML names are matched case-insensitively; the serializer sees the
449
+ * document's spelling, so lowercase into a bounded scratch first. */
450
+ static int html_elem_flags_ci(const char* name, size_t len) {
451
+ char lower[16];
452
+ if (!name || !len || len >= sizeof(lower)) return 0;
453
+ for (size_t i = 0; i < len; i++)
454
+ lower[i] = (char)tolower((unsigned char)name[i]);
455
+ return html_elem_flags(lower, len);
456
+ }
457
+
458
+ /* HTML element semantics (void/raw/inline/block site rules) apply
459
+ * only to UNPREFIXED names: a namespaced s:img is a foreign
460
+ * element, not the HTML void img — it keeps its close tag and
461
+ * takes no break rules (bug-117). */
462
+ static int html_elem_sem_flags(const LeptrisElement e) {
463
+ if (!e) return 0;
464
+ const char* pfx = leptris_element_get_prefix(e);
465
+ if (pfx && pfx[0]) return 0;
466
+ const char* n = e->name;
467
+ if (!n) return 0;
468
+ size_t nl = (e->name_len != 0xFF) ? (size_t)e->name_len : strlen(n);
469
+ return html_elem_flags_ci(n, nl);
470
+ }
471
+
472
+ /* ---- libxml2 XHTML serialization (xmlsave.c xhtmlNodeDumpOutput) ---- */
473
+
474
+ #define LEPTRIS_XHTML_NS "http://www.w3.org/1999/xhtml"
475
+
476
+ /* xhtmlIsEmpty: exactly these 13 names may minimize as <x /> —
477
+ * deliberately NOT the html-method void table, which carries extra
478
+ * HTML5 names libxml2's XHTML path does not know. */
479
+ static int xhtml_is_empty_name(const char* name, size_t len) {
480
+ static const char k[] = "area\0base\0basefont\0br\0col\0frame\0hr\0"
481
+ "img\0input\0isindex\0link\0meta\0param";
482
+ const char* p = k;
483
+ const char* end = k + sizeof(k) - 1;
484
+ while (p < end) {
485
+ size_t l = (size_t)(end - p);
486
+ const char* z = memchr(p, '\0', l);
487
+ size_t wl = z ? (size_t)(z - p) : l;
488
+ if (wl == len && memcmp(p, name, len) == 0) return 1;
489
+ p += wl + 1;
490
+ }
491
+ return 0;
492
+ }
493
+
494
+ /* libxml2 C.2/C.3: the empty-name rule applies only to no-namespace
495
+ * (or XHTML-namespace) elements. */
496
+ static int xhtml_is_empty_elem(LeptrisElement e, const char* name,
497
+ size_t nl) {
498
+ if (!xhtml_is_empty_name(name, nl)) return 0;
499
+ const char* u = leptris_element_get_namespace_uri(e);
500
+ return u == NULL || strcmp(u, LEPTRIS_XHTML_NS) == 0;
501
+ }
502
+
503
+ static int ser_case_eq(const char* a, const char* b) {
504
+ while (*a && *b) {
505
+ if (tolower((unsigned char)*a) != tolower((unsigned char)*b))
506
+ return 0;
507
+ a++; b++;
508
+ }
509
+ return *a == *b;
510
+ }
511
+
512
+ /* head injects the Content-Type meta unless a child meta already
513
+ * carries http-equiv="Content-Type" (xmlStrcasecmp parity). */
514
+ static int xhtml_head_wants_meta(LeptrisElement head) {
515
+ for (LeptrisNode* m = leptris_node_first_child_internal(
516
+ (LeptrisNode*)head);
517
+ m; m = leptris_node_get_next_sibling(m)) {
518
+ if (m->type != LEPTRIS_NODE_TYPE_ELEMENT) continue;
519
+ LeptrisElement me = (LeptrisElement)m;
520
+ const char* mn = me->name;
521
+ size_t mnl = (me->name_len != 0xFF)
522
+ ? (size_t)me->name_len : (mn ? strlen(mn) : 0);
523
+ if (!mn || mnl != 4 || memcmp(mn, "meta", 4) != 0) continue;
524
+ const char* he = leptris_element_attribute(me, "http-equiv");
525
+ if (he && ser_case_eq(he, "Content-Type")) return 0;
526
+ }
527
+ return 1;
528
+ }
529
+
530
+ static void emit_xhtml_meta(SerializeBuffer* buf) {
531
+ buffer_append(buf, "<meta http-equiv=\"Content-Type\" "
532
+ "content=\"text/html; charset=");
533
+ buffer_append(buf, buf->xhtml_encoding ? buf->xhtml_encoding
534
+ : "UTF-8");
535
+ buffer_append(buf, "\" />");
536
+ }
537
+
538
+ /* §16.2 newline sites (libxml2 htmlNodeDumpInternal parity). The
539
+ * p/pre/param first-byte rule gates the PARENT-side sites only — a
540
+ * block child named p* still takes its after-close newline when its
541
+ * parent allows it. */
542
+ static int html_breaks_block(const char* name, size_t len, int flags) {
543
+ (void)len;
544
+ return (flags & HTML_F_BLOCK) && name != NULL;
545
+ }
546
+
547
+ /* Site 1: newline after this element's opening tag — block element,
548
+ * first child exists and is not text, more than one child. */
549
+ static int html_break_before_children(LeptrisElement elem,
550
+ const char* name, size_t len,
551
+ int flags) {
552
+ if (!html_breaks_block(name, len, flags)) return 0;
553
+ if (name[0] == 'p') return 0;
554
+ LeptrisNode* first =
555
+ leptris_node_first_child_internal((LeptrisNode*)elem);
556
+ if (!first || first->type == LEPTRIS_NODE_TYPE_TEXT) return 0;
557
+ return leptris_node_get_next_sibling(first) != NULL;
558
+ }
559
+
560
+ /* Site 3: newline before this element's closing tag — block element,
561
+ * more than one child, last child is not text. */
562
+ static int html_break_before_close(LeptrisElement elem,
563
+ const char* name, size_t len,
564
+ int flags) {
565
+ if (!html_breaks_block(name, len, flags)) return 0;
566
+ if (name[0] == 'p') return 0;
567
+ LeptrisNode* c =
568
+ leptris_node_first_child_internal((LeptrisNode*)elem);
569
+ if (!c) return 0;
570
+ LeptrisNode* last = c;
571
+ while (leptris_node_get_next_sibling(last))
572
+ last = leptris_node_get_next_sibling(last);
573
+ if (last == c) return 0; /* single child: libxml2 keeps inline */
574
+ return last->type != LEPTRIS_NODE_TYPE_TEXT;
575
+ }
576
+
577
+ /* Site 2/4 (merged): newline after this element's closing tag (or
578
+ * lone void tag) — block element, a non-text next sibling exists,
579
+ * and the parent is not a p* element. */
580
+ static int html_break_after_elem(LeptrisElement elem,
581
+ const char* name, size_t len,
582
+ int flags) {
583
+ if (!html_breaks_block(name, len, flags)) return 0;
584
+ LeptrisNode* next =
585
+ leptris_node_get_next_sibling((LeptrisNode*)elem);
586
+ if (!next || next->type == LEPTRIS_NODE_TYPE_TEXT) return 0;
587
+ LeptrisElement parent = leptris_element_get_parent(elem);
588
+ if (parent && parent->name && parent->name[0] == 'p') return 0;
589
+ return 1;
590
+ }
591
+
592
+ /* Emit the CDATA BODY, splitting "]]>" across section closes. The
593
+ * caller owns the surrounding <![CDATA[ / ]]> brackets (run merging).
594
+ * The close scan runs to len-3 INCLUSIVE — a "]]>" at the very END
595
+ * of the span is a close too (the old j+2<len bound missed it and
596
+ * emitted it raw, terminating the section early — bug-132). */
597
+ static void emit_cdata_body(SerializeBuffer* buf, const char* s, size_t len) {
598
+ size_t i = 0;
599
+ while (i < len) {
600
+ const char* close = NULL;
601
+ for (size_t j = i; j + 3 <= len; j++) {
602
+ if (s[j] == ']' && s[j+1] == ']' && s[j+2] == '>') {
603
+ close = s + j;
604
+ break;
605
+ }
606
+ }
607
+ /* chunk ends after "]]"; the '>' carries into the reopened
608
+ * section (i advances by chunk only). */
609
+ size_t chunk = close ? (size_t)(close - (s + i)) + 2 : len - i;
610
+ buffer_append_len(buf, s + i, chunk);
611
+ if (close) buffer_append(buf, "]]><![CDATA[");
612
+ i += chunk;
613
+ }
614
+ }
615
+
616
+ /* Standalone single-node CDATA emission (fallback sites). */
617
+ static void emit_cdata(SerializeBuffer* buf, const char* s, size_t len) {
618
+ size_t i = 0;
619
+ while (i < len) {
620
+ const char* close = NULL;
621
+ for (size_t j = i; j + 3 <= len; j++) {
622
+ if (s[j] == ']' && s[j+1] == ']' && s[j+2] == '>') {
623
+ close = s + j;
624
+ break;
625
+ }
626
+ }
627
+ /* chunk ends after "]]"; the '>' opens the next section. */
628
+ size_t chunk = close ? (size_t)(close - (s + i)) + 2 : len - i;
629
+ buffer_append(buf, "<![CDATA[");
630
+ buffer_append_len(buf, s + i, chunk);
631
+ buffer_append(buf, "]]>");
632
+ i += chunk;
633
+ }
634
+ }
635
+
636
+ /* libxslt rule: whitespace-only text is never wrapped in CDATA. */
637
+ static int text_is_ws_only(const char* s, size_t len) {
638
+ for (size_t i = 0; i < len; i++) {
639
+ char c = s[i];
640
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\r') return 0;
641
+ }
642
+ return 1;
643
+ }
644
+
645
+ /* Convert one text node's content per §16.1: CDATA unless the text
646
+ * is whitespace-only (libxslt keeps ws plain). */
647
+ static void emit_cdata_checked(SerializeBuffer* buf, const char* s) {
648
+ if (!s) return;
649
+ size_t l = strlen(s);
650
+ if (text_is_ws_only(s, l)) {
651
+ buffer_append_len(buf, s, l);
652
+ return;
653
+ }
654
+ emit_cdata(buf, s, l);
655
+ }
656
+
657
+
658
+ void serialize_text_internal(LeptrisTextNode* text, SerializeBuffer* buf) {
659
+ if (!text) return;
660
+
661
+ /* Materialize + expand entities on first access. For borrowed
662
+ * text nodes (the direct_parse fast path), this expands
663
+ * predefined entities (&amp; → &) and, when a DTD is present
664
+ * on the document, custom entities (&foo; → declared value).
665
+ * Without this call the serializer reads raw borrowed bytes
666
+ * and emits unexpanded entity references. */
667
+ const char* content = leptris_text_get_content(text);
668
+ if (!content) return;
669
+ size_t content_len = text->content_len;
670
+
671
+ /* disable-output-escaping (XSLT §16.4) / method=html script and
672
+ * style content: emit the string-value verbatim — no entity
673
+ * escaping, characters pass through as-is. */
674
+ if (text->base.raw) {
675
+ buffer_append_len(buf, content, content_len);
676
+ return;
677
+ }
678
+
679
+ /* Run-batched (TODO 194b): bulk-append ordinary bytes up to the
680
+ * next special character; the entity lookahead only runs at '&'.
681
+ * Quotes and apostrophes are ordinary in text content. */
682
+ size_t i = 0;
683
+ while (i < content_len) {
684
+ size_t run = i;
685
+ while (run < content_len) {
686
+ char c = content[run];
687
+ if (c == '&' || c == '<' || c == '>') break;
688
+ run++;
689
+ }
690
+ if (run > i) {
691
+ buffer_append_len(buf, &content[i], run - i);
692
+ i = run;
693
+ if (i >= content_len) break;
694
+ }
695
+
696
+ if (content[i] == '&') {
697
+ /* Look ahead for ';' to detect entity reference */
698
+ size_t j = i + 1;
699
+ int found_semicolon = 0;
700
+ while (j < text->content_len && j < i + 12) {
701
+ if (content[j] == ';') {
702
+ found_semicolon = 1;
703
+ break;
704
+ }
705
+ if (!isalnum((unsigned char)content[j]) && content[j] != '#' && content[j] != '-') {
706
+ break;
707
+ }
708
+ j++;
709
+ }
710
+ if (found_semicolon && j > i + 1) {
711
+ buffer_append_len(buf, &content[i], j - i + 1);
712
+ i = j + 1;
713
+ } else {
714
+ buffer_append_len(buf, "&amp;", 5);
715
+ i++;
716
+ }
717
+ continue;
718
+ }
719
+
720
+ if (content[i] == '<') {
721
+ buffer_append_len(buf, "&lt;", 4);
722
+ } else {
723
+ buffer_append_len(buf, "&gt;", 4);
724
+ }
725
+ i++;
726
+ }
727
+ }
728
+
729
+ void serialize_comment_internal(LeptrisCommentNode* comment, SerializeBuffer* buf) {
730
+ if (!comment || !comment->content) return;
731
+
732
+ buffer_append(buf, "<!--");
733
+ buffer_append(buf, comment->content);
734
+ buffer_append(buf, "-->");
735
+ }
736
+
737
+ void serialize_cdata_internal(LeptrisCDATANode* cdata, SerializeBuffer* buf) {
738
+ if (!cdata || !cdata->content) return;
739
+
740
+ buffer_append(buf, "<![CDATA[");
741
+ /* XML 1.0 §2.7: "]]>" cannot appear inside a CDATA section.
742
+ * Content containing the terminator is split across two CDATA
743
+ * sections by rewriting it as "]]]]><![CDATA[>" — the same
744
+ * technique libxml2 uses. Everything else in CDATA is literal. */
745
+ const char* p = cdata->content;
746
+ const char* run_start = p;
747
+ while (*p) {
748
+ if (p[0] == ']' && p[1] == ']' && p[2] == '>') {
749
+ buffer_append_len(buf, run_start, (size_t)(p - run_start));
750
+ buffer_append(buf, "]]]]><![CDATA[>");
751
+ p += 3;
752
+ run_start = p;
753
+ } else {
754
+ p++;
755
+ }
756
+ }
757
+ buffer_append(buf, run_start);
758
+ buffer_append(buf, "]]>");
759
+ }
760
+
761
+ void serialize_pi_internal(LeptrisPINode* pi, SerializeBuffer* buf) {
762
+ if (!pi || !pi->target) return;
763
+
764
+ buffer_append(buf, "<?");
765
+ buffer_append(buf, pi->target);
766
+
767
+ if (pi->data && pi->data[0] != '\0') {
768
+ buffer_append_char(buf, ' ');
769
+ buffer_append(buf, pi->data);
770
+ }
771
+
772
+ /* §16.2: HTML PIs close with '>' — no trailing '?' (libxml2
773
+ * HTMLtree.c). */
774
+ buffer_append(buf, buf->html_method ? ">" : "?>");
775
+ }
776
+
777
+ /* #1094: entity references serialize back as &name; — the name is
778
+ * an entity name, never escaped (escaping would corrupt the ref). */
779
+ void serialize_entity_ref_internal(LeptrisEntityRefNode* ref, SerializeBuffer* buf) {
780
+ if (!ref) return;
781
+ buffer_append(buf, "&");
782
+ if (ref->name) buffer_append(buf, ref->name);
783
+ buffer_append(buf, ";");
784
+ }
785
+
786
+ void serialize_doctype_internal(LeptrisDoctypeNode* doctype, SerializeBuffer* buf) {
787
+ if (!doctype || !doctype->name) return;
788
+
789
+ buffer_append(buf, "<!DOCTYPE ");
790
+ buffer_append(buf, doctype->name);
791
+
792
+ if (doctype->public_id) {
793
+ buffer_append(buf, " PUBLIC \"");
794
+ buffer_append(buf, doctype->public_id);
795
+ buffer_append_char(buf, '"');
796
+
797
+ if (doctype->system_id) {
798
+ buffer_append(buf, " \"");
799
+ buffer_append(buf, doctype->system_id);
800
+ buffer_append_char(buf, '"');
801
+ }
802
+ } else if (doctype->system_id) {
803
+ buffer_append(buf, " SYSTEM \"");
804
+ buffer_append(buf, doctype->system_id);
805
+ buffer_append_char(buf, '"');
806
+ }
807
+
808
+ /* Output internal subset if present */
809
+ if (doctype->internal_subset) {
810
+ /* Trim the source's bracket whitespace, then lay the
811
+ * declarations out libxml2-style: each on its own line
812
+ * (issue #633). Declarations open with '<!' and close with
813
+ * '>', so '><' is the boundary. */
814
+ const char* s = doctype->internal_subset;
815
+ size_t sl = strlen(s);
816
+ while (sl && (s[0] == ' ' || s[0] == '\t' || s[0] == '\n' ||
817
+ s[0] == '\r')) { s++; sl--; }
818
+ while (sl && (s[sl-1] == ' ' || s[sl-1] == '\t' ||
819
+ s[sl-1] == '\n' || s[sl-1] == '\r')) sl--;
820
+ if (sl) {
821
+ buffer_append(buf, " [\n");
822
+ for (size_t i = 0; i < sl; i++) {
823
+ if (i + 1 < sl && s[i] == '>' && s[i + 1] == '<') {
824
+ /* Declaration boundary: line-break after '>';
825
+ * the next '<' prints on the following pass —
826
+ * skipping it dropped every later declaration's
827
+ * opening byte (issue #687). */
828
+ buffer_append_char(buf, '>');
829
+ buffer_append_char(buf, '\n');
830
+ } else {
831
+ buffer_append_char(buf, s[i]);
832
+ }
833
+ }
834
+ buffer_append(buf, "\n]");
835
+ }
836
+ /* Empty subset: no brackets at all (libxml2). */
837
+ }
838
+
839
+ buffer_append_char(buf, '>');
840
+ }
841
+
842
+ /* Emit a qualified element/attribute name: XML requires names in a
843
+ * namespace to serialize with their prefix (prefix:name). libleptris
844
+ * stores the prefix beside the local name, so every name-emission
845
+ * site routes through this helper. */
846
+ static void append_qualified_name(SerializeBuffer* buf, const char* prefix,
847
+ const char* name, size_t name_len) {
848
+ if (prefix && prefix[0]) {
849
+ buffer_append(buf, prefix);
850
+ buffer_append_char(buf, ':');
851
+ }
852
+ buffer_append_len(buf, name, name_len);
853
+ }
854
+
855
+ /* Issue #546: rootless documents may still carry document-level
856
+ * nodes. Emit the declaration (if the original had one) and the
857
+ * child chain (no root element exists in it) instead of returning
858
+ * an empty string. */
859
+ static char* serialize_rootless_pis(struct leptris_document* doc,
860
+ const LeptrisSerializeOptions* options) {
861
+ if (!doc || !doc->doc_children_head) return NULL;
862
+ SerializeBuffer* pibuf = buffer_create(0);
863
+ if (!pibuf) return NULL;
864
+ int xml_declaration = options ? options->xml_declaration : 1;
865
+ if (xml_declaration && doc->had_declaration) {
866
+ const char* enc = options && options->encoding
867
+ ? options->encoding
868
+ : (doc->encoding ? doc->encoding : "UTF-8");
869
+ const char* ver = doc->xml_version ? doc->xml_version : "1.0";
870
+ buffer_append(pibuf, "<?xml version=\"");
871
+ buffer_append(pibuf, ver);
872
+ buffer_append(pibuf, "\"");
873
+ if (enc) {
874
+ buffer_append(pibuf, " encoding=\"");
875
+ buffer_append(pibuf, enc);
876
+ buffer_append(pibuf, "\"");
877
+ }
878
+ if (doc->standalone >= 0) {
879
+ buffer_append(pibuf, " standalone=\"");
880
+ buffer_append(pibuf, doc->standalone ? "yes" : "no");
881
+ buffer_append(pibuf, "\"");
882
+ }
883
+ buffer_append(pibuf, "?>");
884
+ }
885
+ /* Document children (issue #580): comment/PI nodes in document
886
+ * order — the interleaving the old side lists lost. */
887
+ for (LeptrisNode* c = (LeptrisNode*)doc->doc_children_head; c;
888
+ c = leptris_node_get_next_sibling(c)) {
889
+ if (c->type == LEPTRIS_NODE_TYPE_PI) {
890
+ LeptrisPINode* pi = (LeptrisPINode*)c;
891
+ buffer_append(pibuf, "<?");
892
+ if (pi->target) buffer_append(pibuf, pi->target);
893
+ if (pi->data && pi->data[0]) {
894
+ buffer_append_char(pibuf, ' ');
895
+ buffer_append(pibuf, pi->data);
896
+ }
897
+ buffer_append(pibuf, "?>");
898
+ } else if (c->type == LEPTRIS_NODE_TYPE_COMMENT) {
899
+ buffer_append(pibuf, "<!--");
900
+ buffer_append(pibuf,
901
+ leptris_comment_get_content((LeptrisCommentNode*)c));
902
+ buffer_append(pibuf, "-->");
903
+ }
904
+ }
905
+ char* out = buffer_to_string(pibuf);
906
+ buffer_free(pibuf);
907
+ return out;
908
+ }
909
+
910
+ #define SER_WALK_STACK_MAX 512
911
+
912
+ typedef struct { LeptrisElement e; size_t nl; int mixed; int cd_open;
913
+ int close_brk; char* cd_buf; size_t cd_len, cd_cap; } SerFrame;
914
+
915
+ /* Issue #534: an element whose children include TEXT (non-whitespace)
916
+ * or CDATA is MIXED CONTENT — indenting inside it would change the
917
+ * text on round-trip (inserted whitespace becomes new text nodes on
918
+ * reparse). libxml2 keeps such elements on one line; so do we.
919
+ * Whitespace-only text nodes are formatting artifacts and do NOT
920
+ * count (pretty documents keep indenting). */
921
+ /* XSLT-result variant: WHITESPACE-ONLY text children count —
922
+ * libxslt's serializer stops formatting below any text node
923
+ * (bug-98: the copied source whitespace is the visible indent). */
924
+ static int ser_children_have_any_text(LeptrisNode* fc) {
925
+ for (LeptrisNode* c = fc; c; c = leptris_node_get_next_sibling(c)) {
926
+ if (c->type == LEPTRIS_NODE_TYPE_CDATA) return 1;
927
+ if (c->type == LEPTRIS_NODE_TYPE_TEXT) return 1;
928
+ }
929
+ return 0;
930
+ }
931
+
932
+ static int ser_children_have_text(LeptrisNode* fc) {
933
+ for (LeptrisNode* c = fc; c; c = leptris_node_get_next_sibling(c)) {
934
+ if (c->type == LEPTRIS_NODE_TYPE_CDATA) return 1;
935
+ if (c->type == LEPTRIS_NODE_TYPE_TEXT) {
936
+ LeptrisTextNode* tn = (LeptrisTextNode*)c;
937
+ const char* tc;
938
+ size_t tl;
939
+ if (tn->borrowed && tn->content_len > 0) {
940
+ tc = tn->content;
941
+ tl = tn->content_len;
942
+ } else {
943
+ tc = leptris_text_get_content(tn);
944
+ tl = tc ? tn->content_len : 0;
945
+ }
946
+ for (size_t i = 0; i < tl; i++) {
947
+ if (tc[i] != ' ' && tc[i] != '\t' &&
948
+ tc[i] != '\n' && tc[i] != '\r') {
949
+ return 1;
950
+ }
951
+ }
952
+ }
953
+ }
954
+ return 0;
955
+ }
956
+
957
+ static int ser_frame_cd_append(SerFrame* f, const char* s) {
958
+ if (!f || !s) return 1;
959
+ size_t len = strlen(s);
960
+ if (len == 0) return 1;
961
+ if (f->cd_len + len + 1 > f->cd_cap) {
962
+ size_t cap = f->cd_cap ? f->cd_cap * 2 : 128;
963
+ while (cap < f->cd_len + len + 1) cap *= 2;
964
+ char* grown = (char*)realloc(f->cd_buf, cap);
965
+ if (!grown) return 0;
966
+ f->cd_buf = grown;
967
+ f->cd_cap = cap;
968
+ }
969
+ memcpy(f->cd_buf + f->cd_len, s, len);
970
+ f->cd_len += len;
971
+ f->cd_buf[f->cd_len] = '\0';
972
+ f->cd_open = 1;
973
+ return 1;
974
+ }
975
+
976
+ static void ser_frame_cd_flush(SerializeBuffer* buf, SerFrame* f) {
977
+ if (!f || !f->cd_open) return;
978
+ buffer_append(buf, "<![CDATA[");
979
+ if (f->cd_buf && f->cd_len)
980
+ emit_cdata_body(buf, f->cd_buf, f->cd_len);
981
+ buffer_append(buf, "]]>");
982
+ f->cd_open = 0;
983
+ f->cd_len = 0;
984
+ }
985
+
986
+ static void ser_frames_free(SerFrame* st, int sp) {
987
+ if (!st) return;
988
+ for (int i = 0; i < sp; i++) free(st[i].cd_buf);
989
+ free(st);
990
+ }
991
+
992
+ void serialize_element_internal(LeptrisElement root_elem, SerializeBuffer* buf, int is_root) {
993
+ if (!root_elem || !root_elem->name) return;
994
+
995
+ /* Heap-grown frames (TODO 194e follow-up): a fixed 512-deep
996
+ * array needed a recursive fallback walker that duplicated the
997
+ * whole emission path — every serializer feature landed twice.
998
+ * The frames grow by doubling; the duplicate walker is gone. */
999
+ size_t st_cap = SER_WALK_STACK_MAX;
1000
+ SerFrame* st = (SerFrame*)malloc(st_cap * sizeof(SerFrame));
1001
+ if (!st) return;
1002
+ int sp = 0;
1003
+
1004
+ LeptrisNode* cur = (LeptrisNode*)root_elem;
1005
+ int is_root_cur = is_root;
1006
+
1007
+ int trailing_text_nl = 0;
1008
+ for (;;) {
1009
+ if (cur->type != LEPTRIS_NODE_TYPE_ELEMENT) {
1010
+ /* #534 companion: in pretty mode the formatter owns the
1011
+ * whitespace between elements of a NON-mixed parent —
1012
+ * the source's ws-only text nodes are dropped and
1013
+ * replaced by the canonical newline+indent the open and
1014
+ * close paths already emit. (Before, both were emitted,
1015
+ * doubling the blank lines on every round-trip.) Text
1016
+ * inside a mixed parent is verbatim content: never
1017
+ * dropped. HTML mode prints text verbatim (libxml2 has
1018
+ * no formatter-owned whitespace there). */
1019
+ if (buf->indent_spaces > 0 && !buf->html_method &&
1020
+ cur->type == LEPTRIS_NODE_TYPE_TEXT &&
1021
+ !((sp > 0) && st[sp - 1].mixed)) {
1022
+ LeptrisTextNode* wsn = (LeptrisTextNode*)cur;
1023
+ const char* wsc;
1024
+ size_t wsl;
1025
+ if (wsn->borrowed && wsn->content_len > 0) {
1026
+ wsc = wsn->content;
1027
+ wsl = wsn->content_len;
1028
+ } else {
1029
+ wsc = leptris_text_get_content(wsn);
1030
+ wsl = wsc ? wsn->content_len : 0;
1031
+ }
1032
+ int ws_only = 1;
1033
+ for (size_t i = 0; i < wsl; i++) {
1034
+ if (wsc[i] != ' ' && wsc[i] != '\t' &&
1035
+ wsc[i] != '\n' && wsc[i] != '\r') {
1036
+ ws_only = 0;
1037
+ break;
1038
+ }
1039
+ }
1040
+ if (ws_only) goto advance; /* skip, formatter owns it */
1041
+ }
1042
+ /* #129 indent_text: non-whitespace text sits on its own
1043
+ * indented line (display form — not round-trip). */
1044
+ if (buf->indent_text && buf->indent_spaces > 0 &&
1045
+ cur->type == LEPTRIS_NODE_TYPE_TEXT) {
1046
+ LeptrisTextNode* itn = (LeptrisTextNode*)cur;
1047
+ const char* isc;
1048
+ size_t isl;
1049
+ if (itn->borrowed && itn->content_len > 0) {
1050
+ isc = itn->content; isl = itn->content_len;
1051
+ } else {
1052
+ isc = leptris_text_get_content(itn);
1053
+ isl = isc ? itn->content_len : 0;
1054
+ }
1055
+ int ws_only = 1;
1056
+ for (size_t k = 0; k < isl; k++) {
1057
+ char c = isc[k];
1058
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\r') {
1059
+ ws_only = 0; break;
1060
+ }
1061
+ }
1062
+ if (!ws_only) {
1063
+ buffer_append_newline(buf);
1064
+ buffer_append_indent(buf);
1065
+ /* text ends the line: the next child or the close
1066
+ * tag indents from a fresh line. */
1067
+ trailing_text_nl = 1;
1068
+ }
1069
+ }
1070
+ /* §16.1 cdata-section-elements: text children of a
1071
+ * listed element join ONE CDATA run per consecutive
1072
+ * text span (libxslt merges the section). */
1073
+ int cdata_parent = sp > 0 && st[sp - 1].e &&
1074
+ is_cdata_element(buf, st[sp - 1].e);
1075
+ if ((cur->type == LEPTRIS_NODE_TYPE_TEXT &&
1076
+ !((LeptrisTextNode*)cur)->base.raw) ||
1077
+ (cur->type == LEPTRIS_NODE_TYPE_CDATA)) {
1078
+ if (cdata_parent) {
1079
+ const char* tc =
1080
+ (cur->type == LEPTRIS_NODE_TYPE_CDATA)
1081
+ ? leptris_cdata_get_content(
1082
+ (LeptrisCDATANode*)cur)
1083
+ : leptris_text_get_content(
1084
+ (LeptrisTextNode*)cur);
1085
+ if (tc && !ser_frame_cd_append(&st[sp - 1], tc)) {
1086
+ ser_frames_free(st, sp);
1087
+ return;
1088
+ }
1089
+ goto advance;
1090
+ }
1091
+ if (sp > 0 && st[sp - 1].cd_open)
1092
+ ser_frame_cd_flush(buf, &st[sp - 1]);
1093
+ /* §16.2 rawtext parent: mixed-content text inside
1094
+ * script/style is verbatim under method=html. */
1095
+ if (buf->html_method && sp > 0 && st[sp - 1].e) {
1096
+ const char* rn = st[sp - 1].e->name;
1097
+ if (rn &&
1098
+ (html_elem_sem_flags(st[sp - 1].e) & HTML_F_RAW)) {
1099
+ const char* tr = leptris_text_get_content(
1100
+ (LeptrisTextNode*)cur);
1101
+ if (tr) buffer_append(buf, tr);
1102
+ goto advance;
1103
+ }
1104
+ }
1105
+ serialize_node_internal(cur, buf);
1106
+ if (trailing_text_nl) {
1107
+ buffer_append_newline(buf);
1108
+ trailing_text_nl = 0;
1109
+ }
1110
+ goto advance;
1111
+ }
1112
+ if (sp > 0 && st[sp - 1].cd_open)
1113
+ ser_frame_cd_flush(buf, &st[sp - 1]);
1114
+ /* libxml2 xmlIndentTreeOutput (issue #633): comments and
1115
+ * PIs under a NON-mixed parent get their own indented
1116
+ * line, like element siblings. Mixed-content parents
1117
+ * keep them inline — a PI between text must not move. */
1118
+ if (buf->indent_spaces > 0 && sp > 0 && !st[sp - 1].mixed &&
1119
+ !buf->html_method &&
1120
+ (cur->type == LEPTRIS_NODE_TYPE_COMMENT ||
1121
+ cur->type == LEPTRIS_NODE_TYPE_PI)) {
1122
+ buffer_append_indent(buf);
1123
+ serialize_node_internal(cur, buf);
1124
+ buffer_append_newline(buf);
1125
+ goto advance;
1126
+ }
1127
+ serialize_node_internal(cur, buf);
1128
+ goto advance;
1129
+ }
1130
+
1131
+ LeptrisElement e = (LeptrisElement)cur;
1132
+ /* #534: children of a mixed-content parent emit inline. */
1133
+ int parent_mixed = (sp > 0) && st[sp - 1].mixed;
1134
+ const char* name = e->name;
1135
+ size_t nl = (e->name_len != 0xFF) ? (size_t)e->name_len
1136
+ : strlen(name);
1137
+ const char* epfx = leptris_element_get_prefix(e);
1138
+ size_t epl = (epfx && epfx[0]) ? strlen(epfx) + 1 : 0;
1139
+
1140
+ /* libxml2 addmeta: a head directly under the root html
1141
+ * element injects the Content-Type meta at serialization
1142
+ * time (case-sensitive head/html names, xmlStrEqual). */
1143
+ int addmeta = 0;
1144
+ if (buf->xhtml && sp == 1 && st[0].e &&
1145
+ nl == 4 && memcmp(name, "head", 4) == 0) {
1146
+ const char* rn = st[0].e->name;
1147
+ size_t rnl = (st[0].e->name_len != 0xFF)
1148
+ ? (size_t)st[0].e->name_len
1149
+ : (rn ? strlen(rn) : 0);
1150
+ if (rn && rnl == 4 && memcmp(rn, "html", 4) == 0)
1151
+ addmeta = xhtml_head_wants_meta(e);
1152
+ }
1153
+
1154
+ /* --- total-fusion fast path (TODO 194f): a compact-mode leaf
1155
+ * element with no attributes and no namespaces emits its ENTIRE
1156
+ * `<name>text</name>` from one reservation — the dominant shape
1157
+ * in text-heavy documents paid two reservations + finalize.
1158
+ * RAW parents (html script/style) escape the fusion: their
1159
+ * text is verbatim. */
1160
+ if (buf->indent_text == 0 && !addmeta &&
1161
+ leptris_element_get_first_attribute(e) == NULL &&
1162
+ leptris_elem_namespaces(e) == NULL &&
1163
+ !(buf->html_method &&
1164
+ (html_elem_sem_flags(e) & HTML_F_RAW))) {
1165
+ LeptrisNode* fc0 = leptris_node_first_child_internal((LeptrisNode*)e);
1166
+ if (fc0 && fc0->type == LEPTRIS_NODE_TYPE_TEXT &&
1167
+ leptris_node_get_next_sibling(fc0) == NULL) {
1168
+ /* §16.1 cdata-section-elements wins over the fused
1169
+ * escaped emission. */
1170
+ if (buf->cdata_count && !((LeptrisTextNode*)fc0)->base.raw &&
1171
+ is_cdata_element(buf, e)) {
1172
+ const char* tcd =
1173
+ leptris_text_get_content((LeptrisTextNode*)fc0);
1174
+ buffer_append_char(buf, '<');
1175
+ append_qualified_name(
1176
+ buf, leptris_element_get_prefix(e), name, nl);
1177
+ buffer_append_char(buf, '>');
1178
+ if (tcd)
1179
+ emit_cdata_checked(buf, tcd);
1180
+ buffer_append(buf, "</");
1181
+ append_qualified_name(
1182
+ buf, leptris_element_get_prefix(e),
1183
+ name, nl);
1184
+ buffer_append_char(buf, '>');
1185
+ goto advance;
1186
+ }
1187
+ LeptrisTextNode* tn0 = (LeptrisTextNode*)fc0;
1188
+ /* View-direct (round 18): for entity-free borrowed
1189
+ * text, read the view directly — get_content would
1190
+ * materialize a pool copy (alloc + memcpy) just to
1191
+ * NUL-terminate, which the escaper doesn't need
1192
+ * (it's length-bounded). Entity-bearing text still
1193
+ * materializes for correct expansion. */
1194
+ const char* tc0;
1195
+ size_t tl0;
1196
+ if (tn0->borrowed && tn0->content_len > 0 &&
1197
+ !memchr(tn0->content, '&', tn0->content_len)) {
1198
+ tc0 = tn0->content;
1199
+ tl0 = tn0->content_len;
1200
+ } else {
1201
+ tc0 = leptris_text_get_content(tn0);
1202
+ tl0 = tc0 ? tn0->content_len : 0;
1203
+ }
1204
+ /* Pretty mode fuses newline + indent + open + text +
1205
+ * close into the same single reservation — leaves
1206
+ * otherwise pay ~8 capacity-checked appends each
1207
+ * (the raw-only guard was why pretty trailed). */
1208
+ int pretty0 = buf->indent_spaces > 0 &&
1209
+ !buf->html_method && !parent_mixed;
1210
+ /* HTML mode: zero lead ever; trail follows the
1211
+ * after-close break rule (mixed is not a gate). */
1212
+ int htrail0 = buf->html_method && !is_root_cur &&
1213
+ html_break_after_elem(
1214
+ e, name, nl, html_elem_sem_flags(e));
1215
+ /* #658: honor the indent unit here too — computing
1216
+ * indent*indent_spaces directly lost the unit on
1217
+ * every fused leaf (buffer_append_indent's #633
1218
+ * branch never ran). */
1219
+ const char* iunit =
1220
+ (buf->indent_unit && buf->indent_unit[0])
1221
+ ? buf->indent_unit : NULL;
1222
+ size_t iul = iunit ? strlen(iunit) : 0;
1223
+ int ilevels = (!is_root_cur && pretty0)
1224
+ ? buf->indent : 0;
1225
+ int lead = ilevels
1226
+ ? (iunit ? (int)(ilevels * iul)
1227
+ : buf->indent * buf->indent_spaces)
1228
+ : 0;
1229
+ int trail = htrail0 ||
1230
+ (pretty0 && !is_root_cur);
1231
+ buffer_ensure_capacity(
1232
+ buf, (size_t)(lead + trail) + 2 * (epl + nl) + 6 * tl0 + 6);
1233
+ char* q = buf->data + buf->size;
1234
+ if (lead) {
1235
+ if (iunit) {
1236
+ for (int i = 0; i < ilevels; i++) {
1237
+ memcpy(q, iunit, iul);
1238
+ q += iul;
1239
+ }
1240
+ } else {
1241
+ memset(q, ' ', (size_t)lead);
1242
+ q += lead;
1243
+ }
1244
+ }
1245
+ *q++ = '<';
1246
+ if (epl) {
1247
+ memcpy(q, epfx, epl - 1); q += epl - 1;
1248
+ *q++ = ':';
1249
+ }
1250
+ memcpy(q, name, nl); q += nl;
1251
+ *q++ = '>';
1252
+ if (tc0 && tl0) q = emit_escaped_inline(q, tc0, tl0, 0);
1253
+ *q++ = '<'; *q++ = '/';
1254
+ if (epl) {
1255
+ memcpy(q, epfx, epl - 1); q += epl - 1;
1256
+ *q++ = ':';
1257
+ }
1258
+ memcpy(q, name, nl); q += nl;
1259
+ *q++ = '>';
1260
+ if (trail) *q++ = '\n';
1261
+ buf->size = (size_t)(q - buf->data);
1262
+ buf->data[buf->size] = '\0';
1263
+ goto advance;
1264
+ }
1265
+ }
1266
+
1267
+ /* --- open tag (batched, as before) --- */
1268
+ if (!is_root_cur && buf->indent_spaces > 0 && !parent_mixed)
1269
+ buffer_append_indent(buf);
1270
+ buffer_ensure_capacity(buf, 1 + epl + nl + 1);
1271
+ char* ot = buf->data + buf->size;
1272
+ *ot++ = '<';
1273
+ if (epl) {
1274
+ memcpy(ot, epfx, epl - 1);
1275
+ ot += epl - 1;
1276
+ *ot++ = ':';
1277
+ }
1278
+ memcpy(ot, name, nl);
1279
+ ot += nl;
1280
+ buf->size = (size_t)(ot - buf->data);
1281
+ buf->data[buf->size] = '\0';
1282
+
1283
+ /* --- namespace declarations in CHAIN order (libxml2
1284
+ * serializes the nsDef list verbatim; parse appends in
1285
+ * source order — bug-104 keeps the source's declaration
1286
+ * order, default namespace included). */
1287
+ {
1288
+ for (struct leptris_namespace* ns = leptris_elem_namespaces(e); ns; ns = ns->next) {
1289
+ const char* prefix = ns->prefix ? ns->prefix : "";
1290
+ size_t pnl = ns->prefix ? strlen(ns->prefix) : 0;
1291
+ const char* uri = ns->uri ? ns->uri : "";
1292
+ size_t ul = ns->uri ? strlen(ns->uri) : 0;
1293
+ buffer_ensure_capacity(buf, 7 + pnl + 2 + 6 * ul + 2);
1294
+ char* nw = buf->data + buf->size;
1295
+ *nw++ = ' ';
1296
+ memcpy(nw, "xmlns", 5);
1297
+ nw += 5;
1298
+ if (pnl) { *nw++ = ':'; memcpy(nw, prefix, pnl); nw += pnl; }
1299
+ *nw++ = '=';
1300
+ *nw++ = '"';
1301
+ for (size_t i = 0; i < ul; i++) {
1302
+ switch (uri[i]) {
1303
+ case '<': memcpy(nw, "&lt;", 4); nw += 4; break;
1304
+ case '>': memcpy(nw, "&gt;", 4); nw += 4; break;
1305
+ case '&': memcpy(nw, "&amp;", 5); nw += 5; break;
1306
+ case '"': memcpy(nw, "&quot;", 6); nw += 6; break;
1307
+ case '\'': *nw++ = '\''; break; /* raw (libxml2) */
1308
+ default: *nw++ = uri[i]; break;
1309
+ }
1310
+ }
1311
+ *nw++ = '"';
1312
+ buf->size = (size_t)(nw - buf->data);
1313
+ buf->data[buf->size] = '\0';
1314
+ }
1315
+ }
1316
+
1317
+ /* libxml2 xmlsave: an element in NO namespace whose nearest
1318
+ * default-ns DECLARATION on the ancestor chain binds non-empty
1319
+ * must reset it with xmlns="" or the element would inherit
1320
+ * that namespace (bug-130's imported-module <div> under a
1321
+ * default-namespaced <html>). Parsed documents resolve
1322
+ * inherited namespaces onto the element, so only
1323
+ * namespace-less result elements reach this. */
1324
+ if (!epl) {
1325
+ const char* ens = leptris_element_get_namespace_uri(e);
1326
+ if (!ens || !ens[0]) {
1327
+ int own_default = 0;
1328
+ for (struct leptris_namespace* ns = leptris_elem_namespaces(e);
1329
+ ns; ns = ns->next)
1330
+ if (!ns->prefix || !ns->prefix[0]) { own_default = 1; break; }
1331
+ if (!own_default) {
1332
+ int reset_needed = 0;
1333
+ for (int f = (int)sp - 1; f >= 0; f--) {
1334
+ LeptrisElement ae = st[f].e;
1335
+ if (!ae) continue;
1336
+ int decided = 0;
1337
+ for (struct leptris_namespace* ns =
1338
+ leptris_elem_namespaces(ae);
1339
+ ns; ns = ns->next) {
1340
+ if (!ns->prefix || !ns->prefix[0]) {
1341
+ reset_needed = ns->uri && ns->uri[0];
1342
+ decided = 1;
1343
+ break;
1344
+ }
1345
+ }
1346
+ if (decided) break;
1347
+ }
1348
+ if (reset_needed)
1349
+ buffer_append(buf, " xmlns=\"\"");
1350
+ }
1351
+ }
1352
+ }
1353
+
1354
+ /* libxml2 3.1.1: an <html> in no namespace with no local ns
1355
+ * declarations gets the XHTML namespace injected. */
1356
+ if (buf->xhtml && !epl && leptris_elem_namespaces(e) == NULL &&
1357
+ leptris_element_get_namespace_uri(e) == NULL &&
1358
+ nl == 4 && memcmp(name, "html", 4) == 0)
1359
+ buffer_append(buf, " xmlns=\"" LEPTRIS_XHTML_NS "\"");
1360
+
1361
+ /* --- namespaces (identical emission) --- */
1362
+ for (struct leptris_attribute* attr = leptris_element_get_first_attribute(e); attr; attr = leptris_attr_next(attr)) {
1363
+ const char* val;
1364
+ if (attr_has_entities(attr)) {
1365
+ struct leptris_document* d = leptris_element_get_document(e);
1366
+ LeptrisMemoryPool* pool = d ? d->pool : NULL;
1367
+ LeptrisStringView av = leptris_attr_value_sv(attr);
1368
+ char* resolved = pool
1369
+ ? leptris_decode_entities_view(&av, pool) : NULL;
1370
+ if (resolved) {
1371
+ leptris_attr_value_set_heap(attr, leptris_sv_from_cstr(resolved));
1372
+ attr_set_entities(attr, 0);
1373
+ }
1374
+ val = attr_cvalue(attr);
1375
+ } else {
1376
+ val = attr_cvalue(attr);
1377
+ }
1378
+ const char* name_c = attr_cname(attr);
1379
+ size_t anl = attr->name_view.length;
1380
+ const char* apfx = attr_get_prefix(attr);
1381
+ size_t apl = (apfx && apfx[0]) ? strlen(apfx) + 1 : 0;
1382
+ /* Issue #542: name_view carries the QUALIFIED name —
1383
+ * when the prefix is emitted separately, skip its bytes
1384
+ * so the prefix is not doubled (ns:ns:attr). */
1385
+ if (apl && anl > apl &&
1386
+ memcmp(name_c, apfx, apl - 1) == 0 && name_c[apl - 1] == ':') {
1387
+ name_c += apl;
1388
+ anl -= apl;
1389
+ }
1390
+ /* View length is authoritative (entity resolution
1391
+ * replaces the view) — same as the recursive path. */
1392
+ size_t vlen = leptris_attr_value_sv(attr).length;
1393
+ /* §16.2 html: href/src values percent-encode as URIs
1394
+ * (libxml2 htmlAttrDumpOutput, bug-83); apostrophes
1395
+ * stay raw (the XML serializer's &apos; is HTML-wrong). */
1396
+ int html_uri_attr = 0;
1397
+ if (buf->html_method && anl &&
1398
+ ((anl == 4 && memcmp(name_c, "href", 4) == 0) ||
1399
+ (anl == 3 && memcmp(name_c, "src", 3) == 0) ||
1400
+ /* libxml2 also URI-encodes name attributes (the
1401
+ * .out for bug-159: name="%D1%91"). */
1402
+ (anl == 4 && memcmp(name_c, "name", 4) == 0)))
1403
+ html_uri_attr = 1;
1404
+ if (html_uri_attr) {
1405
+ buffer_ensure_capacity(
1406
+ buf, 1 + apl + anl + 2 + 3 * vlen + 2 + 1);
1407
+ char* out = buf->data + buf->size;
1408
+ *out++ = ' ';
1409
+ if (apl) {
1410
+ memcpy(out, apfx, apl - 1);
1411
+ out += apl - 1;
1412
+ *out++ = ':';
1413
+ }
1414
+ memcpy(out, name_c, anl);
1415
+ out += anl;
1416
+ *out++ = '=';
1417
+ *out++ = '"';
1418
+ for (size_t i = 0; i < vlen; i++) {
1419
+ unsigned char uc = (unsigned char)val[i];
1420
+ if (uc <= 0x20 || uc >= 0x7f) {
1421
+ /* UTF-8 bytes ≥ 0x80 and ASCII controls/spaces
1422
+ * percent-encode; keep XML-unsafe chars escaped
1423
+ * below for safety. */
1424
+ if (uc == '<' || uc == '>' || uc == '"' ||
1425
+ uc == '&' || uc == '\'') {
1426
+ /* fall into entity handling */
1427
+ } else {
1428
+ out += sprintf(out, "%%%02X", uc);
1429
+ continue;
1430
+ }
1431
+ }
1432
+ switch (val[i]) {
1433
+ case '<': memcpy(out, "&lt;", 4); out += 4; break;
1434
+ case '>': memcpy(out, "&gt;", 4); out += 4; break;
1435
+ case '&': memcpy(out, "&amp;", 5); out += 5; break;
1436
+ case '"': memcpy(out, "&quot;", 6); out += 6; break;
1437
+ case '\'': *out++ = '\''; break;
1438
+ default: *out++ = val[i]; break;
1439
+ }
1440
+ }
1441
+ *out++ = '"';
1442
+ buf->size = (size_t)(out - buf->data);
1443
+ buf->data[buf->size] = '\0';
1444
+ continue;
1445
+ }
1446
+ buffer_ensure_capacity(buf, 1 + apl + anl + 2 + 6 * vlen + 2 + 1);
1447
+ char* out = buf->data + buf->size;
1448
+ *out++ = ' ';
1449
+ if (apl) {
1450
+ memcpy(out, apfx, apl - 1);
1451
+ out += apl - 1;
1452
+ *out++ = ':';
1453
+ }
1454
+ memcpy(out, name_c, anl);
1455
+ out += anl;
1456
+ *out++ = '=';
1457
+ *out++ = '"';
1458
+ for (size_t i = 0; i < vlen; i++) {
1459
+ switch (val[i]) {
1460
+ case '<': memcpy(out, "&lt;", 4); out += 4; break;
1461
+ case '>': memcpy(out, "&gt;", 4); out += 4; break;
1462
+ case '&': memcpy(out, "&amp;", 5); out += 5; break;
1463
+ case '"': memcpy(out, "&quot;", 6); out += 6; break;
1464
+ case '\'':
1465
+ /* Apostrophes stay raw in double-quoted
1466
+ * attribute values (libxml2, bug-86). */
1467
+ *out++ = '\''; break;
1468
+ case '\t':
1469
+ case '\n':
1470
+ /* libxml2's HTML serializer leaves tabs and
1471
+ * newlines RAW in attribute values (bug-5-:
1472
+ * <tr class="\nPROD\n">). XML keeps the
1473
+ * char-ref escapes for round-trip fidelity. */
1474
+ if (buf->html_method) { *out++ = val[i]; break; }
1475
+ out += sprintf(out, val[i] == '\t' ? "&#9;" : "&#10;");
1476
+ break;
1477
+ case '\r': out += sprintf(out, "&#13;"); break;
1478
+ default: *out++ = val[i]; break;
1479
+ }
1480
+ }
1481
+ *out++ = '"';
1482
+ buf->size = (size_t)(out - buf->data);
1483
+ buf->data[buf->size] = '\0';
1484
+ }
1485
+
1486
+ /* --- children --- */
1487
+ LeptrisNode* fc = leptris_node_first_child_internal((LeptrisNode*)e);
1488
+ if (!fc) {
1489
+ /* §16.2 html method: void elements end at '>'; every
1490
+ * other element closes explicitly (never `<x/>`). */
1491
+ if (buf->xhtml) {
1492
+ if (addmeta) {
1493
+ buffer_append_char(buf, '>');
1494
+ if (buf->indent_spaces > 0) {
1495
+ buffer_append_newline(buf);
1496
+ buf->indent++;
1497
+ buffer_append_indent(buf);
1498
+ buf->indent--;
1499
+ }
1500
+ emit_xhtml_meta(buf);
1501
+ if (buf->indent_spaces > 0)
1502
+ buffer_append_newline(buf);
1503
+ buffer_append(buf, "</");
1504
+ append_qualified_name(buf, epfx, name, nl);
1505
+ buffer_append_char(buf, '>');
1506
+ } else if (!epl && xhtml_is_empty_elem(e, name, nl)) {
1507
+ buffer_append(buf, " />");
1508
+ } else {
1509
+ buffer_append(buf, "></");
1510
+ append_qualified_name(buf, epfx, name, nl);
1511
+ buffer_append_char(buf, '>');
1512
+ }
1513
+ if (!is_root_cur && buf->indent_spaces > 0 &&
1514
+ !parent_mixed)
1515
+ buffer_append_newline(buf);
1516
+ goto advance;
1517
+ }
1518
+ if (buf->html_method) {
1519
+ int hf = html_elem_sem_flags(e);
1520
+ if (hf & HTML_F_EMPTY) {
1521
+ buffer_append(buf, ">");
1522
+ } else {
1523
+ buffer_append(buf, "></");
1524
+ append_qualified_name(buf, epfx, name, nl);
1525
+ buffer_append_char(buf, '>');
1526
+ }
1527
+ } else if (buf->expand_empty) {
1528
+ buffer_append(buf, "></");
1529
+ append_qualified_name(buf, epfx, name, nl);
1530
+ buffer_append_char(buf, '>');
1531
+ } else {
1532
+ buffer_append(buf, "/>");
1533
+ }
1534
+ if (!is_root_cur && buf->indent_spaces > 0 &&
1535
+ (buf->html_method
1536
+ ? html_break_after_elem(e, name, nl,
1537
+ html_elem_sem_flags(e))
1538
+ : !parent_mixed))
1539
+ buffer_append_newline(buf);
1540
+ goto advance;
1541
+ }
1542
+ if (buf->indent_text == 0 && !addmeta &&
1543
+ fc->type == LEPTRIS_NODE_TYPE_TEXT &&
1544
+ leptris_node_get_next_sibling(fc) == NULL) {
1545
+ /* text-only element */
1546
+ if (is_cdata_element(buf, e) &&
1547
+ !((LeptrisTextNode*)fc)->base.raw) {
1548
+ buffer_append_char(buf, '>');
1549
+ const char* tcd = leptris_text_get_content(
1550
+ (LeptrisTextNode*)fc);
1551
+ if (tcd)
1552
+ emit_cdata_checked(buf, tcd);
1553
+ buffer_append(buf, "</");
1554
+ append_qualified_name(buf, epfx, name, nl);
1555
+ buffer_append_char(buf, '>');
1556
+ goto advance;
1557
+ }
1558
+ /* §16.2 rawtext elements (script/style/…): the single
1559
+ * text child is VERBATIM under method=html. */
1560
+ if (buf->html_method &&
1561
+ (html_elem_sem_flags(e) & HTML_F_RAW)) {
1562
+ const char* tr = leptris_text_get_content(
1563
+ (LeptrisTextNode*)fc);
1564
+ buffer_append_char(buf, '>');
1565
+ if (tr) buffer_append(buf, tr);
1566
+ buffer_append(buf, "</");
1567
+ append_qualified_name(buf, epfx, name, nl);
1568
+ buffer_append_char(buf, '>');
1569
+ goto advance;
1570
+ }
1571
+ if (buf->indent_spaces == 0) {
1572
+ LeptrisTextNode* tn = (LeptrisTextNode*)fc;
1573
+ const char* tc;
1574
+ size_t tlen;
1575
+ if (tn->borrowed && tn->content_len > 0 &&
1576
+ !memchr(tn->content, '&', tn->content_len)) {
1577
+ tc = tn->content;
1578
+ tlen = tn->content_len;
1579
+ } else {
1580
+ tc = leptris_text_get_content(tn);
1581
+ tlen = tc ? tn->content_len : 0;
1582
+ }
1583
+ buffer_ensure_capacity(buf, 2 + epl + nl + 6 * tlen + 2 + 1);
1584
+ char* te = buf->data + buf->size;
1585
+ *te++ = '>';
1586
+ if (tc && tlen) te = emit_escaped_inline(te, tc, tlen, 0);
1587
+ *te++ = '<'; *te++ = '/';
1588
+ if (epl) {
1589
+ memcpy(te, epfx, epl - 1); te += epl - 1;
1590
+ *te++ = ':';
1591
+ }
1592
+ memcpy(te, name, nl); te += nl;
1593
+ *te++ = '>';
1594
+ buf->size = (size_t)(te - buf->data);
1595
+ buf->data[buf->size] = '\0';
1596
+ } else {
1597
+ buffer_append_char(buf, '>');
1598
+ if (is_cdata_element(buf, e) &&
1599
+ (fc->type == LEPTRIS_NODE_TYPE_TEXT ||
1600
+ fc->type == LEPTRIS_NODE_TYPE_CDATA) &&
1601
+ !((LeptrisTextNode*)fc)->base.raw) {
1602
+ const char* tc2 =
1603
+ leptris_text_get_content((LeptrisTextNode*)fc);
1604
+ if (tc2)
1605
+ emit_cdata_checked(buf, tc2);
1606
+ } else {
1607
+ serialize_node_internal(fc, buf);
1608
+ }
1609
+ buffer_append(buf, "</");
1610
+ append_qualified_name(buf, epfx, name, nl);
1611
+ buffer_append_char(buf, '>');
1612
+ if (buf->html_method) {
1613
+ if (html_break_after_elem(e, name, nl,
1614
+ html_elem_sem_flags(e)))
1615
+ buffer_append_newline(buf);
1616
+ } else if (!is_root_cur && !parent_mixed) {
1617
+ /* is_root guard (#633): the document's last line
1618
+ * carries no trailing newline — the fusion path
1619
+ * already had the guard; this open-tag path (any
1620
+ * element with attributes) did not. */
1621
+ buffer_append_newline(buf);
1622
+ }
1623
+ }
1624
+ goto advance;
1625
+ }
1626
+
1627
+ /* complex children: descend — grow the frame stack at the
1628
+ * cap instead of switching walkers (unbounded depth is safe;
1629
+ * malloc failure truncates rather than recursing). */
1630
+ if ((size_t)sp == st_cap) {
1631
+ size_t nc = st_cap * 2;
1632
+ SerFrame* grown = (SerFrame*)realloc(st, nc * sizeof(SerFrame));
1633
+ if (!grown) {
1634
+ buffer_append_char(buf, '>');
1635
+ buffer_append(buf, "</");
1636
+ append_qualified_name(buf, epfx, name, nl);
1637
+ buffer_append_char(buf, '>');
1638
+ ser_frames_free(st, sp);
1639
+ return;
1640
+ }
1641
+ st = grown;
1642
+ st_cap = nc;
1643
+ }
1644
+
1645
+ /* An element child interrupts any CDATA run of this parent. */
1646
+ if (sp > 0 && st[sp - 1].cd_open)
1647
+ ser_frame_cd_flush(buf, &st[sp - 1]);
1648
+ buffer_append_char(buf, '>');
1649
+ int mixed = 0;
1650
+ int close_brk = 0;
1651
+ if (buf->html_method) {
1652
+ /* §16.2: mixed is not a gate — the site rules own the
1653
+ * newlines. mixed=1 keeps ws-only text verbatim. */
1654
+ mixed = 1;
1655
+ int hf = html_elem_sem_flags(e);
1656
+ if (html_break_before_children(e, name, nl, hf))
1657
+ buffer_append_newline(buf);
1658
+ close_brk = html_break_before_close(e, name, nl, hf);
1659
+ } else {
1660
+ /* #129 indent_text: the formatter owns ALL whitespace —
1661
+ * no element is "mixed" for layout purposes. */
1662
+ if (buf->indent_spaces > 0 && !buf->indent_text)
1663
+ mixed = buf->ws_mixed
1664
+ ? ser_children_have_any_text(fc)
1665
+ : ser_children_have_text(fc);
1666
+ /* libxslt: once an element is mixed, formatting stops
1667
+ * for the whole subtree below it (bug-98) — mixed
1668
+ * inherits down the frame stack. */
1669
+ if (!mixed && sp > 0 && st[sp - 1].mixed) mixed = 1;
1670
+ if (buf->indent_spaces > 0 && !mixed)
1671
+ buffer_append_newline(buf);
1672
+ }
1673
+ if (addmeta) {
1674
+ /* libxml2: the meta leads head's children — indented on
1675
+ * its own line when formatting, inline when not. */
1676
+ if (buf->indent_spaces > 0 && !mixed) {
1677
+ buf->indent++;
1678
+ buffer_append_indent(buf);
1679
+ buf->indent--;
1680
+ emit_xhtml_meta(buf);
1681
+ buffer_append_newline(buf);
1682
+ } else {
1683
+ emit_xhtml_meta(buf);
1684
+ }
1685
+ }
1686
+ st[sp].e = e;
1687
+ st[sp].nl = nl;
1688
+ st[sp].mixed = mixed;
1689
+ st[sp].cd_open = 0;
1690
+ st[sp].cd_buf = NULL;
1691
+ st[sp].cd_len = 0;
1692
+ st[sp].cd_cap = 0;
1693
+ st[sp].close_brk = close_brk;
1694
+ sp++;
1695
+ buf->indent++;
1696
+ cur = fc;
1697
+ is_root_cur = 0;
1698
+ continue;
1699
+
1700
+ advance:
1701
+ /* The walk's root completed (any completion path — close-tag,
1702
+ * leaf fast path, text-only, self-closing). Emit exactly the
1703
+ * caller's subtree: do NOT continue to the root's siblings
1704
+ * (issue #523 — the leak made element serialization both
1705
+ * wrong and O(document)). */
1706
+ if (sp == 0 && (LeptrisNode*)cur == (LeptrisNode*)root_elem) {
1707
+ free(st);
1708
+ return;
1709
+ }
1710
+
1711
+ /* next sibling, else ascend closing frames */
1712
+ for (;;) {
1713
+ LeptrisNode* nsib = leptris_node_get_next_sibling(cur);
1714
+ if (nsib) {
1715
+ cur = nsib;
1716
+ break;
1717
+ }
1718
+ if (sp == 0) { free(st); return; } /* root fully emitted */
1719
+ sp--;
1720
+ buf->indent--;
1721
+ LeptrisElement pe = st[sp].e;
1722
+ if (st[sp].cd_open) /* close this element's CDATA run */
1723
+ ser_frame_cd_flush(buf, &st[sp]);
1724
+ free(st[sp].cd_buf);
1725
+ st[sp].cd_buf = NULL;
1726
+ const char* pn = pe->name;
1727
+ size_t pnl2 = st[sp].nl;
1728
+ const char* pfx2 = leptris_element_get_prefix(pe);
1729
+ /* #534: no indent inside a mixed-content element. HTML
1730
+ * mode: site-3 newline before the close tag, no spaces. */
1731
+ if (buf->html_method) {
1732
+ if (st[sp].close_brk) buffer_append_newline(buf);
1733
+ } else if (buf->indent_spaces > 0 && !st[sp].mixed) {
1734
+ buffer_append_indent(buf);
1735
+ }
1736
+ buffer_append(buf, "</");
1737
+ append_qualified_name(buf, pfx2, pn, pnl2);
1738
+ buffer_append_char(buf, '>');
1739
+ if (buf->indent_spaces > 0 &&
1740
+ !(sp == 0 && (LeptrisNode*)pe == (LeptrisNode*)root_elem && is_root)) {
1741
+ if (buf->html_method) {
1742
+ if (html_break_after_elem(
1743
+ pe, pn, pnl2, html_elem_sem_flags(pe)))
1744
+ buffer_append_newline(buf);
1745
+ } else if (buf->indent_spaces > 0) {
1746
+ /* Formatter-owned separator between element
1747
+ * children — suppressed when the next sibling
1748
+ * is a TEXT node: under a mixed parent its
1749
+ * verbatim content already carries the layout
1750
+ * (libxslt bug-98). */
1751
+ LeptrisNode* nx = leptris_node_get_next_sibling(
1752
+ (LeptrisNode*)pe);
1753
+ if (!nx || nx->type != LEPTRIS_NODE_TYPE_TEXT)
1754
+ buffer_append_newline(buf);
1755
+ }
1756
+ }
1757
+ if (sp == 0 && (LeptrisNode*)pe == (LeptrisNode*)root_elem) {
1758
+ /* The walk's root frame closed. STOP: an element
1759
+ * serialize must emit exactly the caller's subtree —
1760
+ * continuing to the root's siblings leaked every
1761
+ * following element into the output (issue #523:
1762
+ * both the garbage results and the O(document)
1763
+ * per-call cost). */
1764
+ ser_frames_free(st, sp);
1765
+ return;
1766
+ }
1767
+ cur = (LeptrisNode*)pe;
1768
+ }
1769
+ }
1770
+ }
1771
+
1772
+ void serialize_node_internal(LeptrisNode* node, SerializeBuffer* buf) {
1773
+ if (!node) return;
1774
+
1775
+ /* Dispatch via the per-type vtable registry — adding a new node
1776
+ * type is purely additive (register a vtable in node_vtable.c). */
1777
+ const LeptrisNodeVTable* vt = leptris_node_vtable_for(node->type);
1778
+ if (vt && vt->serialize) {
1779
+ vt->serialize(node, buf);
1780
+ }
1781
+ /* Unknown/unregistered type — silently skip (matches old default). */
1782
+ }
1783
+
1784
+ /* ============================================================================
1785
+ * Public API
1786
+ * ============================================================================ */
1787
+
1788
+ char* leptris_serialize_node(LeptrisNode* node) {
1789
+ if (!node) return NULL;
1790
+
1791
+ SerializeBuffer* buf = buffer_create(0); /* Compact mode */
1792
+ if (!buf) return NULL;
1793
+
1794
+ serialize_node_internal(node, buf);
1795
+
1796
+ char* result = buffer_to_string(buf);
1797
+ buffer_free(buf);
1798
+
1799
+ return result;
1800
+ }
1801
+
1802
+ char* leptris_serialize_element(LeptrisElement elem) {
1803
+ if (!elem) return NULL;
1804
+
1805
+ SerializeBuffer* buf = buffer_create(0); /* Compact mode */
1806
+ if (!buf) return NULL;
1807
+
1808
+ serialize_element_internal(elem, buf, 1); /* is_root=1 */
1809
+
1810
+ char* result = buffer_to_string(buf);
1811
+ buffer_free(buf);
1812
+
1813
+ return result;
1814
+ }
1815
+
1816
+ /* ============================================================================
1817
+ * Utility: Serialize with XML Declaration
1818
+ * ============================================================================ */
1819
+
1820
+ char* leptris_serialize_document_with_declaration(LeptrisElement root,
1821
+ const char* encoding,
1822
+ const char* version,
1823
+ int standalone,
1824
+ int has_bom,
1825
+ LeptrisDoctypeNode* doctype) {
1826
+ if (!root) return NULL;
1827
+
1828
+ SerializeBuffer* buf = buffer_create(0); /* Compact mode by default */
1829
+ if (!buf) return NULL;
1830
+
1831
+ /* Output UTF-8 BOM if present in original */
1832
+ if (has_bom) {
1833
+ buffer_append_char(buf, (char)(unsigned char)0xEF);
1834
+ buffer_append_char(buf, (char)(unsigned char)0xBB);
1835
+ buffer_append_char(buf, (char)(unsigned char)0xBF);
1836
+ }
1837
+
1838
+ /* Add XML declaration only if version is provided */
1839
+ if (version) {
1840
+ buffer_append(buf, "<?xml version=\"");
1841
+ buffer_append(buf, version);
1842
+ buffer_append_char(buf, '"');
1843
+
1844
+ if (encoding) {
1845
+ buffer_append(buf, " encoding=\"");
1846
+ buffer_append(buf, encoding);
1847
+ buffer_append_char(buf, '"');
1848
+ }
1849
+
1850
+ if (standalone >= 0) {
1851
+ buffer_append(buf, " standalone=\"");
1852
+ buffer_append(buf, standalone ? "yes" : "no");
1853
+ buffer_append_char(buf, '"');
1854
+ }
1855
+
1856
+ buffer_append(buf, "?>");
1857
+ }
1858
+
1859
+ /* Output DOCTYPE if present */
1860
+ if (doctype) {
1861
+ if (version) {
1862
+ buffer_append_char(buf, '\n');
1863
+ }
1864
+ serialize_doctype_internal(doctype, buf);
1865
+ }
1866
+
1867
+ /* Serialize root element */
1868
+ if (version || doctype) {
1869
+ buffer_append_char(buf, '\n');
1870
+ }
1871
+ serialize_element_internal(root, buf, 1); /* is_root=1 */
1872
+
1873
+ char* result = buffer_to_string(buf);
1874
+ buffer_free(buf);
1875
+
1876
+ return result;
1877
+ }
1878
+ /* ============================================================================
1879
+ * Document Serialization (matches leptris.h public API)
1880
+ * ============================================================================ */
1881
+
1882
+ /* Forward declarations for document structure access */
1883
+ struct leptris_document;
1884
+
1885
+ /* Serialize document with options */
1886
+ /* Full entry: public options + the internal extended settings.
1887
+ * extended==NULL leaves cdata/html off (the public default). */
1888
+ /* #129: public extended options (LeptrisSerializeExtOptions) bridge
1889
+ * onto the internal LeptrisSerializeExtended — one conversion site,
1890
+ * the walker below reads only the SerializeBuffer fields. */
1891
+ LEPTRIS_API char* leptris_document_serialize_ext(
1892
+ struct leptris_document* doc,
1893
+ const LeptrisSerializeOptions* options,
1894
+ const LeptrisSerializeExtOptions* ext) {
1895
+ return leptris_document_serialize_ext_sized(
1896
+ doc, options, ext, ext ? sizeof(*ext) : 0);
1897
+ }
1898
+
1899
+ /* Size-aware entry (issue #644): the ext struct MAY grow, and FFI
1900
+ * callers allocate only the fields they know — reading past their
1901
+ * buffer picked up heap garbage as indent_unit (an MSVC crash in
1902
+ * leptris-ruby). Each field is read only when the caller's buffer
1903
+ * actually covers it. */
1904
+ LEPTRIS_API char* leptris_document_serialize_ext_sized(
1905
+ struct leptris_document* doc,
1906
+ const LeptrisSerializeOptions* options,
1907
+ const LeptrisSerializeExtOptions* ext,
1908
+ size_t ext_size) {
1909
+ LeptrisSerializeExtended internal;
1910
+ memset(&internal, 0, sizeof(internal));
1911
+ if (ext) {
1912
+ if (ext_size >= offsetof(LeptrisSerializeExtOptions, indent_text) +
1913
+ sizeof(int))
1914
+ internal.indent_text = ext->indent_text;
1915
+ if (ext_size >= offsetof(LeptrisSerializeExtOptions, indent_unit) +
1916
+ sizeof(const char*))
1917
+ internal.indent_unit = ext->indent_unit;
1918
+ if (ext_size >= offsetof(LeptrisSerializeExtOptions, expand_empty) +
1919
+ sizeof(int))
1920
+ internal.expand_empty = ext->expand_empty;
1921
+ }
1922
+ return leptris_document_serialize_ex(doc, options, &internal);
1923
+ }
1924
+
1925
+ /* #882: element-level twins of the ext entries — the bridge logic
1926
+ * duplicated here is exactly the document version's (one conversion
1927
+ * site per entry point; the walker reads only buffer fields). */
1928
+ LEPTRIS_API char* leptris_element_serialize_ext(
1929
+ LeptrisElement elem,
1930
+ const LeptrisSerializeOptions* options,
1931
+ const LeptrisSerializeExtOptions* ext) {
1932
+ return leptris_element_serialize_ext_sized(
1933
+ elem, options, ext, ext ? sizeof(*ext) : 0);
1934
+ }
1935
+
1936
+ LEPTRIS_API char* leptris_element_serialize_ext_sized(
1937
+ LeptrisElement elem,
1938
+ const LeptrisSerializeOptions* options,
1939
+ const LeptrisSerializeExtOptions* ext,
1940
+ size_t ext_size) {
1941
+ LeptrisSerializeExtended internal;
1942
+ memset(&internal, 0, sizeof(internal));
1943
+ if (ext) {
1944
+ if (ext_size >= offsetof(LeptrisSerializeExtOptions, indent_text) +
1945
+ sizeof(int))
1946
+ internal.indent_text = ext->indent_text;
1947
+ if (ext_size >= offsetof(LeptrisSerializeExtOptions, indent_unit) +
1948
+ sizeof(const char*))
1949
+ internal.indent_unit = ext->indent_unit;
1950
+ if (ext_size >= offsetof(LeptrisSerializeExtOptions, expand_empty) +
1951
+ sizeof(int))
1952
+ internal.expand_empty = ext->expand_empty;
1953
+ }
1954
+ return leptris_element_serialize_ex(elem, options, &internal);
1955
+ }
1956
+
1957
+ /* Element-level twin of leptris_document_serialize_ex: the XSLT
1958
+ * layer serializes a result FRAGMENT's top-level elements one by
1959
+ * one (bug-90) — without this entry they lost cdata-section-elements,
1960
+ * html and xhtml semantics, which the public options struct cannot
1961
+ * carry (#568). */
1962
+ char* leptris_element_serialize_ex(LeptrisElement elem,
1963
+ const LeptrisSerializeOptions* options,
1964
+ const LeptrisSerializeExtended* extended) {
1965
+ if (!elem) return NULL;
1966
+ int indent_spaces = options ? options->indent : 0;
1967
+ SerializeBuffer* buf = buffer_create(indent_spaces);
1968
+ if (!buf) return NULL;
1969
+ if (extended) {
1970
+ buf->cdata_names = extended->cdata_elements;
1971
+ buf->cdata_count = extended->cdata_element_count;
1972
+ buf->html_method = extended->html_method != 0;
1973
+ buf->indent_text = extended->indent_text != 0;
1974
+ buf->expand_empty = extended->expand_empty != 0;
1975
+ buf->indent_unit = extended->indent_unit;
1976
+ buf->ws_mixed = extended->ws_mixed != 0;
1977
+ buf->xhtml = extended->xhtml != 0;
1978
+ buf->xhtml_encoding = options && options->encoding
1979
+ ? options->encoding : "UTF-8";
1980
+ }
1981
+ serialize_element_internal(elem, buf, 1);
1982
+ char* result = buffer_to_string(buf);
1983
+ buffer_free(buf);
1984
+ return result;
1985
+ }
1986
+
1987
+ char* leptris_document_serialize_ex(struct leptris_document* doc,
1988
+ const LeptrisSerializeOptions* options,
1989
+ const LeptrisSerializeExtended* extended) {
1990
+ if (!doc) return NULL;
1991
+
1992
+ /* FlatDoc serialize fast path removed — direct_parse builds the
1993
+ * LeptrisElement tree eagerly. Serialization always walks the DOM. */
1994
+
1995
+ /* Get root element from new_dom_root field */
1996
+ /* TODO 139 Phase D: trigger lazy promote if the doc was produced
1997
+ * by the flat-parse fast path. */
1998
+ leptris_document_ensure_promoted(doc);
1999
+ LeptrisElement root = (LeptrisElement)doc->new_dom_root;
2000
+ if (!root) {
2001
+ char* rootless = serialize_rootless_pis(doc, options);
2002
+ if (rootless) return rootless;
2003
+ return NULL;
2004
+ }
2005
+
2006
+ /* Use default options if NULL */
2007
+ int xml_declaration = 0;
2008
+ int indent_spaces = 0;
2009
+ const char* encoding = NULL;
2010
+
2011
+ if (options) {
2012
+ xml_declaration = options->xml_declaration;
2013
+ indent_spaces = options->indent;
2014
+ encoding = options->encoding;
2015
+ }
2016
+
2017
+ /* Create buffer with indent support */
2018
+ SerializeBuffer* buf = buffer_create(indent_spaces);
2019
+ if (!buf) return NULL;
2020
+ if (extended) {
2021
+ buf->cdata_names = extended->cdata_elements;
2022
+ buf->cdata_count = extended->cdata_element_count;
2023
+ /* §16.2: html semantics (void elements, attr escaping, raw
2024
+ * text, PI form) apply whenever the method is html — also
2025
+ * with indent="no". The newline LAYOUT self-gates: every
2026
+ * html break site goes through buffer_append_newline, which
2027
+ * is a no-op at indent_spaces == 0. */
2028
+ buf->html_method = extended->html_method != 0;
2029
+ buf->indent_text = extended->indent_text != 0;
2030
+ buf->expand_empty = extended->expand_empty != 0;
2031
+ buf->indent_unit = extended->indent_unit;
2032
+ buf->ws_mixed = extended->ws_mixed != 0;
2033
+ buf->xhtml = extended->xhtml != 0;
2034
+ buf->xhtml_encoding = encoding ? encoding : "UTF-8";
2035
+ }
2036
+
2037
+ /* Output UTF-8 BOM if present in original */
2038
+ if (doc->has_bom) {
2039
+ buffer_append_char(buf, (char)(unsigned char)0xEF);
2040
+ buffer_append_char(buf, (char)(unsigned char)0xBB);
2041
+ buffer_append_char(buf, (char)(unsigned char)0xBF);
2042
+ }
2043
+
2044
+ /* Add XML declaration if requested or if doc had one */
2045
+ const char* xml_version = doc->xml_version;
2046
+ int standalone = doc->standalone;
2047
+
2048
+ /* If xml_declaration is explicitly requested but doc has no version,
2049
+ * fall back to XML 1.0 with no standalone attribute. */
2050
+ if (xml_declaration && !xml_version) {
2051
+ xml_version = "1.0";
2052
+ standalone = -1;
2053
+ }
2054
+
2055
+ if ((xml_declaration || (doc->had_declaration && xml_version)) && xml_version) {
2056
+ buffer_append(buf, "<?xml version=\"");
2057
+ buffer_append(buf, xml_version);
2058
+ buffer_append_char(buf, '"');
2059
+
2060
+ /* TODO.bindings/06: with iconv (default build) the body was
2061
+ * transcoded to UTF-8 at parse time — the declaration says
2062
+ * so, always. Without iconv, bytes pass through unchanged:
2063
+ * echoing the original encoding stays truthful. Either way
2064
+ * the declaration never lies, and serialize(serialize(x))
2065
+ * is byte-stable. */
2066
+ const char* enc = encoding ? encoding : doc->encoding;
2067
+ if (enc) {
2068
+ buffer_append(buf, " encoding=\"");
2069
+ if (doc->decl_encoding_verbatim ||
2070
+ (extended && extended->decl_encoding_verbatim &&
2071
+ options && options->encoding) ||
2072
+ (enc[0] == 'U' || enc[0] == 'u')) {
2073
+ /* Verbatim: a UTF-8-spelled name; an explicit
2074
+ * request from a caller that transcodes the body to
2075
+ * match (the XSLT layer, bug-140); or a document
2076
+ * whose encoding was DECLARED programmatically
2077
+ * (#1094 set_encoding — the body was never
2078
+ * transcoded, re-spelling would lie). The parse-
2079
+ * echo fallback below only applies to encodings
2080
+ * inherited from a parsed document. */
2081
+ buffer_append(buf, enc);
2082
+ #ifdef LEPTRIS_HAS_ICONV
2083
+ } else if (enc[0]) {
2084
+ buffer_append(buf, "UTF-8");
2085
+ }
2086
+ #else
2087
+ } else {
2088
+ /* No iconv: bytes pass through unchanged at parse —
2089
+ * echoing the source encoding stays truthful. */
2090
+ buffer_append(buf, enc);
2091
+ }
2092
+ #endif
2093
+ buffer_append_char(buf, '"');
2094
+ }
2095
+
2096
+ if (standalone >= 0) {
2097
+ buffer_append(buf, " standalone=\"");
2098
+ buffer_append(buf, standalone ? "yes" : "no");
2099
+ buffer_append_char(buf, '"');
2100
+ }
2101
+
2102
+ buffer_append(buf, "?>");
2103
+
2104
+ /* Add newline after declaration if indenting */
2105
+ if (indent_spaces > 0) {
2106
+ buffer_append_newline(buf);
2107
+ }
2108
+ }
2109
+
2110
+ /* Output DOCTYPE if present */
2111
+ if (doc->doctype) {
2112
+ serialize_doctype_internal((LeptrisDoctypeNode*)doc->doctype, buf);
2113
+ if (indent_spaces > 0) {
2114
+ buffer_append_newline(buf);
2115
+ }
2116
+ }
2117
+
2118
+ /* Document-level nodes (issue #580): the child chain in document
2119
+ * order — prolog nodes before the root, the root itself
2120
+ * serialized below, epilog nodes after. The single chain keeps
2121
+ * comment/PI interleaving the old side lists lost. */
2122
+ LeptrisNode* doc_root_node = (LeptrisNode*)root;
2123
+ for (LeptrisNode* c = (LeptrisNode*)doc->doc_children_head; c;
2124
+ c = leptris_node_get_next_sibling(c)) {
2125
+ if (c == doc_root_node) break;
2126
+ if (c->type == LEPTRIS_NODE_TYPE_PI) {
2127
+ LeptrisPINode* pi = (LeptrisPINode*)c;
2128
+ buffer_append(buf, "<?");
2129
+ if (pi->target) buffer_append(buf, pi->target);
2130
+ if (pi->data && pi->data[0]) {
2131
+ buffer_append_char(buf, ' ');
2132
+ buffer_append(buf, pi->data);
2133
+ }
2134
+ buffer_append(buf, "?>");
2135
+ if (indent_spaces > 0) {
2136
+ buffer_append_newline(buf);
2137
+ }
2138
+ } else if (c->type == LEPTRIS_NODE_TYPE_COMMENT) {
2139
+ buffer_append(buf, "<!--");
2140
+ buffer_append(buf,
2141
+ leptris_comment_get_content((LeptrisCommentNode*)c));
2142
+ buffer_append(buf, "-->");
2143
+ if (indent_spaces > 0) {
2144
+ buffer_append_newline(buf);
2145
+ }
2146
+ } else if (c->type == LEPTRIS_NODE_TYPE_TEXT) {
2147
+ /* Top-level text (copied source whitespace between
2148
+ * prolog nodes — bug-195) emits verbatim. */
2149
+ const char* tc =
2150
+ leptris_text_get_content((LeptrisTextNode*)c);
2151
+ if (tc) buffer_append(buf, tc);
2152
+ }
2153
+ }
2154
+
2155
+ /* Serialize root element */
2156
+ serialize_element_internal(root, buf, 1); /* is_root=1 */
2157
+
2158
+ /* Epilog: the chain nodes AFTER the root element. Gated on the
2159
+ * #580 chain — result-fragment documents chain top-level nodes
2160
+ * as root siblings WITHOUT a doc_children chain, and their
2161
+ * serializer (xslt_public) owns that walk. */
2162
+ if (doc->doc_children_head) {
2163
+ for (LeptrisNode* c = leptris_node_get_next_sibling(doc_root_node); c;
2164
+ c = leptris_node_get_next_sibling(c)) {
2165
+ if (c->type == LEPTRIS_NODE_TYPE_PI) {
2166
+ LeptrisPINode* pi = (LeptrisPINode*)c;
2167
+ buffer_append(buf, "<?");
2168
+ if (pi->target) buffer_append(buf, pi->target);
2169
+ if (pi->data && pi->data[0]) {
2170
+ buffer_append_char(buf, ' ');
2171
+ buffer_append(buf, pi->data);
2172
+ }
2173
+ buffer_append(buf, "?>");
2174
+ if (indent_spaces > 0) {
2175
+ buffer_append_newline(buf);
2176
+ }
2177
+ } else if (c->type == LEPTRIS_NODE_TYPE_COMMENT) {
2178
+ buffer_append(buf, "<!--");
2179
+ buffer_append(buf,
2180
+ leptris_comment_get_content((LeptrisCommentNode*)c));
2181
+ buffer_append(buf, "-->");
2182
+ if (indent_spaces > 0) {
2183
+ buffer_append_newline(buf);
2184
+ }
2185
+ } else if (c->type == LEPTRIS_NODE_TYPE_TEXT) {
2186
+ const char* tc =
2187
+ leptris_text_get_content((LeptrisTextNode*)c);
2188
+ if (tc) buffer_append(buf, tc);
2189
+ }
2190
+ }
2191
+ }
2192
+
2193
+ char* result = buffer_to_string(buf);
2194
+ buffer_free(buf);
2195
+
2196
+ return result;
2197
+ }
2198
+
2199
+ /* Public entry (ABI-frozen options only — issue #568): reads
2200
+ * exclusively the three frozen fields; cdata/html stay off. */
2201
+ LEPTRIS_API char* leptris_document_serialize(struct leptris_document* doc,
2202
+ const LeptrisSerializeOptions* options) {
2203
+ return leptris_document_serialize_ex(doc, options, NULL);
2204
+ }
2205
+
2206
+
2207
+ /* ============================================================================
2208
+ * Element Serialization (matches leptris.h public API)
2209
+ * ============================================================================ */
2210
+
2211
+ /* Serialize element subtree to XML string */
2212
+ LEPTRIS_API char* leptris_element_serialize(LeptrisElement elem,
2213
+ const LeptrisSerializeOptions* options) {
2214
+ if (!elem) return NULL;
2215
+
2216
+ int indent_spaces = 0;
2217
+ if (options) {
2218
+ indent_spaces = options->indent;
2219
+ }
2220
+
2221
+ SerializeBuffer* buf = buffer_create(indent_spaces);
2222
+ if (!buf) return NULL;
2223
+
2224
+ serialize_element_internal(elem, buf, 1); /* is_root=1 */
2225
+
2226
+ char* result = buffer_to_string(buf);
2227
+ buffer_free(buf);
2228
+
2229
+ return result;
2230
+ }
2231
+
2232
+ /* Issue #541: mem-cache the serialized string so the size-query
2233
+ * + into-call pattern reuses a single serialization. */
2234
+ static int ser_cache_valid(const struct leptris_document* doc,
2235
+ const LeptrisSerializeOptions* options) {
2236
+ if (!doc->ser_cache) return 0;
2237
+ if (doc->ser_version != doc->ser_cache_version) return 0;
2238
+ int text = options ? !options->xml_declaration : 1;
2239
+ int omit = options ? !options->xml_declaration : 0;
2240
+ int indent = options ? !!options->indent : 0;
2241
+ return text == doc->ser_cache_text && omit == doc->ser_cache_omit &&
2242
+ indent == doc->ser_cache_indent;
2243
+ }
2244
+
2245
+ LEPTRIS_API size_t leptris_document_serialize_into(LeptrisDocument doc,
2246
+ char* buf,
2247
+ size_t capacity,
2248
+ size_t* out_len,
2249
+ const LeptrisSerializeOptions* options) {
2250
+ if (!doc) return 0;
2251
+ if (ser_cache_valid(doc, options)) {
2252
+ size_t need = doc->ser_cache_len + 1;
2253
+ if (buf && capacity >= need) {
2254
+ memcpy(buf, doc->ser_cache, need);
2255
+ }
2256
+ /* #550: the sizing pass (buf NULL / too small) reports the
2257
+ * needed length through out_len too — callers allocate from
2258
+ * it. The cached path previously left it untouched. */
2259
+ if (out_len) *out_len = doc->ser_cache_len;
2260
+ return need;
2261
+ }
2262
+ char* tmp = leptris_document_serialize(doc, options);
2263
+ if (!tmp) return 0;
2264
+ size_t need = strlen(tmp) + 1;
2265
+ if (buf && capacity >= need) {
2266
+ memcpy(buf, tmp, need);
2267
+ }
2268
+ if (out_len) *out_len = need - 1;
2269
+ /* Cache for the no-options (defaults) path; option permutations
2270
+ * stay one-shot to keep the cache key simple. */
2271
+ if (!options) {
2272
+ free(doc->ser_cache);
2273
+ doc->ser_cache = tmp; /* ownership transferred */
2274
+ doc->ser_cache_len = need - 1;
2275
+ doc->ser_cache_version = doc->ser_version;
2276
+ doc->ser_cache_text = 0;
2277
+ doc->ser_cache_omit = 0;
2278
+ doc->ser_cache_indent = 0;
2279
+ } else {
2280
+ leptris_free_string(tmp);
2281
+ }
2282
+ return need;
2283
+ }
2284
+
2285
+ LEPTRIS_API size_t leptris_element_serialize_into(LeptrisElement elem,
2286
+ char* buf,
2287
+ size_t capacity,
2288
+ size_t* out_len,
2289
+ const LeptrisSerializeOptions* options) {
2290
+ char* tmp = leptris_element_serialize(elem, options);
2291
+ if (!tmp) return 0;
2292
+ size_t need = strlen(tmp) + 1;
2293
+ if (buf && capacity >= need) {
2294
+ memcpy(buf, tmp, need);
2295
+ }
2296
+ if (out_len) *out_len = need - 1; /* sizing pass too (#550) */
2297
+ leptris_free_string(tmp);
2298
+ return need;
2299
+ }
2300
+
2301
+ /* Save document to file */
2302
+ LEPTRIS_API int leptris_document_save_file(struct leptris_document* doc,
2303
+ const char* filepath,
2304
+ const LeptrisSerializeOptions* options) {
2305
+ if (!doc) return -4; /* LEPTRIS_ERROR_NULL_ARG */
2306
+ if (!filepath) return -4; /* LEPTRIS_ERROR_NULL_ARG */
2307
+
2308
+ /* Serialize document to XML string */
2309
+ char* xml = leptris_document_serialize(doc, options);
2310
+ if (!xml) return -1; /* LEPTRIS_ERROR_MEMORY */
2311
+
2312
+ /* Open file for writing */
2313
+ FILE* file = fopen(filepath, "wb");
2314
+ if (!file) {
2315
+ LEPTRIS_FREE(xml);
2316
+ return -7; /* LEPTRIS_ERROR_IO */
2317
+ }
2318
+
2319
+ /* Write XML content to file */
2320
+ size_t len = strlen(xml);
2321
+ size_t written = fwrite(xml, 1, len, file);
2322
+ fclose(file);
2323
+
2324
+ /* Free the XML string */
2325
+ LEPTRIS_FREE(xml);
2326
+
2327
+ /* Check if all bytes were written */
2328
+ if (written != len) {
2329
+ return -7; /* LEPTRIS_ERROR_IO */
2330
+ }
2331
+
2332
+ return 0; /* LEPTRIS_OK */
2333
+ }