mml 2.3.0 → 2.3.2

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 (336) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +9 -0
  3. data/.rubocop.yml +4 -0
  4. data/.rubocop_todo.yml +83 -18
  5. data/Gemfile +0 -2
  6. data/README.adoc +176 -47
  7. data/Rakefile +16 -1
  8. data/lib/mml/base/common_attributes.rb +44 -0
  9. data/lib/mml/base/content/annotation.rb +28 -0
  10. data/lib/mml/base/content/annotation_xml.rb +31 -0
  11. data/lib/mml/base/content/apply.rb +27 -0
  12. data/lib/mml/base/content/arith.rb +243 -0
  13. data/lib/mml/base/content/bind.rb +27 -0
  14. data/lib/mml/base/content/bvar.rb +20 -0
  15. data/lib/mml/base/content/calculus.rb +103 -0
  16. data/lib/mml/base/content/cbytes.rb +24 -0
  17. data/lib/mml/base/content/cerror.rb +24 -0
  18. data/lib/mml/base/content/ci.rb +77 -0
  19. data/lib/mml/base/content/cn.rb +33 -0
  20. data/lib/mml/base/content/condition.rb +20 -0
  21. data/lib/mml/base/content/constants.rb +173 -0
  22. data/lib/mml/base/content/cs.rb +22 -0
  23. data/lib/mml/base/content/csymbol.rb +79 -0
  24. data/lib/mml/base/content/declare.rb +34 -0
  25. data/lib/mml/base/content/degree.rb +20 -0
  26. data/lib/mml/base/content/elementary_functions.rb +309 -0
  27. data/lib/mml/base/content/fn.rb +25 -0
  28. data/lib/mml/base/content/functions.rb +85 -0
  29. data/lib/mml/base/content/interval.rb +24 -0
  30. data/lib/mml/base/content/inverse.rb +25 -0
  31. data/lib/mml/base/content/lambda.rb +20 -0
  32. data/lib/mml/base/content/linear_algebra.rb +122 -0
  33. data/lib/mml/base/content/logic.rb +93 -0
  34. data/lib/mml/base/content/otherwise.rb +20 -0
  35. data/lib/mml/base/content/piece.rb +20 -0
  36. data/lib/mml/base/content/piecewise.rb +20 -0
  37. data/lib/mml/base/content/relations.rb +113 -0
  38. data/lib/mml/base/content/reln.rb +19 -0
  39. data/lib/mml/base/content/semantics.rb +27 -0
  40. data/lib/mml/base/content/sep.rb +19 -0
  41. data/lib/mml/base/content/sets.rb +163 -0
  42. data/lib/mml/base/content/share.rb +22 -0
  43. data/lib/mml/base/content/statistics.rb +95 -0
  44. data/lib/mml/base/content/vector_calculus.rb +63 -0
  45. data/lib/mml/base/content_loader.rb +195 -0
  46. data/lib/mml/base/maction.rb +1 -0
  47. data/lib/mml/base/math.rb +47 -0
  48. data/lib/mml/base/menclose.rb +1 -1
  49. data/lib/mml/base/mfenced.rb +2 -2
  50. data/lib/mml/base/mglyph.rb +2 -2
  51. data/lib/mml/base/mi.rb +9 -6
  52. data/lib/mml/base/mlabeledtr.rb +2 -6
  53. data/lib/mml/base/mn.rb +3 -2
  54. data/lib/mml/base/mo.rb +3 -3
  55. data/lib/mml/base/mrow.rb +0 -2
  56. data/lib/mml/base/ms.rb +4 -6
  57. data/lib/mml/base/mscarries.rb +1 -1
  58. data/lib/mml/base/mspace.rb +0 -2
  59. data/lib/mml/base/mstyle.rb +4 -8
  60. data/lib/mml/base/mtable.rb +8 -0
  61. data/lib/mml/base/mtd.rb +6 -0
  62. data/lib/mml/base/mtext.rb +0 -2
  63. data/lib/mml/base/semantics.rb +4 -2
  64. data/lib/mml/base/universal_presentation_attributes.rb +46 -0
  65. data/lib/mml/base/v3_common.rb +16 -0
  66. data/lib/mml/base/v3_presentation_attributes.rb +15 -0
  67. data/lib/mml/base/v4_attributes.rb +4 -18
  68. data/lib/mml/base.rb +11 -0
  69. data/lib/mml/common_elements.rb +336 -0
  70. data/lib/mml/context_configuration.rb +29 -0
  71. data/lib/mml/v2/annotation.rb +9 -0
  72. data/lib/mml/v2/annotation_xml.rb +9 -0
  73. data/lib/mml/v2/apply.rb +9 -0
  74. data/lib/mml/v2/arith.rb +93 -0
  75. data/lib/mml/v2/bind.rb +9 -0
  76. data/lib/mml/v2/bvar.rb +9 -0
  77. data/lib/mml/v2/calculus.rb +33 -0
  78. data/lib/mml/v2/ci.rb +9 -0
  79. data/lib/mml/v2/cn.rb +9 -0
  80. data/lib/mml/v2/common_elements.rb +34 -0
  81. data/lib/mml/v2/condition.rb +9 -0
  82. data/lib/mml/v2/configuration.rb +13 -0
  83. data/lib/mml/v2/constants.rb +65 -0
  84. data/lib/mml/v2/csymbol.rb +9 -0
  85. data/lib/mml/v2/degree.rb +9 -0
  86. data/lib/mml/v2/elementary_functions.rb +121 -0
  87. data/lib/mml/v2/fn.rb +9 -0
  88. data/lib/mml/v2/functions.rb +29 -0
  89. data/lib/mml/v2/interval.rb +9 -0
  90. data/lib/mml/v2/inverse.rb +9 -0
  91. data/lib/mml/v2/lambda.rb +9 -0
  92. data/lib/mml/v2/linear_algebra.rb +41 -0
  93. data/lib/mml/v2/logic.rb +33 -0
  94. data/lib/mml/v2/maction.rb +9 -0
  95. data/lib/mml/v2/maligngroup.rb +9 -0
  96. data/lib/mml/v2/malignmark.rb +9 -0
  97. data/lib/mml/v2/math.rb +11 -0
  98. data/lib/mml/v2/menclose.rb +9 -0
  99. data/lib/mml/v2/merror.rb +9 -0
  100. data/lib/mml/v2/mfenced.rb +9 -0
  101. data/lib/mml/v2/mfrac.rb +9 -0
  102. data/lib/mml/v2/mfraction.rb +9 -0
  103. data/lib/mml/v2/mglyph.rb +9 -0
  104. data/lib/mml/v2/mi.rb +9 -0
  105. data/lib/mml/v2/mlabeledtr.rb +9 -0
  106. data/lib/mml/v2/mlongdiv.rb +9 -0
  107. data/lib/mml/v2/mmultiscripts.rb +9 -0
  108. data/lib/mml/v2/mn.rb +9 -0
  109. data/lib/mml/v2/mo.rb +10 -0
  110. data/lib/mml/v2/mover.rb +9 -0
  111. data/lib/mml/v2/mpadded.rb +9 -0
  112. data/lib/mml/v2/mphantom.rb +9 -0
  113. data/lib/mml/v2/mprescripts.rb +9 -0
  114. data/lib/mml/v2/mroot.rb +9 -0
  115. data/lib/mml/v2/mrow.rb +9 -0
  116. data/lib/mml/v2/ms.rb +9 -0
  117. data/lib/mml/v2/mscarries.rb +9 -0
  118. data/lib/mml/v2/mscarry.rb +9 -0
  119. data/lib/mml/v2/msgroup.rb +9 -0
  120. data/lib/mml/v2/msline.rb +9 -0
  121. data/lib/mml/v2/mspace.rb +9 -0
  122. data/lib/mml/v2/msqrt.rb +9 -0
  123. data/lib/mml/v2/msrow.rb +9 -0
  124. data/lib/mml/v2/mstack.rb +9 -0
  125. data/lib/mml/v2/mstyle.rb +10 -0
  126. data/lib/mml/v2/msub.rb +9 -0
  127. data/lib/mml/v2/msubsup.rb +9 -0
  128. data/lib/mml/v2/msup.rb +9 -0
  129. data/lib/mml/v2/mtable.rb +9 -0
  130. data/lib/mml/v2/mtd.rb +9 -0
  131. data/lib/mml/v2/mtext.rb +9 -0
  132. data/lib/mml/v2/mtr.rb +9 -0
  133. data/lib/mml/v2/munder.rb +9 -0
  134. data/lib/mml/v2/munderover.rb +9 -0
  135. data/lib/mml/v2/namespace.rb +7 -0
  136. data/lib/mml/v2/none.rb +9 -0
  137. data/lib/mml/v2/otherwise.rb +9 -0
  138. data/lib/mml/v2/piece.rb +9 -0
  139. data/lib/mml/v2/piecewise.rb +9 -0
  140. data/lib/mml/v2/relations.rb +41 -0
  141. data/lib/mml/v2/reln.rb +13 -0
  142. data/lib/mml/v2/semantics.rb +9 -0
  143. data/lib/mml/v2/sep.rb +9 -0
  144. data/lib/mml/v2/sets.rb +57 -0
  145. data/lib/mml/v2/statistics.rb +33 -0
  146. data/lib/mml/v2/vector_calculus.rb +21 -0
  147. data/lib/mml/v2.rb +311 -0
  148. data/lib/mml/v3/annotation.rb +10 -0
  149. data/lib/mml/v3/annotation_xml.rb +10 -0
  150. data/lib/mml/v3/apply.rb +10 -0
  151. data/lib/mml/v3/arith.rb +115 -0
  152. data/lib/mml/v3/bind.rb +10 -0
  153. data/lib/mml/v3/calculus.rb +40 -0
  154. data/lib/mml/v3/cbytes.rb +10 -0
  155. data/lib/mml/v3/cerror.rb +10 -0
  156. data/lib/mml/v3/ci.rb +10 -0
  157. data/lib/mml/v3/cn.rb +10 -0
  158. data/lib/mml/v3/common_elements.rb +34 -0
  159. data/lib/mml/v3/constants.rb +80 -0
  160. data/lib/mml/v3/constructs.rb +55 -0
  161. data/lib/mml/v3/cs.rb +10 -0
  162. data/lib/mml/v3/csymbol.rb +10 -0
  163. data/lib/mml/v3/deprecated_content.rb +29 -0
  164. data/lib/mml/v3/elementary_functions.rb +145 -0
  165. data/lib/mml/v3/functions.rb +35 -0
  166. data/lib/mml/v3/linear_algebra.rb +50 -0
  167. data/lib/mml/v3/logic.rb +40 -0
  168. data/lib/mml/v3/maction.rb +1 -1
  169. data/lib/mml/v3/math.rb +7 -1
  170. data/lib/mml/v3/mi.rb +1 -0
  171. data/lib/mml/v3/mn.rb +1 -0
  172. data/lib/mml/v3/mo.rb +1 -0
  173. data/lib/mml/v3/mrow.rb +1 -0
  174. data/lib/mml/v3/ms.rb +1 -0
  175. data/lib/mml/v3/mstyle.rb +1 -0
  176. data/lib/mml/v3/mtext.rb +1 -0
  177. data/lib/mml/v3/relations.rb +50 -0
  178. data/lib/mml/v3/sets.rb +70 -0
  179. data/lib/mml/v3/statistics.rb +40 -0
  180. data/lib/mml/v3/vector_calculus.rb +25 -0
  181. data/lib/mml/v3.rb +25 -0
  182. data/lib/mml/v4/a.rb +4 -3
  183. data/lib/mml/v4/annotation.rb +10 -0
  184. data/lib/mml/v4/annotation_xml.rb +14 -0
  185. data/lib/mml/v4/apply.rb +9 -0
  186. data/lib/mml/v4/arith.rb +93 -0
  187. data/lib/mml/v4/calculus.rb +25 -0
  188. data/lib/mml/v4/cbytes.rb +9 -0
  189. data/lib/mml/v4/cerror.rb +9 -0
  190. data/lib/mml/v4/ci.rb +9 -0
  191. data/lib/mml/v4/cn.rb +9 -0
  192. data/lib/mml/v4/common_elements.rb +33 -0
  193. data/lib/mml/v4/constants.rb +65 -0
  194. data/lib/mml/v4/constructs.rb +49 -0
  195. data/lib/mml/v4/cs.rb +9 -0
  196. data/lib/mml/v4/csymbol.rb +9 -0
  197. data/lib/mml/v4/deprecated_content.rb +25 -0
  198. data/lib/mml/v4/elementary_functions.rb +118 -0
  199. data/lib/mml/v4/factorof.rb +9 -0
  200. data/lib/mml/v4/functions.rb +30 -0
  201. data/lib/mml/v4/limit.rb +9 -0
  202. data/lib/mml/v4/linear_algebra.rb +41 -0
  203. data/lib/mml/v4/logic.rb +33 -0
  204. data/lib/mml/v4/maction.rb +1 -2
  205. data/lib/mml/v4/maligngroup.rb +0 -1
  206. data/lib/mml/v4/malignmark.rb +0 -1
  207. data/lib/mml/v4/math.rb +1 -1
  208. data/lib/mml/v4/menclose.rb +0 -1
  209. data/lib/mml/v4/merror.rb +0 -1
  210. data/lib/mml/v4/mfenced.rb +0 -1
  211. data/lib/mml/v4/mfrac.rb +0 -1
  212. data/lib/mml/v4/mfraction.rb +0 -1
  213. data/lib/mml/v4/mglyph.rb +0 -1
  214. data/lib/mml/v4/mi.rb +1 -1
  215. data/lib/mml/v4/mlabeledtr.rb +0 -1
  216. data/lib/mml/v4/mlongdiv.rb +0 -1
  217. data/lib/mml/v4/mmultiscripts.rb +0 -1
  218. data/lib/mml/v4/mn.rb +1 -1
  219. data/lib/mml/v4/mo.rb +1 -1
  220. data/lib/mml/v4/mover.rb +0 -1
  221. data/lib/mml/v4/mpadded.rb +0 -1
  222. data/lib/mml/v4/mphantom.rb +0 -1
  223. data/lib/mml/v4/mprescripts.rb +0 -1
  224. data/lib/mml/v4/mroot.rb +0 -1
  225. data/lib/mml/v4/mrow.rb +1 -1
  226. data/lib/mml/v4/ms.rb +1 -1
  227. data/lib/mml/v4/mscarries.rb +0 -1
  228. data/lib/mml/v4/mscarry.rb +0 -1
  229. data/lib/mml/v4/msgroup.rb +0 -1
  230. data/lib/mml/v4/msline.rb +0 -1
  231. data/lib/mml/v4/mspace.rb +0 -1
  232. data/lib/mml/v4/msqrt.rb +0 -1
  233. data/lib/mml/v4/msrow.rb +0 -1
  234. data/lib/mml/v4/mstack.rb +0 -1
  235. data/lib/mml/v4/mstyle.rb +1 -1
  236. data/lib/mml/v4/msub.rb +0 -1
  237. data/lib/mml/v4/msubsup.rb +0 -1
  238. data/lib/mml/v4/msup.rb +0 -1
  239. data/lib/mml/v4/mtable.rb +0 -1
  240. data/lib/mml/v4/mtd.rb +0 -1
  241. data/lib/mml/v4/mtext.rb +1 -1
  242. data/lib/mml/v4/mtr.rb +0 -1
  243. data/lib/mml/v4/munder.rb +0 -1
  244. data/lib/mml/v4/munderover.rb +0 -1
  245. data/lib/mml/v4/none.rb +0 -1
  246. data/lib/mml/v4/relations.rb +37 -0
  247. data/lib/mml/v4/semantics.rb +0 -1
  248. data/lib/mml/v4/sets.rb +57 -0
  249. data/lib/mml/v4/statistics.rb +33 -0
  250. data/lib/mml/v4/tendsto.rb +9 -0
  251. data/lib/mml/v4/vector_calculus.rb +21 -0
  252. data/lib/mml/v4.rb +421 -44
  253. data/lib/mml/version.rb +1 -1
  254. data/lib/mml/versioned_parser.rb +1 -1
  255. data/lib/mml.rb +3 -1
  256. data/reference-docs/mathml-source/pubtext/mathmlspec.dtd +150 -0
  257. data/reference-docs/mathml-source/pubtext/xmlspec.dtd +2649 -0
  258. data/reference-docs/mathml-source/readme.txt +40 -0
  259. data/reference-docs/mathml-source/run +296 -0
  260. data/reference-docs/mathml-source/style/html/html2xhtml.xsl +216 -0
  261. data/reference-docs/mathml-source/style/html/images.xsl +98 -0
  262. data/reference-docs/mathml-source/style/html/mml6.xsl +1156 -0
  263. data/reference-docs/mathml-source/style/html/mmldiff.xsl +566 -0
  264. data/reference-docs/mathml-source/style/html/mmlspec.xsl +2531 -0
  265. data/reference-docs/mathml-source/style/html/slices-common.xsl +312 -0
  266. data/reference-docs/mathml-source/style/html/slices.xsl +48 -0
  267. data/reference-docs/mathml-source/style/html/xmlspec.xsl +2542 -0
  268. data/reference-docs/mathml-source/style/pdf/mathmlspec.xsl +2510 -0
  269. data/reference-docs/mathml-source/xml/changes.xml +773 -0
  270. data/reference-docs/mathml-source/xml/character-set.xml +1011 -0
  271. data/reference-docs/mathml-source/xml/content-element-def.xml +6143 -0
  272. data/reference-docs/mathml-source/xml/content-markup.xml +8178 -0
  273. data/reference-docs/mathml-source/xml/contributors.xml +425 -0
  274. data/reference-docs/mathml-source/xml/dom-bindings.xml +20 -0
  275. data/reference-docs/mathml-source/xml/dom-intro.xml +114 -0
  276. data/reference-docs/mathml-source/xml/fundamentals.xml +1646 -0
  277. data/reference-docs/mathml-source/xml/glossary.xml +519 -0
  278. data/reference-docs/mathml-source/xml/interface.xml +1096 -0
  279. data/reference-docs/mathml-source/xml/introduction.xml +724 -0
  280. data/reference-docs/mathml-source/xml/mathml-css-sample.xml +304 -0
  281. data/reference-docs/mathml-source/xml/mathml-dom.xml +3813 -0
  282. data/reference-docs/mathml-source/xml/mathml-spec.xml +356 -0
  283. data/reference-docs/mathml-source/xml/mixing.xml +982 -0
  284. data/reference-docs/mathml-source/xml/operator-dict.xml +551 -0
  285. data/reference-docs/mathml-source/xml/parsing.xml +2565 -0
  286. data/reference-docs/mathml-source/xml/presentation-markup.xml +6834 -0
  287. data/reference-docs/mathml-source/xml/references.xml +323 -0
  288. data/reference-docs/mathml-source/xml/validation-grammar.xml +877 -0
  289. data/schemas/README.adoc +17 -0
  290. data/schemas/mathml2/common/common-attribs.xsd +41 -0
  291. data/schemas/mathml2/common/math.xsd +126 -0
  292. data/schemas/mathml2/common/xlink-href.xsd +20 -0
  293. data/schemas/mathml2/content/CVS/Entries +16 -0
  294. data/schemas/mathml2/content/CVS/Repository +1 -0
  295. data/schemas/mathml2/content/CVS/Root +1 -0
  296. data/schemas/mathml2/content/arith.xsd +90 -0
  297. data/schemas/mathml2/content/calculus.xsd +146 -0
  298. data/schemas/mathml2/content/common-attrib.xsd +30 -0
  299. data/schemas/mathml2/content/constants.xsd +83 -0
  300. data/schemas/mathml2/content/constructs.xsd +260 -0
  301. data/schemas/mathml2/content/elementary-functions.xsd +117 -0
  302. data/schemas/mathml2/content/functions.xsd +73 -0
  303. data/schemas/mathml2/content/linear-algebra.xsd +173 -0
  304. data/schemas/mathml2/content/logic.xsd +53 -0
  305. data/schemas/mathml2/content/relations.xsd +55 -0
  306. data/schemas/mathml2/content/semantics.xsd +85 -0
  307. data/schemas/mathml2/content/sets.xsd +236 -0
  308. data/schemas/mathml2/content/statistics.xsd +136 -0
  309. data/schemas/mathml2/content/tokens.xsd +120 -0
  310. data/schemas/mathml2/content/tokens.xsd.~1.3.~ +119 -0
  311. data/schemas/mathml2/content/vector-calculus.xsd +88 -0
  312. data/schemas/mathml2/mathml2.xsd +59 -0
  313. data/schemas/mathml2/presentation/action.xsd +44 -0
  314. data/schemas/mathml2/presentation/characters.xsd +37 -0
  315. data/schemas/mathml2/presentation/common-attribs.xsd +113 -0
  316. data/schemas/mathml2/presentation/common-types.xsd +103 -0
  317. data/schemas/mathml2/presentation/error.xsd +40 -0
  318. data/schemas/mathml2/presentation/layout.xsd +195 -0
  319. data/schemas/mathml2/presentation/scripts.xsd +186 -0
  320. data/schemas/mathml2/presentation/space.xsd +52 -0
  321. data/schemas/mathml2/presentation/style.xsd +69 -0
  322. data/schemas/mathml2/presentation/table.xsd +216 -0
  323. data/schemas/mathml2/presentation/tokens.xsd +124 -0
  324. data/schemas/mathml3/mathml3-common.xsd +99 -0
  325. data/schemas/mathml3/mathml3-content.xsd +684 -0
  326. data/schemas/mathml3/mathml3-presentation.xsd +2151 -0
  327. data/schemas/mathml3/mathml3-strict-content.xsd +186 -0
  328. data/schemas/mathml3/mathml3.xsd +9 -0
  329. data/schemas/mathml4/mathml4-content.rnc +382 -0
  330. data/schemas/mathml4/mathml4-core.rnc +361 -0
  331. data/schemas/mathml4/mathml4-presentation.rnc +358 -0
  332. data/schemas/mathml4/mathml4-strict-content.rnc +86 -0
  333. data/schemas/mathml4/mathml4.rnc +21 -0
  334. data/schemas/mathml4/mathml4.rnc.1 +21 -0
  335. data/schemas/mathml4/mathml4.rng +37 -0
  336. metadata +249 -2
@@ -0,0 +1,2542 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ xmlns:saxon="http://icl.com/saxon"
4
+ exclude-result-prefixes="saxon"
5
+ version="1.0">
6
+
7
+ <!-- ====================================================================== -->
8
+ <!-- xmlspec.xsl: An HTML XSL[1] Stylesheet for XML Spec V2.1[2] markup
9
+
10
+ Version: $Id: xmlspec.xsl,v 1.9 2003/07/17 16:12:38 davidc Exp $
11
+
12
+ URI: http://dev.w3.org/cvsweb/spec-prod/html/xmlspec.xsl
13
+
14
+ Authors: Norman Walsh (norman.walsh@sun.com)
15
+ Chris Maden (crism@lexica.net)
16
+ Ben Trafford (ben@legendary.org)
17
+ Eve Maler (eve.maler@sun.com)
18
+ Henry S. Thompson (ht@cogsci.ed.ac.uk)
19
+
20
+ Date: Created 07 September 1999
21
+ Last updated $Date: 2003/07/17 16:12:38 $ by $Author: davidc $
22
+
23
+ Copyright (C) 2000, 2001, 2002 Sun Microsystems, Inc. All Rights Reserved.
24
+ This document is governed by the W3C Software License[3] as
25
+ described in the FAQ[4].
26
+
27
+ [1] http://www.w3.org/TR/xslt
28
+ [2] http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm
29
+ [3] http://www.w3.org/Consortium/Legal/copyright-software-19980720
30
+ [4] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
31
+
32
+ Notes:
33
+
34
+ This stylesheet attempts to implement the XML Specification V2.1
35
+ DTD. Documents conforming to earlier DTDs may not be correctly
36
+ transformed.
37
+
38
+ ChangeLog: (See also: CVS ChangeLog)
39
+
40
+ 15 August 2002: Norman Walsh, <Norman.Walsh@Sun.COM>
41
+ - Version 1.3 released at http://www.w3.org/2002/xmlspec/html/1.3/xmlspec.xsl
42
+ There have never been any "official" releases before, so the version number
43
+ is arbitrary.
44
+
45
+ 15 August 2001: Hugo Haas <hugo@w3.org>
46
+ - Slightly modified the status sentence introducing editors'
47
+ copies.
48
+ - Now using role to distinguish editors' copies: e.g.
49
+ <spec w3c-doctype="wd" role="editors-copy">
50
+
51
+ 14 August 2001: Hugo Haas <hugo@w3.org>
52
+ - If w3c-doctype is not a W3C TR, do not use a Note style
53
+ sheet, use <http://www.w3.org/StyleSheets/TR/base.css>
54
+ instead.
55
+ - If the other-doctype is "editors-copy", do not use the W3C
56
+ logo and mark the document as such in the status section.
57
+
58
+ 12 Jun 2001: (Norman.Walsh@Sun.COM)
59
+ - Support non-tabular examples. If tabular.examples is non-zero,
60
+ tables will be used for examples, otherwise nested divs and
61
+ CSS will be used. tabular.examples is *zero* by default.
62
+
63
+ 06 Jun 2001: (Norman.Walsh@Sun.COM)
64
+ - Support copyright element in header; use the content of that
65
+ element if it is present, otherwise use the auto-generated
66
+ copyright statement.
67
+
68
+ 15 May 2001: (Norman.Walsh@Sun.COM)
69
+ - Changed copyright link to point to dated IPR statement:
70
+ http://www.w3.org/Consortium/Legal/ipr-notice-20000612
71
+
72
+ 25 Sep 2000: (Norman.Walsh@East.Sun.COM)
73
+ - Sync'd with Eve's version:
74
+ o Concatenated each inline element's output all on one line
75
+ to avoid spurious spaces in the output. (This is really an
76
+ IE bug, but...) (15 Sep 2000)
77
+ o Updated crism's email address in header (7 Sep 2000)
78
+ o Changed handling of affiliation to use comma instead of
79
+ parentheses (9 Aug 2000)
80
+
81
+ 14 Aug 2000: (Norman.Walsh@East.Sun.COM)
82
+
83
+ - Added additional.title param (for diffspec.xsl to change)
84
+ - Fixed URI of W3C home icon
85
+ - Made CSS stylesheet selection depend on the w3c-doctype attribute
86
+ of spec instead of the w3c-doctype element in the header
87
+
88
+ 26 Jul 2000: (Norman.Walsh@East.Sun.COM)
89
+
90
+ - Improved semantics of specref. Added xsl:message for unsupported
91
+ cases. (I'm by no means confident that I've covered the whole
92
+ list.)
93
+ - Support @role on author.
94
+ - Make lhs/rhs "code" in EBNF.
95
+ - Fixed bug in ID/IDREF linking.
96
+ - More effectively disabled special markup for showing @diffed
97
+ versions
98
+
99
+ 21 Jul 2000: (Norman.Walsh@East.Sun.COM)
100
+
101
+ - Added support for @diff change tracking, primarily through
102
+ the auxiliary stylesheet diffspec.xsl. However, it was
103
+ impractical to handle some constructions, such as DLs and TABLEs,
104
+ in a completely out-of-band manner. So there is some inline
105
+ support for @diff markup.
106
+
107
+ - Added $additional.css to allow downstream stylesheets to add
108
+ new markup to the <style> element.
109
+
110
+ - Added required "type" attribute to the <style> element.
111
+
112
+ - Fixed pervasive problem with nested <a> elements.
113
+
114
+ - Added doctype-public to xsl:output.
115
+
116
+ - Added $validity.hacks. If "1", then additional disable-output-escaping
117
+ markup may be inserted in some places to attempt to get proper,
118
+ valid HTML. For example, if a <glist> appears inside a <p> in the
119
+ xmlspec source, this creates a nested <dl> inside a <p> in the
120
+ HTML, which is not valid. If $validity.hacks is "1", then an
121
+ extra </p>, <p> pair is inserted around the <dl>.
122
+
123
+ 5 June 2001, Henry S. Thompson (ht@cogsci.ed.ac.uk)
124
+
125
+ - Fixed a link in copyright boilerplate to be dated
126
+
127
+ -->
128
+ <!-- ====================================================================== -->
129
+
130
+ <xsl:preserve-space elements="*"/>
131
+
132
+ <xsl:strip-space elements="
133
+ abstract arg attribute authlist author back bibref blist body case col
134
+ colgroup component constant constraint constraintnote copyright def
135
+ definitions descr div div1 div2 div3 div4 div5 ednote enum enumerator
136
+ example exception footnote front gitem glist graphic group header
137
+ htable htbody inform-div1 interface issue item itemizedlist langusage
138
+ listitem member method module note notice ol olist orderedlist orglist
139
+ param parameters prod prodgroup prodrecap proto pubdate pubstmt raises
140
+ reference resolution returns revisiondesc scrap sequence slist
141
+ sourcedesc spec specref status struct table tbody tfoot thead tr
142
+ typedef ul ulist union vc vcnote wfc wfcnote"/>
143
+
144
+ <xsl:param name="validity.hacks">1</xsl:param>
145
+ <xsl:param name="show.diff.markup">0</xsl:param>
146
+ <xsl:param name="additional.css"></xsl:param>
147
+ <xsl:param name="additional.title"></xsl:param>
148
+ <xsl:param name="called.by.diffspec">0</xsl:param>
149
+ <xsl:param name="show.ednotes">1</xsl:param>
150
+ <xsl:param name="tabular.examples">0</xsl:param>
151
+ <xsl:param name="toc.level" select="5"/>
152
+
153
+ <xsl:key name="ids" match="*[@id]" use="@id"/>
154
+ <xsl:key name="specrefs" match="specref" use="@ref"/>
155
+
156
+ <xsl:output method="html"
157
+ encoding="ISO-8859-1"
158
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
159
+ indent="no"/>
160
+
161
+ <xsl:strip-space elements="author"/>
162
+
163
+ <!-- not handled:
164
+ attribute: unhandled IDL stuff
165
+ case: unhandled IDL stuff
166
+ component: unhandled IDL stuff
167
+ constant: unhandled IDL stuff
168
+ copyright: boilerplate notice always used instead
169
+ definitions: unhandled IDL stuff
170
+ descr: unhandled IDL stuff
171
+ enum: unhandled IDL stuff
172
+ enumerator: unhandled IDL stuff
173
+ exception: unhandled IDL stuff
174
+ group: unhandled IDL stuff
175
+ interface: unhandled IDL stuff
176
+ method: unhandled IDL stuff
177
+ module: unhandled IDL stuff
178
+ param: unhandled IDL stuff
179
+ parameters: unhandled IDL stuff
180
+ raises: unhandled IDL stuff
181
+ reference: unhandled IDL stuff
182
+ returns: unhandled IDL stuff
183
+ sequence: unhandled IDL stuff
184
+ struct: unhandled IDL stuff
185
+ typedef: unhandled IDL stuff
186
+ typename: unhandled IDL stuff
187
+ union: unhandled IDL stuff
188
+
189
+ Warning!
190
+ Only handles statuses of NOTE, WD, and REC.
191
+ -->
192
+
193
+ <!-- Output a warning for unhandled elements! -->
194
+ <xsl:template match="*">
195
+ <xsl:message>
196
+ <xsl:text>No template matches </xsl:text>
197
+ <xsl:value-of select="name(.)"/>
198
+ <xsl:text>.</xsl:text>
199
+ </xsl:message>
200
+
201
+ <font color="red">
202
+ <xsl:text>&lt;</xsl:text>
203
+ <xsl:value-of select="name(.)"/>
204
+ <xsl:text>&gt;</xsl:text>
205
+ <xsl:apply-templates/>
206
+ <xsl:text>&lt;/</xsl:text>
207
+ <xsl:value-of select="name(.)"/>
208
+ <xsl:text>&gt;</xsl:text>
209
+ </font>
210
+ </xsl:template>
211
+
212
+ <!-- Template for the root node. Creation of <html> element could
213
+ go here, but that doesn't feel right. -->
214
+ <xsl:template match="/">
215
+ <xsl:apply-templates/>
216
+ </xsl:template>
217
+
218
+ <!-- abstract: appears only in header -->
219
+ <!-- format as a second-level div -->
220
+ <!-- called in enforced order from header's template -->
221
+ <xsl:template match="abstract">
222
+ <div>
223
+ <xsl:text>&#10;</xsl:text>
224
+ <h2>
225
+ <xsl:call-template name="anchor">
226
+ <xsl:with-param name="conditional" select="0"/>
227
+ <xsl:with-param name="default.id" select="'abstract'"/>
228
+ </xsl:call-template>
229
+ <xsl:text>Abstract</xsl:text>
230
+ </h2>
231
+ <xsl:apply-templates/>
232
+ </div>
233
+ </xsl:template>
234
+
235
+ <!-- affiliation: follows a name in author and member -->
236
+ <!-- put it in parens with a leading space -->
237
+ <xsl:template match="affiliation">
238
+ <xsl:text>, </xsl:text>
239
+ <xsl:apply-templates/>
240
+ </xsl:template>
241
+
242
+ <!-- arg: appears only in proto -->
243
+ <!-- argument in function prototype -->
244
+ <!-- output argument type, italicized as placeholder; separate the
245
+ list with commas and spaces -->
246
+ <xsl:template match="arg">
247
+ <xsl:if test="preceding-sibling::arg">
248
+ <xsl:text>, </xsl:text>
249
+ </xsl:if>
250
+ <var>
251
+ <xsl:value-of select="@type"/>
252
+ </var>
253
+ <xsl:if test="@occur = 'opt'">
254
+ <xsl:text>?</xsl:text>
255
+ </xsl:if>
256
+ </xsl:template>
257
+
258
+ <!-- att: attribute name -->
259
+ <!-- used lots of places -->
260
+ <!-- format as monospaced code -->
261
+ <xsl:template match="att">
262
+ <code><xsl:apply-templates/></code>
263
+ </xsl:template>
264
+
265
+ <!-- attribute: -->
266
+ <!-- IDL stuff isn't handled yet -->
267
+
268
+ <!-- attval: attribute name -->
269
+ <!-- used lots of places -->
270
+ <!-- format as quoted string -->
271
+ <xsl:template match="attval">
272
+ <xsl:text>"</xsl:text>
273
+ <xsl:apply-templates/>
274
+ <xsl:text>"</xsl:text>
275
+ </xsl:template>
276
+
277
+ <!-- authlist: list of authors (editors, really) -->
278
+ <!-- called in enforced order from header's template, in <dl>
279
+ context -->
280
+ <xsl:template match="authlist">
281
+ <dt>
282
+ <xsl:text>Editor</xsl:text>
283
+ <xsl:if test="count(author) > 1">
284
+ <xsl:text>s</xsl:text>
285
+ </xsl:if>
286
+ <xsl:text>:</xsl:text>
287
+ </dt>
288
+ <xsl:apply-templates/>
289
+ </xsl:template>
290
+
291
+ <!-- author: an editor of a spec -->
292
+ <!-- only appears in authlist -->
293
+ <!-- called in <dl> context -->
294
+ <xsl:template match="author">
295
+ <dd>
296
+ <xsl:apply-templates/>
297
+ <xsl:if test="@role = '2e'">
298
+ <xsl:text> - Second Edition</xsl:text>
299
+ </xsl:if>
300
+ </dd>
301
+ </xsl:template>
302
+
303
+ <!-- back: back matter for the spec -->
304
+ <!-- make a <div> for neatness -->
305
+ <!-- affects numbering of div1 children -->
306
+ <xsl:template match="back">
307
+ <div class="back">
308
+ <xsl:apply-templates/>
309
+ </div>
310
+ </xsl:template>
311
+
312
+ <!-- bibl: bibliographic entry -->
313
+ <!-- only appears in blist -->
314
+ <!-- called with <dl> context -->
315
+ <!-- if there's a key, use it in the <dt>, otherwise use the ID -->
316
+ <!-- if there's an href, add a ref in parens at the end of the text -->
317
+ <xsl:template match="bibl">
318
+ <dt class="label">
319
+ <xsl:if test="@id">
320
+ <a name="{@id}" id="{@id}"/>
321
+ </xsl:if>
322
+ <xsl:choose>
323
+ <xsl:when test="@key">
324
+ <xsl:value-of select="@key"/>
325
+ </xsl:when>
326
+ <xsl:otherwise>
327
+ <xsl:value-of select="@id"/>
328
+ </xsl:otherwise>
329
+ </xsl:choose>
330
+ </dt>
331
+ <dd>
332
+ <xsl:choose>
333
+ <xsl:when test="@href">
334
+ <a href="{@href}">
335
+ <xsl:apply-templates/>
336
+ </a>
337
+ </xsl:when>
338
+ <xsl:otherwise>
339
+ <xsl:apply-templates/>
340
+ </xsl:otherwise>
341
+ </xsl:choose>
342
+ <xsl:if test="@href">
343
+ <xsl:text> (See </xsl:text>
344
+ <xsl:value-of select="@href"/>
345
+ <xsl:text>.)</xsl:text>
346
+ </xsl:if>
347
+ </dd>
348
+ </xsl:template>
349
+
350
+ <!-- bibref: reference to a bibliographic entry -->
351
+ <!-- make a link to the bibl -->
352
+ <!-- if the bibl has a key, put it in square brackets; otherwise use
353
+ the bibl's ID -->
354
+ <xsl:template match="bibref">
355
+ <a>
356
+ <xsl:attribute name="href">
357
+ <xsl:call-template name="href.target">
358
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
359
+ </xsl:call-template>
360
+ </xsl:attribute>
361
+ <xsl:text>[</xsl:text>
362
+ <xsl:choose>
363
+ <xsl:when test="key('ids', @ref)/@key">
364
+ <xsl:value-of select="key('ids', @ref)/@key"/>
365
+ </xsl:when>
366
+ <xsl:otherwise>
367
+ <xsl:value-of select="@ref"/>
368
+ </xsl:otherwise>
369
+ </xsl:choose>
370
+ <xsl:text>]</xsl:text>
371
+ </a>
372
+ </xsl:template>
373
+
374
+ <!-- blist: list of bibliographic entries -->
375
+ <!-- set up the list and process children -->
376
+ <xsl:template match="blist">
377
+ <dl>
378
+ <xsl:apply-templates/>
379
+ </dl>
380
+ </xsl:template>
381
+
382
+ <!-- bnf: un-marked-up BNF productions -->
383
+ <!-- preformatted within a table cell -->
384
+ <!-- scrap provides <table> context -->
385
+ <xsl:template match="bnf">
386
+ <tbody>
387
+ <tr>
388
+ <td>
389
+ <xsl:if test="@diff and $show.diff.markup='1'">
390
+ <xsl:attribute name="class">
391
+ <xsl:text>diff-</xsl:text>
392
+ <xsl:value-of select="@diff"/>
393
+ </xsl:attribute>
394
+ </xsl:if>
395
+ <pre>
396
+ <xsl:apply-templates/>
397
+ </pre>
398
+ </td>
399
+ </tr>
400
+ </tbody>
401
+ </xsl:template>
402
+
403
+ <!-- body: the meat of the spec -->
404
+ <!-- create a TOC and then go to work -->
405
+ <!-- (don't forget the TOC for the back matter and a pointer to end
406
+ notes) -->
407
+ <xsl:template match="body">
408
+ <xsl:if test="$toc.level &gt; 0">
409
+ <div class="toc">
410
+ <xsl:text>&#10;</xsl:text>
411
+ <h2>
412
+ <xsl:call-template name="anchor">
413
+ <xsl:with-param name="conditional" select="0"/>
414
+ <xsl:with-param name="default.id" select="'contents'"/>
415
+ </xsl:call-template>
416
+ <xsl:text>Table of Contents</xsl:text>
417
+ </h2>
418
+ <p class="toc">
419
+ <xsl:apply-templates select="div1" mode="toc"/>
420
+ </p>
421
+ <xsl:if test="../back">
422
+ <xsl:text>&#10;</xsl:text>
423
+ <h3>
424
+ <xsl:call-template name="anchor">
425
+ <xsl:with-param name="conditional" select="0"/>
426
+ <xsl:with-param name="default.id" select="'appendices'"/>
427
+ </xsl:call-template>
428
+
429
+ <xsl:text>Appendi</xsl:text>
430
+ <xsl:choose>
431
+ <xsl:when test="count(../back/div1 | ../back/inform-div1) > 1">
432
+ <xsl:text>ces</xsl:text>
433
+ </xsl:when>
434
+ <xsl:otherwise>
435
+ <xsl:text>x</xsl:text>
436
+ </xsl:otherwise>
437
+ </xsl:choose>
438
+ </h3>
439
+ <p class="toc">
440
+ <xsl:apply-templates mode="toc"
441
+ select="../back/div1 | ../back/inform-div1"/>
442
+ </p>
443
+ </xsl:if>
444
+ <xsl:if test="//footnote[not(ancestor::table)]">
445
+ <p class="toc">
446
+ <a href="#endnotes">
447
+ <xsl:text>End Notes</xsl:text>
448
+ </a>
449
+ </p>
450
+ </xsl:if>
451
+ </div>
452
+ <hr/>
453
+ </xsl:if>
454
+ <div class="body">
455
+ <xsl:apply-templates/>
456
+ </div>
457
+ </xsl:template>
458
+
459
+ <!-- caption: see table -->
460
+
461
+ <!-- case: -->
462
+ <!-- IDL stuff isn't handled yet -->
463
+
464
+ <!-- code: generic computer code -->
465
+ <!-- output as HTML <code> for monospaced formatting -->
466
+ <xsl:template match="code">
467
+ <code><xsl:apply-templates/></code>
468
+ </xsl:template>
469
+
470
+ <!-- col: see table -->
471
+
472
+ <!-- colgroup: see table -->
473
+
474
+ <!-- com: formal production comment -->
475
+ <!-- can appear in prod or rhs -->
476
+ <xsl:template match="com">
477
+ <xsl:choose>
478
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
479
+ <td>
480
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
481
+ <xsl:attribute name="class">
482
+ <xsl:text>diff-</xsl:text>
483
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
484
+ </xsl:attribute>
485
+ </xsl:if>
486
+ <i>
487
+ <xsl:text>/* </xsl:text>
488
+ <xsl:apply-templates/>
489
+ <xsl:text> */</xsl:text>
490
+ </i>
491
+ </td>
492
+ </xsl:when>
493
+ <xsl:otherwise>
494
+ <tr valign="baseline">
495
+ <td/><td/><td/><td/>
496
+ <td>
497
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
498
+ <xsl:attribute name="class">
499
+ <xsl:text>diff-</xsl:text>
500
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
501
+ </xsl:attribute>
502
+ </xsl:if>
503
+ <i>
504
+ <xsl:text>/* </xsl:text>
505
+ <xsl:apply-templates/>
506
+ <xsl:text> */</xsl:text>
507
+ </i>
508
+ </td>
509
+ </tr>
510
+ </xsl:otherwise>
511
+ </xsl:choose>
512
+ </xsl:template>
513
+
514
+ <!-- this could probably be handled better, but given that rhs can
515
+ have arbitrary text and com mixed in, I don't feel like
516
+ spending enough time to figure out how -->
517
+ <xsl:template match="rhs/com">
518
+ <i>
519
+ <xsl:text>/* </xsl:text>
520
+ <xsl:apply-templates/>
521
+ <xsl:text> */</xsl:text>
522
+ </i>
523
+ </xsl:template>
524
+
525
+ <!-- component: -->
526
+ <!-- IDL stuff isn't handled yet -->
527
+
528
+ <!-- constant: -->
529
+ <!-- IDL stuff isn't handled yet -->
530
+
531
+ <!-- constraint: a note in a formal production -->
532
+ <!-- refers to a constraint note -->
533
+ <xsl:template match="constraint">
534
+ <xsl:choose>
535
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
536
+ <td>
537
+ <xsl:if test="@diff and $show.diff.markup='1'">
538
+ <xsl:attribute name="class">
539
+ <xsl:text>diff-</xsl:text>
540
+ <xsl:value-of select="@diff"/>
541
+ </xsl:attribute>
542
+ </xsl:if>
543
+ <a>
544
+ <xsl:attribute name="href">
545
+ <xsl:call-template name="href.target">
546
+ <xsl:with-param name="target" select="key('ids', @def)"/>
547
+ </xsl:call-template>
548
+ </xsl:attribute>
549
+ <xsl:text>[Constraint: </xsl:text>
550
+ <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
551
+ <xsl:text>]</xsl:text>
552
+ </a>
553
+ </td>
554
+ </xsl:when>
555
+ <xsl:otherwise>
556
+ <tr valign="baseline">
557
+ <td/><td/><td/><td/>
558
+ <td>
559
+ <xsl:if test="@diff and $show.diff.markup='1'">
560
+ <xsl:attribute name="class">
561
+ <xsl:text>diff-</xsl:text>
562
+ <xsl:value-of select="@diff"/>
563
+ </xsl:attribute>
564
+ </xsl:if>
565
+ <a>
566
+ <xsl:attribute name="href">
567
+ <xsl:call-template name="href.target">
568
+ <xsl:with-param name="target" select="key('ids', @def)"/>
569
+ </xsl:call-template>
570
+ </xsl:attribute>
571
+ <xsl:text>[Constraint: </xsl:text>
572
+ <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
573
+ <xsl:text>]</xsl:text>
574
+ </a>
575
+ </td>
576
+ </tr>
577
+ </xsl:otherwise>
578
+ </xsl:choose>
579
+ </xsl:template>
580
+
581
+ <!-- constraintnote: note constraining a formal production -->
582
+ <!-- see also constraintnote/head -->
583
+ <xsl:template match="constraintnote">
584
+ <div class="constraint">
585
+ <xsl:apply-templates/>
586
+ </div>
587
+ </xsl:template>
588
+
589
+ <!-- copyright: notice for this document-->
590
+ <!-- right now, a boilerplate copyright notice is inserted by the
591
+ template for header; this may need to be changed -->
592
+
593
+ <!-- day: day of month of spec -->
594
+ <!-- only used in pudate; called directly from header template -->
595
+ <xsl:template match="day">
596
+ <xsl:apply-templates/>
597
+ </xsl:template>
598
+
599
+ <!-- def: glossary definition -->
600
+ <!-- already in <dl> context from glist -->
601
+ <xsl:template match="def">
602
+ <dd>
603
+ <xsl:apply-templates/>
604
+ </dd>
605
+ </xsl:template>
606
+
607
+ <!-- definitions: -->
608
+ <!-- IDL stuff isn't handled yet -->
609
+
610
+ <!-- descr: -->
611
+ <!-- IDL stuff isn't handled yet -->
612
+
613
+ <!-- div[n]: structural divisions -->
614
+ <!-- make an HTML div -->
615
+ <!-- see also div[n]/head -->
616
+ <xsl:template match="div1">
617
+ <div class="div1">
618
+ <xsl:apply-templates/>
619
+ </div>
620
+ </xsl:template>
621
+
622
+ <xsl:template match="div2">
623
+ <div class="div2">
624
+ <xsl:apply-templates/>
625
+ </div>
626
+ </xsl:template>
627
+
628
+ <xsl:template match="div3">
629
+ <div class="div3">
630
+ <xsl:apply-templates/>
631
+ </div>
632
+ </xsl:template>
633
+
634
+ <xsl:template match="div4">
635
+ <div class="div4">
636
+ <xsl:apply-templates/>
637
+ </div>
638
+ </xsl:template>
639
+
640
+ <xsl:template match="div5">
641
+ <div class="div5">
642
+ <xsl:apply-templates/>
643
+ </div>
644
+ </xsl:template>
645
+
646
+ <!-- ednote: editors' note -->
647
+ <xsl:template match="ednote">
648
+ <xsl:if test="$show.ednotes != 0">
649
+ <table border="1">
650
+ <xsl:attribute name="summary">
651
+ <xsl:text>Editorial note</xsl:text>
652
+ <xsl:if test="name">
653
+ <xsl:text>: </xsl:text>
654
+ <xsl:value-of select="name"/>
655
+ </xsl:if>
656
+ </xsl:attribute>
657
+ <tr>
658
+ <td align="left" valign="top" width="50%">
659
+ <b>
660
+ <xsl:text>Editorial note</xsl:text>
661
+ <xsl:if test="name">
662
+ <xsl:text>: </xsl:text>
663
+ <xsl:apply-templates select="name"/>
664
+ </xsl:if>
665
+ </b>
666
+ </td>
667
+ <td align="right" valign="top" width="50%">
668
+ <xsl:choose>
669
+ <xsl:when test="date">
670
+ <xsl:apply-templates select="date"/>
671
+ </xsl:when>
672
+ <xsl:otherwise>&#160;</xsl:otherwise>
673
+ </xsl:choose>
674
+ </td>
675
+ </tr>
676
+ <tr>
677
+ <td colspan="2" align="left" valign="top">
678
+ <xsl:apply-templates select="edtext"/>
679
+ </td>
680
+ </tr>
681
+ </table>
682
+ </xsl:if>
683
+ </xsl:template>
684
+
685
+ <xsl:template match="date">
686
+ <xsl:apply-templates/>
687
+ </xsl:template>
688
+
689
+ <!-- edtext: text of an editors' note -->
690
+ <!-- ednote is currently hidden -->
691
+
692
+ <!-- el: an XML element -->
693
+ <!-- present as preformatted text, no markup -->
694
+ <!-- Chris's personal preference is to put pointy-brackets around
695
+ this, but he seems to be in the minority -->
696
+ <xsl:template match="el">
697
+ <code><xsl:apply-templates/></code>
698
+ </xsl:template>
699
+
700
+ <!-- email: an email address for an editor -->
701
+ <!-- only occurs in author -->
702
+ <xsl:template match="email">
703
+ <xsl:text> </xsl:text>
704
+ <a href="{@href}">
705
+ <xsl:text>&lt;</xsl:text>
706
+ <xsl:apply-templates/>
707
+ <xsl:text>&gt;</xsl:text>
708
+ </a>
709
+ </xsl:template>
710
+
711
+ <!-- emph: in-line emphasis -->
712
+ <!-- equates to HTML <em> -->
713
+ <!-- the role attribute could be used for multiple kinds of
714
+ emphasis, but that would not be kind -->
715
+ <xsl:template match="emph">
716
+ <em><xsl:apply-templates/></em>
717
+ </xsl:template>
718
+
719
+ <!-- enum: -->
720
+ <!-- IDL stuff isn't handled yet -->
721
+
722
+ <!-- enumerator: -->
723
+ <!-- IDL stuff isn't handled yet -->
724
+
725
+ <!-- example: what it seems -->
726
+ <!-- block-level with title -->
727
+ <!-- see also example/head -->
728
+ <xsl:template match="example">
729
+ <xsl:variable name="class">
730
+ <xsl:choose>
731
+ <xsl:when test="$tabular.examples = 0">exampleOuter</xsl:when>
732
+ <xsl:otherwise>example</xsl:otherwise>
733
+ </xsl:choose>
734
+ </xsl:variable>
735
+ <div class="{$class}">
736
+ <xsl:apply-templates/>
737
+ </div>
738
+ </xsl:template>
739
+
740
+ <xsl:template match="example/head">
741
+ <xsl:text>&#10;</xsl:text>
742
+ <xsl:choose>
743
+ <xsl:when test="$tabular.examples = 0">
744
+ <div class="exampleHead">
745
+ <xsl:text>Example: </xsl:text>
746
+ <xsl:apply-templates/>
747
+ </div>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <h5>
751
+ <xsl:call-template name="anchor">
752
+ <xsl:with-param name="node" select=".."/>
753
+ <xsl:with-param name="conditional" select="0"/>
754
+ </xsl:call-template>
755
+
756
+ <xsl:text>Example: </xsl:text>
757
+ <xsl:apply-templates/>
758
+ </h5>
759
+ </xsl:otherwise>
760
+ </xsl:choose>
761
+ </xsl:template>
762
+
763
+ <!-- eg: a literal example -->
764
+ <!-- present as preformatted text -->
765
+ <xsl:template match="eg">
766
+ <xsl:variable name="content">
767
+ <pre>
768
+ <xsl:if test="@diff and $show.diff.markup='1'">
769
+ <xsl:attribute name="class">
770
+ <xsl:text>diff-</xsl:text>
771
+ <xsl:value-of select="@diff"/>
772
+ </xsl:attribute>
773
+ </xsl:if>
774
+ <xsl:apply-templates/>
775
+ </pre>
776
+ </xsl:variable>
777
+ <xsl:choose>
778
+ <xsl:when test="$tabular.examples = 0">
779
+ <div class="exampleInner">
780
+ <xsl:copy-of select="$content"/>
781
+ </div>
782
+ </xsl:when>
783
+ <xsl:otherwise>
784
+ <table class="eg" cellpadding="5" border="1"
785
+ bgcolor="#99ffff" width="100%"
786
+ summary="Example">
787
+ <tr>
788
+ <td>
789
+ <xsl:copy-of select="$content"/>
790
+ </td>
791
+ </tr>
792
+ </table>
793
+ </xsl:otherwise>
794
+ </xsl:choose>
795
+ </xsl:template>
796
+
797
+ <!-- exception: -->
798
+ <!-- IDL stuff isn't handled yet -->
799
+
800
+ <!-- footnote: format as endnote, actually -->
801
+ <xsl:template match="footnote">
802
+ <xsl:variable name="this-note-id">
803
+ <xsl:choose>
804
+ <xsl:when test="@id">
805
+ <xsl:value-of select="@id"/>
806
+ </xsl:when>
807
+ <xsl:otherwise>
808
+ <xsl:value-of select="generate-id(.)"/>
809
+ </xsl:otherwise>
810
+ </xsl:choose>
811
+ </xsl:variable>
812
+ <sup>
813
+ <xsl:text>[</xsl:text>
814
+ <a name="FN-ANCH-{$this-note-id}" id="FN-ANCH-{$this-note-id}"
815
+ href="#{$this-note-id}">
816
+ <xsl:apply-templates select="." mode="number-simple"/>
817
+ </a>
818
+ <xsl:text>]</xsl:text>
819
+ </sup>
820
+ </xsl:template>
821
+
822
+ <!-- front: front matter for the spec -->
823
+ <!-- make a div for cleanliness -->
824
+ <xsl:template match="front">
825
+ <div class="front">
826
+ <xsl:apply-templates/>
827
+ </div>
828
+ </xsl:template>
829
+
830
+ <!-- function: name of a function -->
831
+ <!-- format as HTML <code> for monospaced presentation -->
832
+ <xsl:template match="function">
833
+ <code><xsl:apply-templates/></code>
834
+ </xsl:template>
835
+
836
+ <!-- gitem: glossary list entry -->
837
+ <!-- just pass children through for <dd>/<dt> formatting -->
838
+ <xsl:template match="gitem">
839
+ <xsl:apply-templates/>
840
+ </xsl:template>
841
+
842
+ <!-- glist: glossary list -->
843
+ <!-- create <dl> and handle children -->
844
+ <xsl:template match="glist">
845
+ <xsl:if test="$validity.hacks and local-name(..) = 'p'">
846
+ <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
847
+ </xsl:if>
848
+ <dl>
849
+ <xsl:apply-templates/>
850
+ </dl>
851
+ <xsl:if test="$validity.hacks and local-name(..) = 'p'">
852
+ <xsl:text disable-output-escaping="yes">&lt;p&gt;</xsl:text>
853
+ </xsl:if>
854
+ </xsl:template>
855
+
856
+ <!-- graphic: external illustration -->
857
+ <!-- reference external graphic file with alt text -->
858
+ <xsl:template match="graphic">
859
+ <img src="{@source}">
860
+ <xsl:if test="@alt">
861
+ <xsl:attribute name="alt">
862
+ <xsl:value-of select="@alt"/>
863
+ </xsl:attribute>
864
+ </xsl:if>
865
+ </img>
866
+ </xsl:template>
867
+
868
+ <!-- group: -->
869
+ <!-- IDL stuff isn't handled yet -->
870
+
871
+ <!-- head: title for a variety of constructs -->
872
+
873
+ <!-- constraintnotes have different types, but they're
874
+ non-enumerated; nothing is done with them right now -->
875
+ <xsl:template match="constraintnote/head">
876
+ <p class="prefix">
877
+ <xsl:if test="../@id">
878
+ <a name="{../@id}" id="{../@id}"/>
879
+ </xsl:if>
880
+ <b><xsl:text>Constraint: </xsl:text><xsl:apply-templates/></b>
881
+ </p>
882
+ </xsl:template>
883
+
884
+ <xsl:template match="div1/head">
885
+ <xsl:text>&#10;</xsl:text>
886
+ <h2>
887
+ <xsl:call-template name="anchor">
888
+ <xsl:with-param name="conditional" select="0"/>
889
+ <xsl:with-param name="node" select=".."/>
890
+ </xsl:call-template>
891
+ <xsl:apply-templates select=".." mode="divnum"/>
892
+ <xsl:apply-templates/>
893
+ </h2>
894
+ </xsl:template>
895
+
896
+ <xsl:template match="div2/head">
897
+ <xsl:text>&#10;</xsl:text>
898
+ <h3>
899
+ <xsl:call-template name="anchor">
900
+ <xsl:with-param name="conditional" select="0"/>
901
+ <xsl:with-param name="node" select=".."/>
902
+ </xsl:call-template>
903
+ <xsl:apply-templates select=".." mode="divnum"/>
904
+ <xsl:apply-templates/>
905
+ </h3>
906
+ </xsl:template>
907
+
908
+ <xsl:template match="div3/head">
909
+ <xsl:text>&#10;</xsl:text>
910
+ <h4>
911
+ <xsl:call-template name="anchor">
912
+ <xsl:with-param name="conditional" select="0"/>
913
+ <xsl:with-param name="node" select=".."/>
914
+ </xsl:call-template>
915
+ <xsl:apply-templates select=".." mode="divnum"/>
916
+ <xsl:apply-templates/>
917
+ </h4>
918
+ </xsl:template>
919
+
920
+ <xsl:template match="div4/head">
921
+ <xsl:text>&#10;</xsl:text>
922
+ <h5>
923
+ <xsl:call-template name="anchor">
924
+ <xsl:with-param name="conditional" select="0"/>
925
+ <xsl:with-param name="node" select=".."/>
926
+ </xsl:call-template>
927
+ <xsl:apply-templates select=".." mode="divnum"/>
928
+ <xsl:apply-templates/>
929
+ </h5>
930
+ </xsl:template>
931
+
932
+ <xsl:template match="div5/head">
933
+ <xsl:text>&#10;</xsl:text>
934
+ <h6>
935
+ <xsl:call-template name="anchor">
936
+ <xsl:with-param name="conditional" select="0"/>
937
+ <xsl:with-param name="node" select=".."/>
938
+ </xsl:call-template>
939
+ <xsl:apply-templates select=".." mode="divnum"/>
940
+ <xsl:apply-templates/>
941
+ </h6>
942
+ </xsl:template>
943
+
944
+ <xsl:template match="inform-div1/head">
945
+ <xsl:text>&#10;</xsl:text>
946
+ <h2>
947
+ <xsl:call-template name="anchor">
948
+ <xsl:with-param name="conditional" select="0"/>
949
+ <xsl:with-param name="node" select=".."/>
950
+ </xsl:call-template>
951
+ <xsl:apply-templates select=".." mode="divnum"/>
952
+ <xsl:apply-templates/>
953
+ <xsl:text> (Non-Normative)</xsl:text>
954
+ </h2>
955
+ </xsl:template>
956
+
957
+ <xsl:template match="issue/head">
958
+ <p class="prefix">
959
+ <b><xsl:apply-templates/></b>
960
+ </p>
961
+ </xsl:template>
962
+
963
+ <xsl:template match="scrap/head">
964
+ <xsl:text>&#10;</xsl:text>
965
+ <h5>
966
+ <xsl:call-template name="anchor">
967
+ <xsl:with-param name="node" select=".."/>
968
+ <xsl:with-param name="conditional" select="0"/>
969
+ </xsl:call-template>
970
+
971
+ <xsl:apply-templates/>
972
+ </h5>
973
+ </xsl:template>
974
+
975
+ <xsl:template match="vcnote/head">
976
+ <p class="prefix">
977
+ <xsl:if test="../@id">
978
+ <a name="{../@id}" id="{../@id}"/>
979
+ </xsl:if>
980
+ <b><xsl:text>Validity constraint: </xsl:text><xsl:apply-templates/></b>
981
+ </p>
982
+ </xsl:template>
983
+
984
+ <xsl:template match="wfcnote/head">
985
+ <p class="prefix">
986
+ <xsl:if test="../@id">
987
+ <a name="{../@id}" id="{../@id}"/>
988
+ </xsl:if>
989
+ <b><xsl:text>Well-formedness constraint: </xsl:text><xsl:apply-templates/></b>
990
+ </p>
991
+ </xsl:template>
992
+
993
+ <!-- header: metadata about the spec -->
994
+ <!-- pull out information into standard W3C layout -->
995
+ <xsl:template match="header">
996
+ <div class="head">
997
+ <xsl:if test="not(/spec/@role='editors-copy')">
998
+ <p>
999
+ <a href="http://www.w3.org/">
1000
+ <img src="http://www.w3.org/Icons/w3c_home"
1001
+ alt="W3C" height="48" width="72"/>
1002
+ </a>
1003
+ </p>
1004
+ </xsl:if>
1005
+ <xsl:text>&#10;</xsl:text>
1006
+ <h1>
1007
+ <xsl:call-template name="anchor">
1008
+ <xsl:with-param name="node" select="title[1]"/>
1009
+ <xsl:with-param name="conditional" select="0"/>
1010
+ <xsl:with-param name="default.id" select="'title'"/>
1011
+ </xsl:call-template>
1012
+
1013
+ <xsl:apply-templates select="title"/>
1014
+ <xsl:if test="version">
1015
+ <xsl:text> </xsl:text>
1016
+ <xsl:apply-templates select="version"/>
1017
+ </xsl:if>
1018
+ </h1>
1019
+ <xsl:if test="subtitle">
1020
+ <xsl:text>&#10;</xsl:text>
1021
+ <h2>
1022
+ <xsl:call-template name="anchor">
1023
+ <xsl:with-param name="node" select="subtitle[1]"/>
1024
+ <xsl:with-param name="conditional" select="0"/>
1025
+ <xsl:with-param name="default.id" select="'subtitle'"/>
1026
+ </xsl:call-template>
1027
+ <xsl:apply-templates select="subtitle"/>
1028
+ </h2>
1029
+ </xsl:if>
1030
+ <xsl:text>&#10;</xsl:text>
1031
+ <h2>
1032
+ <xsl:call-template name="anchor">
1033
+ <xsl:with-param name="node" select="w3c-doctype[1]"/>
1034
+ <xsl:with-param name="conditional" select="0"/>
1035
+ <xsl:with-param name="default.id" select="'w3c-doctype'"/>
1036
+ </xsl:call-template>
1037
+
1038
+ <xsl:apply-templates select="w3c-doctype"/>
1039
+ <xsl:text> </xsl:text>
1040
+ <xsl:if test="pubdate/day">
1041
+ <xsl:apply-templates select="pubdate/day"/>
1042
+ <xsl:text> </xsl:text>
1043
+ </xsl:if>
1044
+ <xsl:apply-templates select="pubdate/month"/>
1045
+ <xsl:text> </xsl:text>
1046
+ <xsl:apply-templates select="pubdate/year"/>
1047
+ </h2>
1048
+ <dl>
1049
+ <xsl:apply-templates select="publoc"/>
1050
+ <xsl:apply-templates select="latestloc"/>
1051
+ <xsl:apply-templates select="prevlocs"/>
1052
+ <xsl:apply-templates select="authlist"/>
1053
+ </dl>
1054
+
1055
+ <!-- output the altlocs -->
1056
+ <xsl:apply-templates select="altlocs"/>
1057
+
1058
+ <xsl:choose>
1059
+ <xsl:when test="copyright">
1060
+ <xsl:apply-templates select="copyright"/>
1061
+ </xsl:when>
1062
+ <xsl:otherwise>
1063
+
1064
+ <p class="copyright"><a
1065
+ href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
1066
+ Copyright</a> &#xa9; 1998-2003 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>&#xae;</sup> (<a href="http://www.lcs.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>, <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a> rules apply.</p>
1067
+
1068
+ </xsl:otherwise>
1069
+ </xsl:choose>
1070
+ </div>
1071
+ <hr/>
1072
+ <xsl:apply-templates select="notice"/>
1073
+ <xsl:apply-templates select="abstract"/>
1074
+ <xsl:apply-templates select="status"/>
1075
+ </xsl:template>
1076
+
1077
+ <xsl:template match="copyright">
1078
+ <xsl:apply-templates/>
1079
+ </xsl:template>
1080
+
1081
+ <xsl:template match="copyright/p">
1082
+ <p class="copyright">
1083
+ <xsl:apply-templates/>
1084
+ </p>
1085
+ </xsl:template>
1086
+
1087
+ <!-- inform-div1: non-normative back matter top-level division -->
1088
+ <!-- treat like div1 except add "(Non-Normative)" to title -->
1089
+ <xsl:template match="inform-div1">
1090
+ <div class="div1">
1091
+ <xsl:apply-templates/>
1092
+ </div>
1093
+ </xsl:template>
1094
+
1095
+ <!-- interface: -->
1096
+ <!-- IDL stuff isn't handled yet -->
1097
+
1098
+ <!-- issue: open issue before the Working Group -->
1099
+ <!-- maintain an ID for linking to it -->
1100
+ <!-- currently generates boilerplate head plus optional head child
1101
+ element; this should probably be cleaned up to only use the
1102
+ head if it's present -->
1103
+ <xsl:template match="issue">
1104
+ <div class="issue">
1105
+ <p class="prefix">
1106
+ <xsl:if test="@id">
1107
+ <a name="{@id}" id="{@id}"/>
1108
+ </xsl:if>
1109
+ <b>
1110
+ <xsl:text>Issue (</xsl:text>
1111
+ <xsl:value-of select="@id"/>
1112
+ <xsl:text>):</xsl:text>
1113
+ </b>
1114
+ </p>
1115
+ <xsl:apply-templates/>
1116
+
1117
+ <xsl:if test="not(resolution)">
1118
+ <p class="prefix">
1119
+ <b>
1120
+ <xsl:text>Resolution:</xsl:text>
1121
+ </b>
1122
+ </p>
1123
+ <p>None recorded.</p>
1124
+ </xsl:if>
1125
+ </div>
1126
+ </xsl:template>
1127
+
1128
+ <!-- item: generic list item -->
1129
+ <xsl:template match="item">
1130
+ <li>
1131
+ <xsl:apply-templates/>
1132
+ </li>
1133
+ </xsl:template>
1134
+
1135
+ <!-- kw: keyword -->
1136
+ <!-- make it bold -->
1137
+ <xsl:template match="kw">
1138
+ <b><xsl:apply-templates/></b>
1139
+ </xsl:template>
1140
+
1141
+ <!-- label: term for defintion in glossary entry -->
1142
+ <!-- already in <dl> context from glist -->
1143
+ <xsl:template match="label">
1144
+ <dt class="label">
1145
+ <xsl:call-template name="anchor">
1146
+ <xsl:with-param name="node" select=".."/>
1147
+ </xsl:call-template>
1148
+ <xsl:call-template name="anchor"/>
1149
+
1150
+ <xsl:apply-templates/>
1151
+ </dt>
1152
+ </xsl:template>
1153
+
1154
+ <!-- language: -->
1155
+ <!-- langusage: -->
1156
+ <!-- identify language usage within a spec; not actually formatted -->
1157
+
1158
+ <!-- latestloc: latest location for this spec -->
1159
+ <!-- called in a <dl> context from header -->
1160
+ <xsl:template match="latestloc">
1161
+ <dt>Latest version:</dt>
1162
+ <dd>
1163
+ <xsl:apply-templates/>
1164
+ </dd>
1165
+ </xsl:template>
1166
+
1167
+ <!-- lhs: left-hand side of formal productions -->
1168
+ <!-- make a table row with the lhs and the corresponding other
1169
+ pieces in this crazy mixed-up content model -->
1170
+ <xsl:template match="lhs">
1171
+ <tr valign="baseline">
1172
+ <td>
1173
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
1174
+ <xsl:attribute name="class">
1175
+ <xsl:text>diff-</xsl:text>
1176
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
1177
+ </xsl:attribute>
1178
+ </xsl:if>
1179
+ <xsl:if test="../@id">
1180
+ <a name="{../@id}" id="{../@id}"/>
1181
+ </xsl:if>
1182
+ <xsl:apply-templates select="ancestor::prod" mode="number"/>
1183
+ <!--
1184
+ This could be done right here, but XT goes into deep space when the
1185
+ node to be numbered isn't the current node and level="any":
1186
+ <xsl:number count="prod" level="any" from="spec"
1187
+ format="[1]"/>
1188
+ -->
1189
+ <xsl:text>&#xa0;&#xa0;&#xa0;</xsl:text>
1190
+ </td>
1191
+ <td>
1192
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
1193
+ <xsl:attribute name="class">
1194
+ <xsl:text>diff-</xsl:text>
1195
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
1196
+ </xsl:attribute>
1197
+ </xsl:if>
1198
+ <code><xsl:apply-templates/></code>
1199
+ </td>
1200
+ <td>
1201
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
1202
+ <xsl:attribute name="class">
1203
+ <xsl:text>diff-</xsl:text>
1204
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
1205
+ </xsl:attribute>
1206
+ </xsl:if>
1207
+ <xsl:text>&#xa0;&#xa0;&#xa0;::=&#xa0;&#xa0;&#xa0;</xsl:text>
1208
+ </td>
1209
+ <xsl:apply-templates
1210
+ select="following-sibling::*[1][name()='rhs']"/>
1211
+ </tr>
1212
+ </xsl:template>
1213
+
1214
+ <!-- loc: a Web location -->
1215
+ <!-- outside the header, it's a normal cross-reference -->
1216
+ <xsl:template match="loc">
1217
+ <a href="{@href}">
1218
+ <xsl:apply-templates/>
1219
+ </a>
1220
+ </xsl:template>
1221
+
1222
+ <!-- member: member of an organization -->
1223
+ <!-- appears only in orglist, which creates <ul> context -->
1224
+ <xsl:template match="member">
1225
+ <li>
1226
+ <xsl:apply-templates/>
1227
+ </li>
1228
+ </xsl:template>
1229
+
1230
+ <!-- method: -->
1231
+ <!-- IDL stuff isn't handled yet -->
1232
+
1233
+ <!-- module: -->
1234
+ <!-- IDL stuff isn't handled yet -->
1235
+
1236
+ <!-- month: month of spec -->
1237
+ <!-- only used in pudate; called directly from header template -->
1238
+ <xsl:template match="month">
1239
+ <xsl:apply-templates/>
1240
+ </xsl:template>
1241
+
1242
+ <!-- name: name of an editor or organization member -->
1243
+ <!-- only appears in author and member -->
1244
+ <!-- just output text -->
1245
+ <xsl:template match="name">
1246
+ <xsl:apply-templates/>
1247
+ </xsl:template>
1248
+
1249
+ <!-- note: a note about the spec -->
1250
+ <xsl:template match="note">
1251
+ <div class="note">
1252
+ <p class="prefix">
1253
+ <b>Note:</b>
1254
+ </p>
1255
+ <xsl:apply-templates/>
1256
+ </div>
1257
+ </xsl:template>
1258
+
1259
+ <!-- notice: a front-matter advisory about the spec's status -->
1260
+ <!-- make sure people notice it -->
1261
+ <xsl:template match="notice">
1262
+ <div class="notice">
1263
+ <p class="prefix">
1264
+ <b>NOTICE:</b>
1265
+ </p>
1266
+ <xsl:apply-templates/>
1267
+ </div>
1268
+ </xsl:template>
1269
+
1270
+ <!-- nt: production non-terminal -->
1271
+ <!-- make a link to the non-terminal's definition -->
1272
+ <xsl:template match="nt">
1273
+ <a>
1274
+ <xsl:attribute name="href">
1275
+ <xsl:call-template name="href.target">
1276
+ <xsl:with-param name="target" select="key('ids', @def)"/>
1277
+ </xsl:call-template>
1278
+ </xsl:attribute>
1279
+ <xsl:apply-templates/>
1280
+ </a>
1281
+ </xsl:template>
1282
+
1283
+ <!-- ====================================================================== -->
1284
+ <!-- OrderedList Numeration -->
1285
+
1286
+ <xsl:template name="next.numeration">
1287
+ <xsl:param name="numeration" select="'default'"/>
1288
+ <xsl:choose>
1289
+ <!-- Change this list if you want to change the order of numerations -->
1290
+ <xsl:when test="$numeration = 'arabic'">loweralpha</xsl:when>
1291
+ <xsl:when test="$numeration = 'loweralpha'">lowerroman</xsl:when>
1292
+ <xsl:when test="$numeration = 'lowerroman'">upperalpha</xsl:when>
1293
+ <xsl:when test="$numeration = 'upperalpha'">upperroman</xsl:when>
1294
+ <xsl:when test="$numeration = 'upperroman'">arabic</xsl:when>
1295
+ <xsl:otherwise>arabic</xsl:otherwise>
1296
+ </xsl:choose>
1297
+ </xsl:template>
1298
+
1299
+ <xsl:template name="list.numeration">
1300
+ <xsl:param name="node" select="."/>
1301
+
1302
+ <xsl:choose>
1303
+ <xsl:when test="$node/ancestor::olist">
1304
+ <xsl:call-template name="next.numeration">
1305
+ <xsl:with-param name="numeration">
1306
+ <xsl:call-template name="list.numeration">
1307
+ <xsl:with-param name="node" select="$node/ancestor::olist[1]"/>
1308
+ </xsl:call-template>
1309
+ </xsl:with-param>
1310
+ </xsl:call-template>
1311
+ </xsl:when>
1312
+ <xsl:otherwise>
1313
+ <xsl:call-template name="next.numeration"/>
1314
+ </xsl:otherwise>
1315
+ </xsl:choose>
1316
+ </xsl:template>
1317
+
1318
+ <!-- olist: an ordered list -->
1319
+ <xsl:template match="olist">
1320
+ <xsl:variable name="numeration">
1321
+ <xsl:call-template name="list.numeration"/>
1322
+ </xsl:variable>
1323
+
1324
+ <xsl:variable name="type">
1325
+ <xsl:choose>
1326
+ <xsl:when test="$numeration='arabic'">1</xsl:when>
1327
+ <xsl:when test="$numeration='loweralpha'">a</xsl:when>
1328
+ <xsl:when test="$numeration='lowerroman'">i</xsl:when>
1329
+ <xsl:when test="$numeration='upperalpha'">A</xsl:when>
1330
+ <xsl:when test="$numeration='upperroman'">I</xsl:when>
1331
+ <!-- What!? This should never happen -->
1332
+ <xsl:otherwise>
1333
+ <xsl:message>
1334
+ <xsl:text>Unexpected numeration: </xsl:text>
1335
+ <xsl:value-of select="$numeration"/>
1336
+ </xsl:message>
1337
+ <xsl:value-of select="1"/>
1338
+ </xsl:otherwise>
1339
+ </xsl:choose>
1340
+ </xsl:variable>
1341
+
1342
+ <ol type="{$type}">
1343
+ <xsl:apply-templates/>
1344
+ </ol>
1345
+ </xsl:template>
1346
+
1347
+ <!-- orglist: a list of an organization's members -->
1348
+ <xsl:template match="orglist">
1349
+ <ul>
1350
+ <xsl:apply-templates/>
1351
+ </ul>
1352
+ </xsl:template>
1353
+
1354
+ <!-- p: a standard paragraph -->
1355
+ <xsl:template match="p">
1356
+ <p>
1357
+ <xsl:if test="@id">
1358
+ <xsl:attribute name="id">
1359
+ <xsl:value-of select="@id"/>
1360
+ </xsl:attribute>
1361
+ </xsl:if>
1362
+ <xsl:if test="@role">
1363
+ <xsl:attribute name="class">
1364
+ <xsl:value-of select="@role"/>
1365
+ </xsl:attribute>
1366
+ </xsl:if>
1367
+ <xsl:apply-templates/>
1368
+ </p>
1369
+ </xsl:template>
1370
+
1371
+ <!-- param: -->
1372
+ <!-- IDL stuff isn't handled yet -->
1373
+
1374
+ <!-- parameters: -->
1375
+ <!-- IDL stuff isn't handled yet -->
1376
+
1377
+ <!-- phrase: semantically meaningless markup hanger -->
1378
+ <!-- role attributes may be used to request different formatting,
1379
+ which isn't currently handled -->
1380
+ <xsl:template match="phrase">
1381
+ <xsl:apply-templates/>
1382
+ </xsl:template>
1383
+
1384
+ <!-- prevlocs: previous locations for this spec -->
1385
+ <!-- called in a <dl> context from header -->
1386
+ <xsl:template match="prevlocs">
1387
+ <dt>
1388
+ <xsl:text>Previous version</xsl:text>
1389
+ <xsl:if test="count(loc) &gt; 1">s</xsl:if>
1390
+ <xsl:text>:</xsl:text>
1391
+ </dt>
1392
+ <dd>
1393
+ <xsl:apply-templates/>
1394
+ </dd>
1395
+ </xsl:template>
1396
+
1397
+ <!-- prod: a formal grammar production -->
1398
+ <!-- if not in a prodgroup, needs a <tbody> -->
1399
+ <!-- has a weird content model; makes a table but there are no
1400
+ explicit rules; many different things can start a new row -->
1401
+ <!-- process the first child in each row, and it will process the
1402
+ others -->
1403
+ <xsl:template match="prod">
1404
+ <tbody>
1405
+ <xsl:apply-templates
1406
+ select="lhs |
1407
+ rhs[preceding-sibling::*[1][name()!='lhs']] |
1408
+ com[preceding-sibling::*[1][name()!='rhs']] |
1409
+ constraint[preceding-sibling::*[1][name()!='rhs']] |
1410
+ vc[preceding-sibling::*[1][name()!='rhs']] |
1411
+ wfc[preceding-sibling::*[1][name()!='rhs']]"/>
1412
+ </tbody>
1413
+ </xsl:template>
1414
+
1415
+ <xsl:template match="prodgroup/prod">
1416
+ <xsl:apply-templates
1417
+ select="lhs |
1418
+ rhs[preceding-sibling::*[1][name()!='lhs']] |
1419
+ com[preceding-sibling::*[1][name()!='rhs']] |
1420
+ constraint[preceding-sibling::*[1][name()!='rhs']] |
1421
+ vc[preceding-sibling::*[1][name()!='rhs']] |
1422
+ wfc[preceding-sibling::*[1][name()!='rhs']]"/>
1423
+ </xsl:template>
1424
+
1425
+ <!-- prodgroup: group of formal productions -->
1426
+ <!-- create one <tbody> for each group -->
1427
+ <xsl:template match="prodgroup">
1428
+ <tbody>
1429
+ <xsl:apply-templates/>
1430
+ </tbody>
1431
+ </xsl:template>
1432
+
1433
+ <!-- prodrecap: reiteration of a prod -->
1434
+ <!-- process the prod in another node that will never generate a
1435
+ <tbody> or a number, plus links the lhs to the original
1436
+ production -->
1437
+ <xsl:template match="prodrecap">
1438
+ <tbody>
1439
+ <xsl:apply-templates select="key('ids', @ref)" mode="ref"/>
1440
+ </tbody>
1441
+ </xsl:template>
1442
+
1443
+ <!-- proto: function prototype -->
1444
+ <!-- type and name of the function, with arguments in parens -->
1445
+ <xsl:template match="proto">
1446
+ <p>
1447
+ <em><xsl:value-of select="@return-type"/></em>
1448
+ <xsl:text> </xsl:text>
1449
+ <b><xsl:value-of select="@name"/></b>
1450
+ <xsl:text>(</xsl:text>
1451
+ <xsl:apply-templates/>
1452
+ <xsl:text>)</xsl:text>
1453
+ </p>
1454
+ </xsl:template>
1455
+
1456
+ <!-- pubdate: date of spec -->
1457
+ <!-- called directly from header -->
1458
+
1459
+ <!-- publoc: location of current version of spec -->
1460
+ <!-- called from header in <dl> context -->
1461
+ <xsl:template match="publoc">
1462
+ <dt>This version:</dt>
1463
+ <dd>
1464
+ <xsl:apply-templates/>
1465
+ </dd>
1466
+ </xsl:template>
1467
+
1468
+ <xsl:template match="altlocs">
1469
+ <p>
1470
+ <xsl:text>This document is also available </xsl:text>
1471
+ <xsl:text>in these non-normative formats: </xsl:text>
1472
+ <xsl:for-each select="loc">
1473
+ <xsl:if test="position() &gt; 1">
1474
+ <xsl:if test="last() &gt; 2">
1475
+ <xsl:text>, </xsl:text>
1476
+ </xsl:if>
1477
+ <xsl:if test="last() = 2">
1478
+ <xsl:text> </xsl:text>
1479
+ </xsl:if>
1480
+ </xsl:if>
1481
+ <xsl:if test="position() = last() and position() &gt; 1">and&#160;</xsl:if>
1482
+ <a href="{@href}"><xsl:apply-templates/></a>
1483
+ </xsl:for-each>
1484
+ <xsl:text>.</xsl:text>
1485
+ </p>
1486
+ </xsl:template>
1487
+
1488
+ <!-- pubstmt: statement of publication -->
1489
+ <!-- not currently output -->
1490
+
1491
+ <!-- quote: a quoted string or phrase -->
1492
+ <!-- it would be nice to use HTML <q> elements, but browser support
1493
+ is abysmal -->
1494
+ <xsl:template match="quote">
1495
+ <xsl:text>"</xsl:text>
1496
+ <xsl:apply-templates/>
1497
+ <xsl:text>"</xsl:text>
1498
+ </xsl:template>
1499
+
1500
+ <!-- raises: -->
1501
+ <!-- IDL stuff isn't handled yet -->
1502
+
1503
+ <!-- reference: -->
1504
+ <!-- IDL stuff isn't handled yet -->
1505
+
1506
+ <!-- resolution: resolution of an issue -->
1507
+ <xsl:template match="resolution">
1508
+ <p class="prefix">
1509
+ <b>
1510
+ <xsl:if test="@role='partial'">Partial </xsl:if>
1511
+ <xsl:text>Resolution:</xsl:text>
1512
+ </b>
1513
+ </p>
1514
+ <xsl:apply-templates/>
1515
+ </xsl:template>
1516
+
1517
+ <!-- returns: -->
1518
+ <!-- IDL stuff isn't handled yet -->
1519
+
1520
+ <!-- revisiondesc: description of spec revision -->
1521
+ <!-- used for internal tracking; not formatted -->
1522
+
1523
+ <!-- rhs: right-hand side of a formal production -->
1524
+ <!-- make a table cell; if it's not the first after an LHS, make a
1525
+ new row, too -->
1526
+ <xsl:template match="rhs">
1527
+ <xsl:choose>
1528
+ <xsl:when test="preceding-sibling::*[1][name()='lhs']">
1529
+ <td>
1530
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
1531
+ <xsl:attribute name="class">
1532
+ <xsl:text>diff-</xsl:text>
1533
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
1534
+ </xsl:attribute>
1535
+ </xsl:if>
1536
+ <code><xsl:apply-templates/></code>
1537
+ </td>
1538
+ <xsl:apply-templates
1539
+ select="following-sibling::*[1][name()='com' or
1540
+ name()='constraint' or
1541
+ name()='vc' or
1542
+ name()='wfc']"/>
1543
+ </xsl:when>
1544
+ <xsl:otherwise>
1545
+ <tr valign="baseline">
1546
+ <td/><td/><td/>
1547
+ <td>
1548
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
1549
+ <xsl:attribute name="class">
1550
+ <xsl:text>diff-</xsl:text>
1551
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
1552
+ </xsl:attribute>
1553
+ </xsl:if>
1554
+ <code><xsl:apply-templates/></code>
1555
+ </td>
1556
+ <xsl:apply-templates
1557
+ select="following-sibling::*[1][name()='com' or
1558
+ name()='constraint' or
1559
+ name()='vc' or
1560
+ name()='wfc']"/>
1561
+ </tr>
1562
+ </xsl:otherwise>
1563
+ </xsl:choose>
1564
+ </xsl:template>
1565
+
1566
+ <!-- role: part played by a member of an organization -->
1567
+ <xsl:template match="role">
1568
+ <xsl:text> (</xsl:text>
1569
+ <i><xsl:apply-templates/></i>
1570
+ <xsl:text>) </xsl:text>
1571
+ </xsl:template>
1572
+
1573
+ <!-- scrap: series of formal grammar productions -->
1574
+ <!-- set up a <table> and handle children -->
1575
+ <xsl:template match="scrap">
1576
+ <xsl:apply-templates select="head"/>
1577
+ <table class="scrap" summary="Scrap">
1578
+ <xsl:apply-templates select="bnf | prod | prodgroup"/>
1579
+ </table>
1580
+ </xsl:template>
1581
+
1582
+ <!-- sequence: -->
1583
+ <!-- IDL stuff isn't handled yet -->
1584
+
1585
+ <!-- sitem: simple list item -->
1586
+ <!-- just make one paragraph with <br>s between items -->
1587
+ <xsl:template match="sitem">
1588
+ <xsl:apply-templates/>
1589
+ </xsl:template>
1590
+
1591
+ <xsl:template match="sitem[position() &gt; 1]" priority="2">
1592
+ <br/>
1593
+ <xsl:apply-templates/>
1594
+ </xsl:template>
1595
+
1596
+ <!-- slist: simple list -->
1597
+ <!-- using a <blockquote> to indent the list is very wrong, but it works -->
1598
+ <xsl:template match="slist">
1599
+ <blockquote>
1600
+ <p>
1601
+ <xsl:apply-templates/>
1602
+ </p>
1603
+ </blockquote>
1604
+ </xsl:template>
1605
+
1606
+ <!-- source: the source of an issue -->
1607
+ <xsl:template match="source">
1608
+ <p>
1609
+ <b>Source</b>
1610
+ <xsl:text>: </xsl:text>
1611
+ <xsl:apply-templates/>
1612
+ </p>
1613
+ </xsl:template>
1614
+
1615
+ <!-- sourcedesc: description of spec preparation -->
1616
+ <!-- used for tracking the source, but not formatted -->
1617
+
1618
+ <!-- spec: the specification itself -->
1619
+ <xsl:template match="spec">
1620
+ <html>
1621
+ <xsl:if test="header/langusage/language">
1622
+ <xsl:attribute name="lang">
1623
+ <xsl:value-of select="header/langusage/language/@id"/>
1624
+ </xsl:attribute>
1625
+ </xsl:if>
1626
+ <head>
1627
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
1628
+ <title>
1629
+ <xsl:apply-templates select="header/title"/>
1630
+ <xsl:if test="header/version">
1631
+ <xsl:text> </xsl:text>
1632
+ <xsl:apply-templates select="header/version"/>
1633
+ </xsl:if>
1634
+ <xsl:if test="$additional.title != ''">
1635
+ <xsl:text> -- </xsl:text>
1636
+ <xsl:value-of select="$additional.title"/>
1637
+ </xsl:if>
1638
+ </title>
1639
+ <xsl:call-template name="css"/>
1640
+ </head>
1641
+ <body>
1642
+ <xsl:apply-templates/>
1643
+ <xsl:if test="//footnote[not(ancestor::table)]">
1644
+ <hr/>
1645
+ <div class="endnotes">
1646
+ <xsl:text>&#10;</xsl:text>
1647
+ <h3>
1648
+ <xsl:call-template name="anchor">
1649
+ <xsl:with-param name="conditional" select="0"/>
1650
+ <xsl:with-param name="default.id" select="'endnotes'"/>
1651
+ </xsl:call-template>
1652
+ <xsl:text>End Notes</xsl:text>
1653
+ </h3>
1654
+ <dl>
1655
+ <xsl:apply-templates select="//footnote[not(ancestor::table)]"
1656
+ mode="notes"/>
1657
+ </dl>
1658
+ </div>
1659
+ </xsl:if>
1660
+ </body>
1661
+ </html>
1662
+ </xsl:template>
1663
+
1664
+ <!-- specref: reference to another part of teh current specification -->
1665
+ <xsl:template match="specref">
1666
+ <xsl:variable name="target" select="key('ids', @ref)[1]"/>
1667
+
1668
+ <xsl:choose>
1669
+ <xsl:when test="local-name($target)='issue'">
1670
+ <xsl:text>[</xsl:text>
1671
+ <a>
1672
+ <xsl:attribute name="href">
1673
+ <xsl:call-template name="href.target">
1674
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1675
+ </xsl:call-template>
1676
+ </xsl:attribute>
1677
+ <b>
1678
+ <xsl:text>Issue </xsl:text>
1679
+ <xsl:apply-templates select="key('ids', @ref)" mode="number"/>
1680
+ <xsl:text>: </xsl:text>
1681
+ <xsl:for-each select="key('ids', @ref)/head">
1682
+ <xsl:apply-templates/>
1683
+ </xsl:for-each>
1684
+ </b>
1685
+ </a>
1686
+ <xsl:text>]</xsl:text>
1687
+ </xsl:when>
1688
+ <xsl:when test="starts-with(local-name($target), 'div')">
1689
+ <a>
1690
+ <xsl:attribute name="href">
1691
+ <xsl:call-template name="href.target">
1692
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1693
+ </xsl:call-template>
1694
+ </xsl:attribute>
1695
+ <b>
1696
+ <xsl:apply-templates select="key('ids', @ref)" mode="divnum"/>
1697
+ <xsl:apply-templates select="key('ids', @ref)/head" mode="text"/>
1698
+ </b>
1699
+ </a>
1700
+ </xsl:when>
1701
+ <xsl:when test="starts-with(local-name($target), 'inform-div')">
1702
+ <a>
1703
+ <xsl:attribute name="href">
1704
+ <xsl:call-template name="href.target">
1705
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1706
+ </xsl:call-template>
1707
+ </xsl:attribute>
1708
+ <b>
1709
+ <xsl:apply-templates select="key('ids', @ref)" mode="divnum"/>
1710
+ <xsl:apply-templates select="key('ids', @ref)/head" mode="text"/>
1711
+ </b>
1712
+ </a>
1713
+ </xsl:when>
1714
+ <xsl:when test="local-name($target) = 'vcnote'">
1715
+ <b>
1716
+ <xsl:text>[VC: </xsl:text>
1717
+ <a>
1718
+ <xsl:attribute name="href">
1719
+ <xsl:call-template name="href.target">
1720
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1721
+ </xsl:call-template>
1722
+ </xsl:attribute>
1723
+ <xsl:apply-templates select="key('ids', @ref)/head" mode="text"/>
1724
+ </a>
1725
+ <xsl:text>]</xsl:text>
1726
+ </b>
1727
+ </xsl:when>
1728
+ <xsl:when test="local-name($target) = 'prod'">
1729
+ <b>
1730
+ <xsl:text>[PROD: </xsl:text>
1731
+ <a>
1732
+ <xsl:attribute name="href">
1733
+ <xsl:call-template name="href.target">
1734
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1735
+ </xsl:call-template>
1736
+ </xsl:attribute>
1737
+ <xsl:apply-templates select="$target" mode="number-simple"/>
1738
+ </a>
1739
+ <xsl:text>]</xsl:text>
1740
+ </b>
1741
+ </xsl:when>
1742
+ <xsl:when test="local-name($target) = 'label'">
1743
+ <b>
1744
+ <xsl:text>[</xsl:text>
1745
+ <a>
1746
+ <xsl:attribute name="href">
1747
+ <xsl:call-template name="href.target">
1748
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1749
+ </xsl:call-template>
1750
+ </xsl:attribute>
1751
+ <xsl:value-of select="$target"/>
1752
+ </a>
1753
+ <xsl:text>]</xsl:text>
1754
+ </b>
1755
+ </xsl:when>
1756
+ <xsl:otherwise>
1757
+ <xsl:message>
1758
+ <xsl:text>Unsupported specref to </xsl:text>
1759
+ <xsl:value-of select="local-name($target)"/>
1760
+ <xsl:text> [</xsl:text>
1761
+ <xsl:value-of select="@ref"/>
1762
+ <xsl:text>] </xsl:text>
1763
+ <xsl:text> (Contact stylesheet maintainer).</xsl:text>
1764
+ </xsl:message>
1765
+ <b>
1766
+ <a>
1767
+ <xsl:attribute name="href">
1768
+ <xsl:call-template name="href.target">
1769
+ <xsl:with-param name="target" select="key('ids', @ref)"/>
1770
+ </xsl:call-template>
1771
+ </xsl:attribute>
1772
+ <xsl:text>???</xsl:text>
1773
+ </a>
1774
+ </b>
1775
+ </xsl:otherwise>
1776
+ </xsl:choose>
1777
+ </xsl:template>
1778
+
1779
+ <!-- status: the status of the spec -->
1780
+ <xsl:template match="status">
1781
+ <div>
1782
+ <xsl:text>&#10;</xsl:text>
1783
+ <h2>
1784
+ <xsl:call-template name="anchor">
1785
+ <xsl:with-param name="conditional" select="0"/>
1786
+ <xsl:with-param name="default.id" select="'status'"/>
1787
+ </xsl:call-template>
1788
+ <xsl:text>Status of this Document</xsl:text>
1789
+ </h2>
1790
+ <xsl:if test="/spec/@role='editors-copy'">
1791
+ <p><strong>This document is an editors' copy that has
1792
+ no official standing.</strong></p>
1793
+ </xsl:if>
1794
+ <xsl:apply-templates/>
1795
+ </div>
1796
+ </xsl:template>
1797
+
1798
+ <!-- struct: -->
1799
+ <!-- IDL stuff isn't handled yet -->
1800
+
1801
+ <!-- sub: subscript -->
1802
+ <xsl:template match="sub">
1803
+ <sub>
1804
+ <xsl:apply-templates/>
1805
+ </sub>
1806
+ </xsl:template>
1807
+
1808
+ <!-- subtitle: secondary title of spec -->
1809
+ <!-- handled directly within header -->
1810
+ <xsl:template match="title">
1811
+ <xsl:apply-templates/>
1812
+ </xsl:template>
1813
+
1814
+ <!-- sup: superscript -->
1815
+ <xsl:template match="sup">
1816
+ <sup>
1817
+ <xsl:apply-templates/>
1818
+ </sup>
1819
+ </xsl:template>
1820
+
1821
+ <!-- table: the HTML table model adopted wholesale; note however that we -->
1822
+ <!-- do this such that the XHTML stylesheet will do the right thing. -->
1823
+ <xsl:template match="caption|col|colgroup|td|tfoot|th|thead|tr|tbody">
1824
+ <xsl:element name="{local-name(.)}">
1825
+ <xsl:for-each select="@*">
1826
+ <!-- Wait: some of these aren't HTML attributes after all... -->
1827
+ <xsl:if test="local-name(.) != 'diff'">
1828
+ <xsl:copy>
1829
+ <xsl:apply-templates/>
1830
+ </xsl:copy>
1831
+ </xsl:if>
1832
+ </xsl:for-each>
1833
+ <xsl:apply-templates/>
1834
+ </xsl:element>
1835
+ </xsl:template>
1836
+
1837
+ <!-- but table is special, to handle footnotes -->
1838
+ <xsl:template match="table">
1839
+ <table>
1840
+ <xsl:for-each select="@*">
1841
+ <!-- Wait: some of these aren't HTML attributes after all... -->
1842
+ <xsl:if test="local-name(.) != 'diff'">
1843
+ <xsl:copy>
1844
+ <xsl:apply-templates/>
1845
+ </xsl:copy>
1846
+ </xsl:if>
1847
+ </xsl:for-each>
1848
+ <xsl:apply-templates/>
1849
+
1850
+ <xsl:if test=".//footnote">
1851
+ <tbody>
1852
+ <tr>
1853
+ <td>
1854
+ <xsl:apply-templates select=".//footnote" mode="table.notes"/>
1855
+ </td>
1856
+ </tr>
1857
+ </tbody>
1858
+ </xsl:if>
1859
+ </table>
1860
+ </xsl:template>
1861
+
1862
+ <!-- term: the actual mention of a term within a termdef -->
1863
+ <xsl:template match="term">
1864
+ <b><xsl:apply-templates/></b>
1865
+ </xsl:template>
1866
+
1867
+ <!-- termdef: sentence or phrase defining a term -->
1868
+ <xsl:template match="termdef">
1869
+ <xsl:text>[</xsl:text>
1870
+ <a name="{@id}" id="{@id}" title="{@term}">
1871
+ <xsl:text>Definition</xsl:text>
1872
+ </a>
1873
+ <xsl:text>: </xsl:text>
1874
+ <xsl:apply-templates/>
1875
+ <xsl:text>]</xsl:text>
1876
+ </xsl:template>
1877
+
1878
+ <!-- termref: reference to a defined term -->
1879
+ <xsl:template match="termref">
1880
+ <a title="{key('ids', @def)/@term}">
1881
+ <xsl:attribute name="href">
1882
+ <xsl:call-template name="href.target">
1883
+ <xsl:with-param name="target" select="key('ids', @def)"/>
1884
+ </xsl:call-template>
1885
+ </xsl:attribute>
1886
+ <xsl:apply-templates/>
1887
+ </a>
1888
+ </xsl:template>
1889
+
1890
+ <!-- tfoot: see table -->
1891
+ <!-- th: see table -->
1892
+ <!-- thead: see table -->
1893
+
1894
+ <!-- title: title of the specification -->
1895
+ <!-- called directly within header -->
1896
+
1897
+ <!-- titleref: reference to the title of any work -->
1898
+ <!-- if a URL is given, link it -->
1899
+ <xsl:template match="titleref">
1900
+ <xsl:choose>
1901
+ <xsl:when test="@href">
1902
+ <a href="{@href}">
1903
+ <cite>
1904
+ <xsl:apply-templates/>
1905
+ </cite>
1906
+ </a>
1907
+ </xsl:when>
1908
+ <xsl:otherwise>
1909
+ <cite>
1910
+ <xsl:apply-templates/>
1911
+ </cite>
1912
+ </xsl:otherwise>
1913
+ </xsl:choose>
1914
+ </xsl:template>
1915
+
1916
+ <!-- tr: see table -->
1917
+
1918
+ <!-- typedef: -->
1919
+ <!-- IDL stuff isn't handled yet -->
1920
+
1921
+ <!-- typename: -->
1922
+ <!-- IDL stuff isn't handled yet -->
1923
+
1924
+ <!-- ulist: unordered list -->
1925
+ <xsl:template match="ulist">
1926
+ <ul>
1927
+ <xsl:apply-templates/>
1928
+ </ul>
1929
+ </xsl:template>
1930
+
1931
+ <!-- union: -->
1932
+ <!-- IDL stuff isn't handled yet -->
1933
+
1934
+ <!-- var: a variable -->
1935
+ <xsl:template match="var">
1936
+ <var>
1937
+ <xsl:apply-templates/>
1938
+ </var>
1939
+ </xsl:template>
1940
+
1941
+ <!-- vc: validity check reference in a formal production -->
1942
+ <xsl:template match="vc">
1943
+ <xsl:choose>
1944
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
1945
+ <td>
1946
+ <xsl:if test="@diff and $show.diff.markup='1'">
1947
+ <xsl:attribute name="class">
1948
+ <xsl:text>diff-</xsl:text>
1949
+ <xsl:value-of select="@diff"/>
1950
+ </xsl:attribute>
1951
+ </xsl:if>
1952
+ <a>
1953
+ <xsl:attribute name="href">
1954
+ <xsl:call-template name="href.target">
1955
+ <xsl:with-param name="target" select="key('ids', @def)"/>
1956
+ </xsl:call-template>
1957
+ </xsl:attribute>
1958
+ <xsl:text>[VC: </xsl:text>
1959
+ <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
1960
+ <xsl:text>]</xsl:text>
1961
+ </a>
1962
+ </td>
1963
+ </xsl:when>
1964
+ <xsl:otherwise>
1965
+ <tr valign="baseline">
1966
+ <td/><td/><td/><td/>
1967
+ <td>
1968
+ <xsl:if test="@diff and $show.diff.markup='1'">
1969
+ <xsl:attribute name="class">
1970
+ <xsl:text>diff-</xsl:text>
1971
+ <xsl:value-of select="@diff"/>
1972
+ </xsl:attribute>
1973
+ </xsl:if>
1974
+ <a>
1975
+ <xsl:attribute name="href">
1976
+ <xsl:call-template name="href.target">
1977
+ <xsl:with-param name="target" select="key('ids', @def)"/>
1978
+ </xsl:call-template>
1979
+ </xsl:attribute>
1980
+ <xsl:text>[VC: </xsl:text>
1981
+ <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
1982
+ <xsl:text>]</xsl:text>
1983
+ </a>
1984
+ </td>
1985
+ </tr>
1986
+ </xsl:otherwise>
1987
+ </xsl:choose>
1988
+ </xsl:template>
1989
+
1990
+ <!-- vcnote: validity check note after a formal production -->
1991
+ <xsl:template match="vcnote">
1992
+ <div class="constraint">
1993
+ <xsl:apply-templates/>
1994
+ </div>
1995
+ </xsl:template>
1996
+
1997
+ <!-- version: version of this spec -->
1998
+ <!-- called directly from header -->
1999
+ <xsl:template match="version">
2000
+ <xsl:apply-templates/>
2001
+ </xsl:template>
2002
+
2003
+ <!-- w3c-designation: canonical name for this spec -->
2004
+ <!-- not used for formatting -->
2005
+
2006
+ <!-- w3c-doctype: type of document the specification is -->
2007
+ <!-- used by header template to select CSS stylesheet for output
2008
+ HTML -->
2009
+ <xsl:template match="w3c-doctype">
2010
+ <xsl:apply-templates/>
2011
+ </xsl:template>
2012
+
2013
+ <!-- wfc: well-formedness check reference in a formal production -->
2014
+ <xsl:template match="wfc">
2015
+ <xsl:choose>
2016
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
2017
+ <td>
2018
+ <xsl:if test="@diff and $show.diff.markup='1'">
2019
+ <xsl:attribute name="class">
2020
+ <xsl:text>diff-</xsl:text>
2021
+ <xsl:value-of select="@diff"/>
2022
+ </xsl:attribute>
2023
+ </xsl:if>
2024
+ <a>
2025
+ <xsl:attribute name="href">
2026
+ <xsl:call-template name="href.target">
2027
+ <xsl:with-param name="target" select="key('ids', @def)"/>
2028
+ </xsl:call-template>
2029
+ </xsl:attribute>
2030
+ <xsl:text>[WFC: </xsl:text>
2031
+ <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
2032
+ <xsl:text>]</xsl:text>
2033
+ </a>
2034
+ </td>
2035
+ </xsl:when>
2036
+ <xsl:otherwise>
2037
+ <tr valign="baseline">
2038
+ <td/><td/><td/><td/>
2039
+ <td>
2040
+ <xsl:if test="@diff and $show.diff.markup='1'">
2041
+ <xsl:attribute name="class">
2042
+ <xsl:text>diff-</xsl:text>
2043
+ <xsl:value-of select="@diff"/>
2044
+ </xsl:attribute>
2045
+ </xsl:if>
2046
+ <a>
2047
+ <xsl:attribute name="href">
2048
+ <xsl:call-template name="href.target">
2049
+ <xsl:with-param name="target" select="key('ids', @def)"/>
2050
+ </xsl:call-template>
2051
+ </xsl:attribute>
2052
+ <xsl:text>[WFC: </xsl:text>
2053
+ <xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
2054
+ <xsl:text>]</xsl:text>
2055
+ </a>
2056
+ </td>
2057
+ </tr>
2058
+ </xsl:otherwise>
2059
+ </xsl:choose>
2060
+ </xsl:template>
2061
+
2062
+ <!-- wfcnote: well-formedness check note after formal production -->
2063
+ <xsl:template match="wfcnote">
2064
+ <div class="constraint">
2065
+ <xsl:apply-templates/>
2066
+ </div>
2067
+ </xsl:template>
2068
+
2069
+ <!-- xnt: external non-terminal -->
2070
+ <!-- xspecref: external specification reference -->
2071
+ <!-- xtermref: external term reference -->
2072
+ <!-- just link to URI provided -->
2073
+ <xsl:template match="xnt | xspecref | xtermref">
2074
+ <a href="{@href}">
2075
+ <xsl:apply-templates/>
2076
+ </a>
2077
+ </xsl:template>
2078
+
2079
+ <!-- year: year of spec -->
2080
+ <!-- only used in pudate; called directly from header template -->
2081
+ <xsl:template match="year">
2082
+ <xsl:apply-templates/>
2083
+ </xsl:template>
2084
+
2085
+ <!-- Silly HTML elements used for pasting stuff in; shouldn't ever
2086
+ show up in a spec, but they're easy to handle and you just
2087
+ never know. -->
2088
+ <xsl:template match="a|div|em|h1|h2|h3|h4|h5|h6|li|ol|pre|ul">
2089
+ <xsl:element name="{local-name(.)}">
2090
+ <xsl:for-each select="@*">
2091
+ <xsl:copy>
2092
+ <xsl:apply-templates/>
2093
+ </xsl:copy>
2094
+ </xsl:for-each>
2095
+ <xsl:apply-templates/>
2096
+ </xsl:element>
2097
+ </xsl:template>
2098
+
2099
+ <!-- legacy XML spec stuff -->
2100
+ <xsl:template match="htable">
2101
+ <table summary="HTML Table">
2102
+ <xsl:for-each select="@*">
2103
+ <xsl:copy>
2104
+ <xsl:apply-templates/>
2105
+ </xsl:copy>
2106
+ </xsl:for-each>
2107
+ <xsl:apply-templates/>
2108
+ </table>
2109
+ </xsl:template>
2110
+ <xsl:template match="htbody">
2111
+ <tbody>
2112
+ <xsl:for-each select="@*">
2113
+ <xsl:copy>
2114
+ <xsl:apply-templates/>
2115
+ </xsl:copy>
2116
+ </xsl:for-each>
2117
+ <xsl:apply-templates/>
2118
+ </tbody>
2119
+ </xsl:template>
2120
+ <xsl:template match="key-term">
2121
+ <b><xsl:apply-templates/></b>
2122
+ </xsl:template>
2123
+ <xsl:template match="statusp">
2124
+ <p>
2125
+ <xsl:apply-templates/>
2126
+ </p>
2127
+ </xsl:template>
2128
+
2129
+ <!-- legacy DocBook stuff -->
2130
+ <xsl:template match="itemizedlist">
2131
+ <ul>
2132
+ <xsl:apply-templates/>
2133
+ </ul>
2134
+ </xsl:template>
2135
+ <xsl:template match="listitem">
2136
+ <li>
2137
+ <xsl:apply-templates/>
2138
+ </li>
2139
+ </xsl:template>
2140
+ <xsl:template match="orderedlist">
2141
+ <ol>
2142
+ <xsl:apply-templates/>
2143
+ </ol>
2144
+ </xsl:template>
2145
+ <xsl:template match="para">
2146
+ <p>
2147
+ <xsl:apply-templates/>
2148
+ </p>
2149
+ </xsl:template>
2150
+
2151
+ <!-- mode: divnum -->
2152
+ <xsl:template mode="divnum" match="div1">
2153
+ <xsl:number format="1 "/>
2154
+ </xsl:template>
2155
+
2156
+ <xsl:template mode="divnum" match="back/div1 | inform-div1">
2157
+ <xsl:number count="div1 | inform-div1" format="A "/>
2158
+ </xsl:template>
2159
+
2160
+ <xsl:template mode="divnum"
2161
+ match="front/div1 | front//div2 | front//div3 | front//div4 | front//div5"/>
2162
+
2163
+ <xsl:template mode="divnum" match="div2">
2164
+ <xsl:number level="multiple" count="div1 | div2" format="1.1 "/>
2165
+ </xsl:template>
2166
+
2167
+ <xsl:template mode="divnum" match="back//div2">
2168
+ <xsl:number level="multiple" count="div1 | div2 | inform-div1"
2169
+ format="A.1 "/>
2170
+ </xsl:template>
2171
+
2172
+ <xsl:template mode="divnum" match="div3">
2173
+ <xsl:number level="multiple" count="div1 | div2 | div3"
2174
+ format="1.1.1 "/>
2175
+ </xsl:template>
2176
+
2177
+ <xsl:template mode="divnum" match="back//div3">
2178
+ <xsl:number level="multiple"
2179
+ count="div1 | div2 | div3 | inform-div1" format="A.1.1 "/>
2180
+ </xsl:template>
2181
+
2182
+ <xsl:template mode="divnum" match="div4">
2183
+ <xsl:number level="multiple" count="div1 | div2 | div3 | div4"
2184
+ format="1.1.1.1 "/>
2185
+ </xsl:template>
2186
+
2187
+ <xsl:template mode="divnum" match="back//div4">
2188
+ <xsl:number level="multiple"
2189
+ count="div1 | div2 | div3 | div4 | inform-div1"
2190
+ format="A.1.1.1 "/>
2191
+ </xsl:template>
2192
+
2193
+ <xsl:template mode="divnum" match="div5">
2194
+ <xsl:number level="multiple"
2195
+ count="div1 | div2 | div3 | div4 | div5" format="1.1.1.1.1 "/>
2196
+ </xsl:template>
2197
+
2198
+ <xsl:template mode="divnum" match="back//div5">
2199
+ <xsl:number level="multiple"
2200
+ count="div1 | div2 | div3 | div4 | div5 | inform-div1"
2201
+ format="A.1.1.1.1 "/>
2202
+ </xsl:template>
2203
+
2204
+ <!-- mode: notes -->
2205
+ <xsl:template mode="notes" match="footnote">
2206
+ <xsl:variable name="this-note-id">
2207
+ <xsl:choose>
2208
+ <xsl:when test="@id">
2209
+ <xsl:value-of select="@id"/>
2210
+ </xsl:when>
2211
+ <xsl:otherwise>
2212
+ <xsl:value-of select="generate-id(.)"/>
2213
+ </xsl:otherwise>
2214
+ </xsl:choose>
2215
+ </xsl:variable>
2216
+ <dt>
2217
+ <xsl:text>[</xsl:text>
2218
+ <a name="{$this-note-id}" id="{$this-note-id}" href="#FN-ANCH-{$this-note-id}">
2219
+ <xsl:apply-templates select="." mode="number-simple"/>
2220
+ </a>
2221
+ <xsl:text>]</xsl:text>
2222
+ </dt>
2223
+ <dd>
2224
+ <xsl:apply-templates/>
2225
+ </dd>
2226
+ </xsl:template>
2227
+
2228
+ <!-- mode: table.notes -->
2229
+ <xsl:template match="footnote" mode="table.notes">
2230
+ <xsl:apply-templates mode="table.notes"/>
2231
+ </xsl:template>
2232
+
2233
+ <xsl:template match="footnote/p[1]" mode="table.notes">
2234
+ <xsl:variable name="this-note-id">
2235
+ <xsl:choose>
2236
+ <xsl:when test="../@id">
2237
+ <xsl:value-of select="../@id"/>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:value-of select="generate-id(parent::*)"/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </xsl:variable>
2244
+ <p class="table.footnote">
2245
+ <sup>
2246
+ <a name="{$this-note-id}" id="{$this-note-id}" href="#FN-ANCH-{$this-note-id}">
2247
+ <xsl:apply-templates select="parent::footnote" mode="number-simple"/>
2248
+ <xsl:text>.</xsl:text>
2249
+ </a>
2250
+ </sup>
2251
+ <xsl:text> </xsl:text>
2252
+ <xsl:apply-templates/>
2253
+ </p>
2254
+ </xsl:template>
2255
+
2256
+ <!-- mode: number -->
2257
+ <xsl:template mode="number" match="prod">
2258
+ <xsl:text>[</xsl:text>
2259
+ <xsl:apply-templates select="." mode="number-simple"/>
2260
+ <xsl:text>]</xsl:text>
2261
+ </xsl:template>
2262
+
2263
+ <xsl:template mode="number" match="issue">
2264
+ <xsl:number level="single" format="1"/>
2265
+ </xsl:template>
2266
+
2267
+ <xsl:template mode="number" match="prod[@diff='add']">
2268
+ <xsl:text>[</xsl:text>
2269
+ <xsl:apply-templates select="preceding::prod[not(@diff='add')][1]"
2270
+ mode="number-simple"/>
2271
+ <!--
2272
+ Once again, this could be done right here, but XT won't hear of it.
2273
+ <xsl:number level="any" count="prod[not(@diff='add')]"/>
2274
+ -->
2275
+ <xsl:number level="any" count="prod[@diff='add']"
2276
+ from="prod[not(@diff='add')]" format="a"/>
2277
+ <xsl:text>]</xsl:text>
2278
+ </xsl:template>
2279
+
2280
+ <!-- mode: number-simple -->
2281
+ <xsl:template mode="number-simple" match="prod">
2282
+ <xsl:number level="any" count="prod[not(@diff='add')]"/>
2283
+ </xsl:template>
2284
+
2285
+ <xsl:template mode="number-simple" match="footnote">
2286
+ <xsl:number level="any" format="1"/>
2287
+ </xsl:template>
2288
+
2289
+ <!-- mode: ref -->
2290
+ <xsl:template match="lhs" mode="ref">
2291
+ <tr valign="baseline">
2292
+ <td/>
2293
+ <td>
2294
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
2295
+ <xsl:attribute name="class">
2296
+ <xsl:text>diff-</xsl:text>
2297
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
2298
+ </xsl:attribute>
2299
+ </xsl:if>
2300
+ <xsl:if test="../@id">
2301
+ <a name="{../@id}" id="{../@id}"/>
2302
+ </xsl:if>
2303
+ <code><xsl:apply-templates/></code>
2304
+ </td>
2305
+ <td>
2306
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
2307
+ <xsl:attribute name="class">
2308
+ <xsl:text>diff-</xsl:text>
2309
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
2310
+ </xsl:attribute>
2311
+ </xsl:if>
2312
+ <xsl:text>&#xa0;&#xa0;&#xa0;::=&#xa0;&#xa0;&#xa0;</xsl:text>
2313
+ </td>
2314
+ <xsl:apply-templates
2315
+ select="following-sibling::*[1][name()='rhs']"/>
2316
+ </tr>
2317
+ </xsl:template>
2318
+
2319
+ <xsl:template mode="ref" match="prod">
2320
+ <xsl:apply-templates select="lhs" mode="ref"/>
2321
+ <xsl:apply-templates
2322
+ select="rhs[preceding-sibling::*[1][name()!='lhs']] |
2323
+ com[preceding-sibling::*[1][name()!='rhs']] |
2324
+ constraint[preceding-sibling::*[1][name()!='rhs']] |
2325
+ vc[preceding-sibling::*[1][name()!='rhs']] |
2326
+ wfc[preceding-sibling::*[1][name()!='rhs']]"/>
2327
+ </xsl:template>
2328
+
2329
+ <!-- mode: text -->
2330
+ <!-- most stuff processes just as text here, but some things should
2331
+ be hidden -->
2332
+ <xsl:template mode="text" match="ednote | footnote"/>
2333
+
2334
+ <!-- mode: toc -->
2335
+ <xsl:template mode="toc" match="div1">
2336
+ <xsl:apply-templates select="." mode="divnum"/>
2337
+ <a>
2338
+ <xsl:attribute name="href">
2339
+ <xsl:call-template name="href.target">
2340
+ <xsl:with-param name="target" select="."/>
2341
+ </xsl:call-template>
2342
+ </xsl:attribute>
2343
+ <xsl:apply-templates select="head" mode="text"/>
2344
+ </a>
2345
+ <br/>
2346
+ <xsl:if test="$toc.level &gt; 1">
2347
+ <xsl:apply-templates select="div2" mode="toc"/>
2348
+ </xsl:if>
2349
+ </xsl:template>
2350
+
2351
+ <xsl:template mode="toc" match="div2">
2352
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
2353
+ <xsl:apply-templates select="." mode="divnum"/>
2354
+ <a>
2355
+ <xsl:attribute name="href">
2356
+ <xsl:call-template name="href.target">
2357
+ <xsl:with-param name="target" select="."/>
2358
+ </xsl:call-template>
2359
+ </xsl:attribute>
2360
+ <xsl:apply-templates select="head" mode="text"/>
2361
+ </a>
2362
+ <br/>
2363
+ <xsl:if test="$toc.level &gt; 2">
2364
+ <xsl:apply-templates select="div3" mode="toc"/>
2365
+ </xsl:if>
2366
+ </xsl:template>
2367
+
2368
+ <xsl:template mode="toc" match="div3">
2369
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
2370
+ <xsl:apply-templates select="." mode="divnum"/>
2371
+ <a>
2372
+ <xsl:attribute name="href">
2373
+ <xsl:call-template name="href.target">
2374
+ <xsl:with-param name="target" select="."/>
2375
+ </xsl:call-template>
2376
+ </xsl:attribute>
2377
+ <xsl:apply-templates select="head" mode="text"/>
2378
+ </a>
2379
+ <br/>
2380
+ <xsl:if test="$toc.level &gt; 3">
2381
+ <xsl:apply-templates select="div4" mode="toc"/>
2382
+ </xsl:if>
2383
+ </xsl:template>
2384
+
2385
+ <xsl:template mode="toc" match="div4">
2386
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
2387
+ <xsl:apply-templates select="." mode="divnum"/>
2388
+ <a>
2389
+ <xsl:attribute name="href">
2390
+ <xsl:call-template name="href.target">
2391
+ <xsl:with-param name="target" select="."/>
2392
+ </xsl:call-template>
2393
+ </xsl:attribute>
2394
+ <xsl:apply-templates select="head" mode="text"/>
2395
+ </a>
2396
+ <br/>
2397
+ <xsl:if test="$toc.level &gt; 4">
2398
+ <xsl:apply-templates select="div5" mode="toc"/>
2399
+ </xsl:if>
2400
+ </xsl:template>
2401
+
2402
+ <xsl:template mode="toc" match="div5">
2403
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
2404
+ <xsl:apply-templates select="." mode="divnum"/>
2405
+ <a>
2406
+ <xsl:attribute name="href">
2407
+ <xsl:call-template name="href.target">
2408
+ <xsl:with-param name="target" select="."/>
2409
+ </xsl:call-template>
2410
+ </xsl:attribute>
2411
+ <xsl:apply-templates select="head" mode="text"/>
2412
+ </a>
2413
+ <br/>
2414
+ </xsl:template>
2415
+
2416
+ <xsl:template mode="toc" match="inform-div1">
2417
+ <xsl:apply-templates select="." mode="divnum"/>
2418
+ <a>
2419
+ <xsl:attribute name="href">
2420
+ <xsl:call-template name="href.target">
2421
+ <xsl:with-param name="target" select="."/>
2422
+ </xsl:call-template>
2423
+ </xsl:attribute>
2424
+ <xsl:apply-templates select="head" mode="text"/>
2425
+ </a>
2426
+ <xsl:text> (Non-Normative)</xsl:text>
2427
+ <br/>
2428
+ <xsl:if test="$toc.level &gt; 2">
2429
+ <xsl:apply-templates select="div2" mode="toc"/>
2430
+ </xsl:if>
2431
+ </xsl:template>
2432
+
2433
+ <xsl:template name="css">
2434
+ <style type="text/css">
2435
+ <xsl:text>
2436
+ code { font-family: monospace; }
2437
+
2438
+ div.constraint,
2439
+ div.issue,
2440
+ div.note,
2441
+ div.notice { margin-left: 2em; }
2442
+
2443
+ li p { margin-top: 0.3em;
2444
+ margin-bottom: 0.3em; }
2445
+ </xsl:text>
2446
+ <xsl:if test="$tabular.examples = 0">
2447
+ <xsl:text>
2448
+ div.exampleInner pre { margin-left: 1em;
2449
+ margin-top: 0em; margin-bottom: 0em}
2450
+ div.exampleOuter {border: 4px double gray;
2451
+ margin: 0em; padding: 0em}
2452
+ div.exampleInner { background-color: #d5dee3;
2453
+ border-top-width: 4px;
2454
+ border-top-style: double;
2455
+ border-top-color: #d3d3d3;
2456
+ border-bottom-width: 4px;
2457
+ border-bottom-style: double;
2458
+ border-bottom-color: #d3d3d3;
2459
+ padding: 4px; margin: 0em }
2460
+ div.exampleWrapper { margin: 4px }
2461
+ div.exampleHeader { font-weight: bold;
2462
+ margin: 4px}
2463
+ </xsl:text>
2464
+ </xsl:if>
2465
+ <xsl:value-of select="$additional.css"/>
2466
+ </style>
2467
+ <link rel="stylesheet" type="text/css">
2468
+ <xsl:attribute name="href">
2469
+ <xsl:text>http://www.w3.org/StyleSheets/TR/</xsl:text>
2470
+ <xsl:choose>
2471
+ <xsl:when test="/spec/@role='editors-copy'">base</xsl:when>
2472
+ <xsl:otherwise>
2473
+ <xsl:choose>
2474
+ <xsl:when test="/spec/@w3c-doctype='wd'">W3C-WD</xsl:when>
2475
+ <xsl:when test="/spec/@w3c-doctype='rec'">W3C-REC</xsl:when>
2476
+ <xsl:when test="/spec/@w3c-doctype='pr'">W3C-PR</xsl:when>
2477
+ <xsl:when test="/spec/@w3c-doctype='per'">W3C-PER</xsl:when>
2478
+ <xsl:when test="/spec/@w3c-doctype='cr'">W3C-CR</xsl:when>
2479
+ <xsl:when test="/spec/@w3c-doctype='note'">W3C-NOTE</xsl:when>
2480
+ <xsl:otherwise>base</xsl:otherwise>
2481
+ </xsl:choose>
2482
+ </xsl:otherwise>
2483
+ </xsl:choose>
2484
+ <xsl:text>.css</xsl:text>
2485
+ </xsl:attribute>
2486
+ </link>
2487
+ </xsl:template>
2488
+
2489
+ <xsl:template name="href.target">
2490
+ <xsl:param name="target" select="."/>
2491
+
2492
+ <xsl:text>#</xsl:text>
2493
+
2494
+ <xsl:choose>
2495
+ <xsl:when test="$target/@id">
2496
+ <xsl:value-of select="$target/@id"/>
2497
+ </xsl:when>
2498
+ <xsl:otherwise>
2499
+ <xsl:value-of select="generate-id($target)"/>
2500
+ </xsl:otherwise>
2501
+ </xsl:choose>
2502
+ </xsl:template>
2503
+
2504
+ <!-- ================================================================= -->
2505
+
2506
+ <xsl:template name="object.id">
2507
+ <xsl:param name="node" select="."/>
2508
+ <xsl:param name="default.id" select="''"/>
2509
+
2510
+ <xsl:choose>
2511
+ <!-- can't use the default ID if it's used somewhere else in the document! -->
2512
+ <xsl:when test="$default.id != '' and not(key('ids', $default.id))">
2513
+ <xsl:value-of select="$default.id"/>
2514
+ </xsl:when>
2515
+ <xsl:when test="$node/@id">
2516
+ <xsl:value-of select="$node/@id"/>
2517
+ </xsl:when>
2518
+ <xsl:otherwise>
2519
+ <xsl:value-of select="generate-id($node)"/>
2520
+ </xsl:otherwise>
2521
+ </xsl:choose>
2522
+ </xsl:template>
2523
+
2524
+ <xsl:template name="anchor">
2525
+ <xsl:param name="node" select="."/>
2526
+ <xsl:param name="conditional" select="1"/>
2527
+ <xsl:param name="default.id" select="''"/>
2528
+
2529
+ <xsl:variable name="id">
2530
+ <xsl:call-template name="object.id">
2531
+ <xsl:with-param name="node" select="$node"/>
2532
+ <xsl:with-param name="default.id" select="$default.id"/>
2533
+ </xsl:call-template>
2534
+ </xsl:variable>
2535
+ <xsl:if test="$conditional = 0 or $node/@id">
2536
+ <a name="{$id}" id="{$id}"/>
2537
+ </xsl:if>
2538
+ </xsl:template>
2539
+
2540
+ <!-- ================================================================= -->
2541
+
2542
+ </xsl:transform>