1
0

formal.xsl 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4. version='1.0'>
  5. <!-- ********************************************************************
  6. $Id: formal.xsl 8544 2009-12-02 06:06:53Z bobstayton $
  7. ********************************************************************
  8. This file is part of the XSL DocBook Stylesheet distribution.
  9. See ../README or http://docbook.sf.net/release/xsl/current/ for
  10. copyright and other information.
  11. ******************************************************************** -->
  12. <!-- formal.object creates a basic block containing the
  13. result of processing the object, including its title
  14. and any keep-together properties.
  15. The template calling formal.object may wrap these results in a
  16. float or pgwide block. -->
  17. <xsl:template name="formal.object">
  18. <xsl:param name="placement" select="'before'"/>
  19. <xsl:variable name="id">
  20. <xsl:call-template name="object.id"/>
  21. </xsl:variable>
  22. <xsl:variable name="content">
  23. <xsl:if test="$placement = 'before'">
  24. <xsl:call-template name="formal.object.heading">
  25. <xsl:with-param name="placement" select="$placement"/>
  26. </xsl:call-template>
  27. </xsl:if>
  28. <xsl:apply-templates/>
  29. <xsl:if test="$placement != 'before'">
  30. <xsl:call-template name="formal.object.heading">
  31. <xsl:with-param name="placement" select="$placement"/>
  32. </xsl:call-template>
  33. </xsl:if>
  34. </xsl:variable>
  35. <xsl:variable name="keep.together">
  36. <xsl:call-template name="pi.dbfo_keep-together"/>
  37. </xsl:variable>
  38. <xsl:choose>
  39. <!-- tables have their own templates and
  40. are not handled by formal.object -->
  41. <xsl:when test="self::figure">
  42. <fo:block id="{$id}"
  43. xsl:use-attribute-sets="figure.properties">
  44. <xsl:if test="$keep.together != ''">
  45. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  46. select="$keep.together"/></xsl:attribute>
  47. </xsl:if>
  48. <xsl:copy-of select="$content"/>
  49. </fo:block>
  50. </xsl:when>
  51. <xsl:when test="self::example">
  52. <fo:block id="{$id}"
  53. xsl:use-attribute-sets="example.properties">
  54. <xsl:if test="$keep.together != ''">
  55. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  56. select="$keep.together"/></xsl:attribute>
  57. </xsl:if>
  58. <xsl:copy-of select="$content"/>
  59. </fo:block>
  60. </xsl:when>
  61. <xsl:when test="self::equation">
  62. <fo:block id="{$id}"
  63. xsl:use-attribute-sets="equation.properties">
  64. <xsl:if test="$keep.together != ''">
  65. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  66. select="$keep.together"/></xsl:attribute>
  67. </xsl:if>
  68. <xsl:copy-of select="$content"/>
  69. </fo:block>
  70. </xsl:when>
  71. <xsl:when test="self::procedure">
  72. <fo:block id="{$id}"
  73. xsl:use-attribute-sets="procedure.properties">
  74. <xsl:if test="$keep.together != ''">
  75. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  76. select="$keep.together"/></xsl:attribute>
  77. </xsl:if>
  78. <xsl:copy-of select="$content"/>
  79. </fo:block>
  80. </xsl:when>
  81. <xsl:otherwise>
  82. <fo:block id="{$id}"
  83. xsl:use-attribute-sets="formal.object.properties">
  84. <xsl:if test="$keep.together != ''">
  85. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  86. select="$keep.together"/></xsl:attribute>
  87. </xsl:if>
  88. <xsl:copy-of select="$content"/>
  89. </fo:block>
  90. </xsl:otherwise>
  91. </xsl:choose>
  92. </xsl:template>
  93. <xsl:template name="formal.object.heading">
  94. <xsl:param name="object" select="."/>
  95. <xsl:param name="placement" select="'before'"/>
  96. <fo:block xsl:use-attribute-sets="formal.title.properties">
  97. <xsl:choose>
  98. <xsl:when test="$placement = 'before'">
  99. <xsl:attribute
  100. name="keep-with-next.within-column">always</xsl:attribute>
  101. </xsl:when>
  102. <xsl:otherwise>
  103. <xsl:attribute
  104. name="keep-with-previous.within-column">always</xsl:attribute>
  105. </xsl:otherwise>
  106. </xsl:choose>
  107. <xsl:apply-templates select="$object" mode="object.title.markup">
  108. <xsl:with-param name="allow-anchors" select="1"/>
  109. </xsl:apply-templates>
  110. </fo:block>
  111. </xsl:template>
  112. <xsl:template name="informal.object">
  113. <xsl:variable name="id">
  114. <xsl:call-template name="object.id"/>
  115. </xsl:variable>
  116. <xsl:variable name="keep.together">
  117. <xsl:call-template name="pi.dbfo_keep-together"/>
  118. </xsl:variable>
  119. <!-- Some don't have a pgwide attribute, so may use a PI -->
  120. <xsl:variable name="pgwide.pi">
  121. <xsl:call-template name="pi.dbfo_pgwide"/>
  122. </xsl:variable>
  123. <xsl:variable name="pgwide">
  124. <xsl:choose>
  125. <xsl:when test="@pgwide">
  126. <xsl:value-of select="@pgwide"/>
  127. </xsl:when>
  128. <xsl:when test="$pgwide.pi">
  129. <xsl:value-of select="$pgwide.pi"/>
  130. </xsl:when>
  131. <!-- child element may set pgwide -->
  132. <xsl:when test="*[@pgwide]">
  133. <xsl:value-of select="*[@pgwide][1]/@pgwide"/>
  134. </xsl:when>
  135. </xsl:choose>
  136. </xsl:variable>
  137. <xsl:choose>
  138. <!-- informaltables have their own templates and
  139. are not handled by formal.object -->
  140. <xsl:when test="local-name(.) = 'equation'">
  141. <xsl:choose>
  142. <xsl:when test="$pgwide = '1'">
  143. <fo:block id="{$id}"
  144. xsl:use-attribute-sets="pgwide.properties
  145. equation.properties">
  146. <xsl:if test="$keep.together != ''">
  147. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  148. select="$keep.together"/></xsl:attribute>
  149. </xsl:if>
  150. <xsl:call-template name="equation.without.title"/>
  151. </fo:block>
  152. </xsl:when>
  153. <xsl:otherwise>
  154. <fo:block id="{$id}"
  155. xsl:use-attribute-sets="equation.properties">
  156. <xsl:if test="$keep.together != ''">
  157. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  158. select="$keep.together"/></xsl:attribute>
  159. </xsl:if>
  160. <xsl:call-template name="equation.without.title"/>
  161. </fo:block>
  162. </xsl:otherwise>
  163. </xsl:choose>
  164. </xsl:when>
  165. <xsl:when test="local-name(.) = 'procedure'">
  166. <fo:block id="{$id}"
  167. xsl:use-attribute-sets="procedure.properties">
  168. <xsl:if test="$keep.together != ''">
  169. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  170. select="$keep.together"/></xsl:attribute>
  171. </xsl:if>
  172. <xsl:apply-templates/>
  173. </fo:block>
  174. </xsl:when>
  175. <xsl:when test="local-name(.) = 'informalfigure'">
  176. <xsl:choose>
  177. <xsl:when test="$pgwide = '1'">
  178. <fo:block id="{$id}"
  179. xsl:use-attribute-sets="pgwide.properties
  180. informalfigure.properties">
  181. <xsl:if test="$keep.together != ''">
  182. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  183. select="$keep.together"/></xsl:attribute>
  184. </xsl:if>
  185. <xsl:apply-templates/>
  186. </fo:block>
  187. </xsl:when>
  188. <xsl:otherwise>
  189. <fo:block id="{$id}"
  190. xsl:use-attribute-sets="informalfigure.properties">
  191. <xsl:if test="$keep.together != ''">
  192. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  193. select="$keep.together"/></xsl:attribute>
  194. </xsl:if>
  195. <xsl:apply-templates/>
  196. </fo:block>
  197. </xsl:otherwise>
  198. </xsl:choose>
  199. </xsl:when>
  200. <xsl:when test="local-name(.) = 'informalexample'">
  201. <xsl:choose>
  202. <xsl:when test="$pgwide = '1'">
  203. <fo:block id="{$id}"
  204. xsl:use-attribute-sets="pgwide.properties
  205. informalexample.properties">
  206. <xsl:if test="$keep.together != ''">
  207. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  208. select="$keep.together"/></xsl:attribute>
  209. </xsl:if>
  210. <xsl:apply-templates/>
  211. </fo:block>
  212. </xsl:when>
  213. <xsl:otherwise>
  214. <fo:block id="{$id}"
  215. xsl:use-attribute-sets="informalexample.properties">
  216. <xsl:if test="$keep.together != ''">
  217. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  218. select="$keep.together"/></xsl:attribute>
  219. </xsl:if>
  220. <xsl:apply-templates/>
  221. </fo:block>
  222. </xsl:otherwise>
  223. </xsl:choose>
  224. </xsl:when>
  225. <xsl:when test="local-name(.) = 'informalequation'">
  226. <xsl:choose>
  227. <xsl:when test="$pgwide = '1'">
  228. <fo:block id="{$id}"
  229. xsl:use-attribute-sets="pgwide.properties
  230. informalequation.properties">
  231. <xsl:if test="$keep.together != ''">
  232. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  233. select="$keep.together"/></xsl:attribute>
  234. </xsl:if>
  235. <xsl:apply-templates/>
  236. </fo:block>
  237. </xsl:when>
  238. <xsl:otherwise>
  239. <fo:block id="{$id}"
  240. xsl:use-attribute-sets="informalequation.properties">
  241. <xsl:if test="$keep.together != ''">
  242. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  243. select="$keep.together"/></xsl:attribute>
  244. </xsl:if>
  245. <xsl:apply-templates/>
  246. </fo:block>
  247. </xsl:otherwise>
  248. </xsl:choose>
  249. </xsl:when>
  250. <xsl:otherwise>
  251. <fo:block id="{$id}"
  252. xsl:use-attribute-sets="informal.object.properties">
  253. <xsl:if test="$keep.together != ''">
  254. <xsl:attribute name="keep-together.within-column"><xsl:value-of
  255. select="$keep.together"/></xsl:attribute>
  256. </xsl:if>
  257. <xsl:apply-templates/>
  258. </fo:block>
  259. </xsl:otherwise>
  260. </xsl:choose>
  261. </xsl:template>
  262. <xsl:template name="equation.without.title">
  263. <!-- Lay out equation and number next to equation using a table -->
  264. <fo:table table-layout="fixed" width="100%">
  265. <fo:table-column column-width="proportional-column-width(15)"/>
  266. <fo:table-column column-width="proportional-column-width(1)"/>
  267. <fo:table-body start-indent="0pt" end-indent="0pt">
  268. <fo:table-row>
  269. <fo:table-cell padding-end="6pt">
  270. <fo:block>
  271. <xsl:apply-templates/>
  272. </fo:block>
  273. </fo:table-cell>
  274. <fo:table-cell xsl:use-attribute-sets="equation.number.properties">
  275. <fo:block>
  276. <xsl:text>(</xsl:text>
  277. <xsl:apply-templates select="." mode="label.markup"/>
  278. <xsl:text>)</xsl:text>
  279. </fo:block>
  280. </fo:table-cell>
  281. </fo:table-row>
  282. </fo:table-body>
  283. </fo:table>
  284. </xsl:template>
  285. <xsl:template name="semiformal.object">
  286. <xsl:param name="placement" select="'before'"/>
  287. <xsl:choose>
  288. <xsl:when test="title or info/title">
  289. <xsl:call-template name="formal.object">
  290. <xsl:with-param name="placement" select="$placement"/>
  291. </xsl:call-template>
  292. </xsl:when>
  293. <xsl:otherwise>
  294. <xsl:call-template name="informal.object"/>
  295. </xsl:otherwise>
  296. </xsl:choose>
  297. </xsl:template>
  298. <xsl:template match="figure">
  299. <xsl:variable name="param.placement"
  300. select="substring-after(normalize-space($formal.title.placement),
  301. concat(local-name(.), ' '))"/>
  302. <xsl:variable name="placement">
  303. <xsl:choose>
  304. <xsl:when test="contains($param.placement, ' ')">
  305. <xsl:value-of select="substring-before($param.placement, ' ')"/>
  306. </xsl:when>
  307. <xsl:when test="$param.placement = ''">before</xsl:when>
  308. <xsl:otherwise>
  309. <xsl:value-of select="$param.placement"/>
  310. </xsl:otherwise>
  311. </xsl:choose>
  312. </xsl:variable>
  313. <xsl:variable name="figure">
  314. <xsl:choose>
  315. <xsl:when test="@pgwide = '1'">
  316. <fo:block xsl:use-attribute-sets="pgwide.properties">
  317. <xsl:call-template name="formal.object">
  318. <xsl:with-param name="placement" select="$placement"/>
  319. </xsl:call-template>
  320. </fo:block>
  321. </xsl:when>
  322. <xsl:otherwise>
  323. <xsl:call-template name="formal.object">
  324. <xsl:with-param name="placement" select="$placement"/>
  325. </xsl:call-template>
  326. </xsl:otherwise>
  327. </xsl:choose>
  328. </xsl:variable>
  329. <xsl:variable name="floatstyle">
  330. <xsl:call-template name="floatstyle"/>
  331. </xsl:variable>
  332. <xsl:choose>
  333. <xsl:when test="$floatstyle != ''">
  334. <xsl:call-template name="floater">
  335. <xsl:with-param name="position" select="$floatstyle"/>
  336. <xsl:with-param name="content" select="$figure"/>
  337. </xsl:call-template>
  338. </xsl:when>
  339. <xsl:otherwise>
  340. <xsl:copy-of select="$figure"/>
  341. </xsl:otherwise>
  342. </xsl:choose>
  343. </xsl:template>
  344. <xsl:template match="example">
  345. <xsl:variable name="param.placement"
  346. select="substring-after(normalize-space($formal.title.placement),
  347. concat(local-name(.), ' '))"/>
  348. <xsl:variable name="placement">
  349. <xsl:choose>
  350. <xsl:when test="contains($param.placement, ' ')">
  351. <xsl:value-of select="substring-before($param.placement, ' ')"/>
  352. </xsl:when>
  353. <xsl:when test="$param.placement = ''">before</xsl:when>
  354. <xsl:otherwise>
  355. <xsl:value-of select="$param.placement"/>
  356. </xsl:otherwise>
  357. </xsl:choose>
  358. </xsl:variable>
  359. <!-- Example doesn't have a pgwide attribute, so may use a PI -->
  360. <xsl:variable name="pgwide.pi">
  361. <xsl:call-template name="pi.dbfo_pgwide"/>
  362. </xsl:variable>
  363. <xsl:variable name="pgwide">
  364. <xsl:choose>
  365. <xsl:when test="$pgwide.pi">
  366. <xsl:value-of select="$pgwide.pi"/>
  367. </xsl:when>
  368. <!-- child element may set pgwide -->
  369. <xsl:when test="*[@pgwide]">
  370. <xsl:value-of select="*[@pgwide][1]/@pgwide"/>
  371. </xsl:when>
  372. </xsl:choose>
  373. </xsl:variable>
  374. <!-- Get align value from internal mediaobject -->
  375. <xsl:variable name="align">
  376. <xsl:if test="mediaobject|mediaobjectco">
  377. <xsl:variable name="olist" select="mediaobject/imageobject
  378. |mediaobjectco/imageobjectco
  379. |mediaobject/videoobject
  380. |mediaobject/audioobject
  381. |mediaobject/textobject"/>
  382. <xsl:variable name="object.index">
  383. <xsl:call-template name="select.mediaobject.index">
  384. <xsl:with-param name="olist" select="$olist"/>
  385. <xsl:with-param name="count" select="1"/>
  386. </xsl:call-template>
  387. </xsl:variable>
  388. <xsl:variable name="object" select="$olist[position() = $object.index]"/>
  389. <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
  390. </xsl:if>
  391. </xsl:variable>
  392. <xsl:variable name="example">
  393. <xsl:choose>
  394. <xsl:when test="$pgwide = '1'">
  395. <fo:block xsl:use-attribute-sets="pgwide.properties">
  396. <xsl:if test="$align != ''">
  397. <xsl:attribute name="text-align">
  398. <xsl:value-of select="$align"/>
  399. </xsl:attribute>
  400. </xsl:if>
  401. <xsl:call-template name="formal.object">
  402. <xsl:with-param name="placement" select="$placement"/>
  403. </xsl:call-template>
  404. </fo:block>
  405. </xsl:when>
  406. <xsl:otherwise>
  407. <fo:block>
  408. <xsl:if test="$align != ''">
  409. <xsl:attribute name="text-align">
  410. <xsl:value-of select="$align"/>
  411. </xsl:attribute>
  412. </xsl:if>
  413. <xsl:call-template name="formal.object">
  414. <xsl:with-param name="placement" select="$placement"/>
  415. </xsl:call-template>
  416. </fo:block>
  417. </xsl:otherwise>
  418. </xsl:choose>
  419. </xsl:variable>
  420. <xsl:variable name="floatstyle">
  421. <xsl:call-template name="floatstyle"/>
  422. </xsl:variable>
  423. <xsl:choose>
  424. <xsl:when test="$floatstyle != ''">
  425. <xsl:call-template name="floater">
  426. <xsl:with-param name="position" select="$floatstyle"/>
  427. <xsl:with-param name="content" select="$example"/>
  428. </xsl:call-template>
  429. </xsl:when>
  430. <xsl:otherwise>
  431. <xsl:copy-of select="$example"/>
  432. </xsl:otherwise>
  433. </xsl:choose>
  434. </xsl:template>
  435. <!-- Unified handling of CALS and HTML tables, formal and not -->
  436. <!-- Creates a hierarchy of nested containers:
  437. - Outer container does a float.
  438. - Nested container does block-container for rotation
  439. - Nested block contains title, layout table and footnotes
  440. - Nested layout table placeholder template supports extensions.
  441. - fo:table is innermost.
  442. Created from the innermost and working out.
  443. Not all layers apply to every table.
  444. -->
  445. <xsl:template match="table|informaltable">
  446. <xsl:if test="tgroup/tbody/tr
  447. |tgroup/thead/tr
  448. |tgroup/tfoot/tr">
  449. <xsl:message terminate="yes">
  450. <xsl:text>Broken table: tr descendent of CALS Table.</xsl:text>
  451. <xsl:text>The text in the first tr is:&#10;</xsl:text>
  452. <xsl:value-of
  453. select="(tgroup//tr)[1]"/>
  454. </xsl:message>
  455. </xsl:if>
  456. <xsl:if test="not(tgroup) and .//row">
  457. <xsl:message terminate="yes">
  458. <xsl:text>Broken table: row descendent of HTML table.</xsl:text>
  459. <xsl:text>The text in the first row is:&#10;</xsl:text>
  460. <xsl:value-of
  461. select=".//row[1]"/>
  462. </xsl:message>
  463. </xsl:if>
  464. <!-- Contains fo:table, not title or footnotes -->
  465. <xsl:variable name="table.content">
  466. <xsl:call-template name="make.table.content"/>
  467. </xsl:variable>
  468. <!-- Optional layout table template for extensions -->
  469. <xsl:variable name="table.layout">
  470. <xsl:call-template name="table.layout">
  471. <xsl:with-param name="table.content" select="$table.content"/>
  472. </xsl:call-template>
  473. </xsl:variable>
  474. <!-- fo:block contains title, layout table, and footnotes -->
  475. <xsl:variable name="table.block">
  476. <xsl:call-template name="table.block">
  477. <xsl:with-param name="table.layout" select="$table.layout"/>
  478. </xsl:call-template>
  479. </xsl:variable>
  480. <!-- pgwide or orient container -->
  481. <xsl:variable name="table.container">
  482. <xsl:call-template name="table.container">
  483. <xsl:with-param name="table.block" select="$table.block"/>
  484. </xsl:call-template>
  485. </xsl:variable>
  486. <!-- float or not -->
  487. <xsl:variable name="floatstyle">
  488. <xsl:call-template name="floatstyle"/>
  489. </xsl:variable>
  490. <xsl:choose>
  491. <xsl:when test="$floatstyle != ''">
  492. <xsl:call-template name="floater">
  493. <xsl:with-param name="position" select="$floatstyle"/>
  494. <xsl:with-param name="content" select="$table.container"/>
  495. </xsl:call-template>
  496. </xsl:when>
  497. <xsl:otherwise>
  498. <xsl:copy-of select="$table.container"/>
  499. </xsl:otherwise>
  500. </xsl:choose>
  501. </xsl:template>
  502. <xsl:template match="equation">
  503. <xsl:variable name="param.placement"
  504. select="substring-after(normalize-space($formal.title.placement),
  505. concat(local-name(.), ' '))"/>
  506. <xsl:variable name="placement">
  507. <xsl:choose>
  508. <xsl:when test="contains($param.placement, ' ')">
  509. <xsl:value-of select="substring-before($param.placement, ' ')"/>
  510. </xsl:when>
  511. <xsl:when test="$param.placement = ''">before</xsl:when>
  512. <xsl:otherwise>
  513. <xsl:value-of select="$param.placement"/>
  514. </xsl:otherwise>
  515. </xsl:choose>
  516. </xsl:variable>
  517. <!-- Equation doesn't have a pgwide attribute, so may use a PI -->
  518. <xsl:variable name="pgwide">
  519. <xsl:call-template name="pi.dbfo_pgwide"/>
  520. </xsl:variable>
  521. <xsl:variable name="equation">
  522. <xsl:choose>
  523. <xsl:when test="$pgwide = '1'">
  524. <fo:block xsl:use-attribute-sets="pgwide.properties">
  525. <xsl:call-template name="semiformal.object">
  526. <xsl:with-param name="placement" select="$placement"/>
  527. </xsl:call-template>
  528. </fo:block>
  529. </xsl:when>
  530. <xsl:otherwise>
  531. <xsl:call-template name="semiformal.object">
  532. <xsl:with-param name="placement" select="$placement"/>
  533. </xsl:call-template>
  534. </xsl:otherwise>
  535. </xsl:choose>
  536. </xsl:variable>
  537. <xsl:variable name="floatstyle">
  538. <xsl:call-template name="floatstyle"/>
  539. </xsl:variable>
  540. <xsl:choose>
  541. <xsl:when test="$floatstyle != ''">
  542. <xsl:call-template name="floater">
  543. <xsl:with-param name="position" select="$floatstyle"/>
  544. <xsl:with-param name="content" select="$equation"/>
  545. </xsl:call-template>
  546. </xsl:when>
  547. <xsl:otherwise>
  548. <xsl:copy-of select="$equation"/>
  549. </xsl:otherwise>
  550. </xsl:choose>
  551. </xsl:template>
  552. <xsl:template match="figure/title"></xsl:template>
  553. <xsl:template match="figure/titleabbrev"></xsl:template>
  554. <xsl:template match="table/title"></xsl:template>
  555. <xsl:template match="table/titleabbrev"></xsl:template>
  556. <xsl:template match="table/textobject"></xsl:template>
  557. <xsl:template match="example/title"></xsl:template>
  558. <xsl:template match="example/titleabbrev"></xsl:template>
  559. <xsl:template match="equation/title"></xsl:template>
  560. <xsl:template match="equation/titleabbrev"></xsl:template>
  561. <xsl:template match="informalfigure">
  562. <xsl:call-template name="informal.object"/>
  563. </xsl:template>
  564. <xsl:template match="informalexample">
  565. <xsl:call-template name="informal.object"/>
  566. </xsl:template>
  567. <xsl:template match="informaltable/textobject"></xsl:template>
  568. <xsl:template match="informalequation">
  569. <xsl:call-template name="informal.object"/>
  570. </xsl:template>
  571. <xsl:template name="floatstyle">
  572. <xsl:if test="(@float and @float != '0') or @floatstyle != ''">
  573. <xsl:choose>
  574. <xsl:when test="@floatstyle != ''">
  575. <xsl:value-of select="@floatstyle"/>
  576. </xsl:when>
  577. <xsl:when test="@float = '1'">
  578. <xsl:value-of select="$default.float.class"/>
  579. </xsl:when>
  580. <xsl:otherwise>
  581. <xsl:value-of select="@float"/>
  582. </xsl:otherwise>
  583. </xsl:choose>
  584. </xsl:if>
  585. </xsl:template>
  586. </xsl:stylesheet>