task-elements.xsl 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <?xml version='1.0'?>
  2. <!--
  3. Copyright ? 2004-2006 by Idiom Technologies, Inc. All rights reserved.
  4. IDIOM is a registered trademark of Idiom Technologies, Inc. and WORLDSERVER
  5. and WORLDSTART are trademarks of Idiom Technologies, Inc. All other
  6. trademarks are the property of their respective owners.
  7. IDIOM TECHNOLOGIES, INC. IS DELIVERING THE SOFTWARE "AS IS," WITH
  8. ABSOLUTELY NO WARRANTIES WHATSOEVER, WHETHER EXPRESS OR IMPLIED, AND IDIOM
  9. TECHNOLOGIES, INC. DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  10. BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  11. PURPOSE AND WARRANTY OF NON-INFRINGEMENT. IDIOM TECHNOLOGIES, INC. SHALL NOT
  12. BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, COVER, PUNITIVE, EXEMPLARY,
  13. RELIANCE, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO LOSS OF
  14. ANTICIPATED PROFIT), ARISING FROM ANY CAUSE UNDER OR RELATED TO OR ARISING
  15. OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF IDIOM
  16. TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  17. Idiom Technologies, Inc. and its licensors shall not be liable for any
  18. damages suffered by any person as a result of using and/or modifying the
  19. Software or its derivatives. In no event shall Idiom Technologies, Inc.'s
  20. liability for any damages hereunder exceed the amounts received by Idiom
  21. Technologies, Inc. as a result of this transaction.
  22. These terms and conditions supersede the terms and conditions in any
  23. licensing agreement to the extent that such terms and conditions conflict
  24. with those set forth herein.
  25. This file is part of the DITA Open Toolkit project hosted on Sourceforge.net.
  26. See the accompanying license.txt file for applicable licenses.
  27. -->
  28. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  29. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  30. xmlns:dita2xslfo="http://dita-ot.sourceforge.net/ns/200910/dita2xslfo"
  31. xmlns:opentopic="http://www.idiominc.com/opentopic"
  32. xmlns:opentopic-index="http://www.idiominc.com/opentopic/index"
  33. exclude-result-prefixes="opentopic opentopic-index dita2xslfo"
  34. version="2.0">
  35. <!-- Determines whether to generate titles for task sections. Values are YES and NO. -->
  36. <xsl:param name="GENERATE-TASK-LABELS">
  37. <xsl:choose>
  38. <xsl:when test="$antArgsGenerateTaskLabels='YES'"><xsl:value-of select="$antArgsGenerateTaskLabels"/></xsl:when>
  39. <xsl:otherwise>NO</xsl:otherwise>
  40. </xsl:choose>
  41. </xsl:param>
  42. <xsl:template match="*[contains(@class, ' task/task ')]" mode="processTopic"
  43. name="processTask">
  44. <fo:block xsl:use-attribute-sets="task">
  45. <xsl:apply-templates select="." mode="commonTopicProcessing"/>
  46. </fo:block>
  47. </xsl:template>
  48. <!-- Deprecated, retained for backwards compatibility -->
  49. <xsl:template match="*" mode="processTask">
  50. <xsl:call-template name="processTask"/>
  51. </xsl:template>
  52. <xsl:template match="*[contains(@class, ' task/taskbody ')]">
  53. <fo:block xsl:use-attribute-sets="taskbody">
  54. <xsl:call-template name="commonattributes"/>
  55. <xsl:apply-templates/>
  56. </fo:block>
  57. </xsl:template>
  58. <xsl:template match="*[contains(@class, ' task/prereq ')]">
  59. <fo:block xsl:use-attribute-sets="prereq">
  60. <xsl:call-template name="commonattributes"/>
  61. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  62. <xsl:with-param name="use-label">
  63. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  64. <xsl:with-param name="pdf2-string">Task Prereq</xsl:with-param>
  65. <xsl:with-param name="common-string">task_prereq</xsl:with-param>
  66. </xsl:apply-templates>
  67. </xsl:with-param>
  68. </xsl:apply-templates>
  69. <fo:block xsl:use-attribute-sets="prereq__content">
  70. <xsl:apply-templates/>
  71. </fo:block>
  72. </fo:block>
  73. </xsl:template>
  74. <xsl:template match="*[contains(@class, ' task/context ')]">
  75. <fo:block xsl:use-attribute-sets="context">
  76. <xsl:call-template name="commonattributes"/>
  77. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  78. <xsl:with-param name="use-label">
  79. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  80. <xsl:with-param name="pdf2-string">Task Context</xsl:with-param>
  81. <xsl:with-param name="common-string">task_context</xsl:with-param>
  82. </xsl:apply-templates>
  83. </xsl:with-param>
  84. </xsl:apply-templates>
  85. <fo:block xsl:use-attribute-sets="context__content">
  86. <xsl:apply-templates/>
  87. </fo:block>
  88. </fo:block>
  89. </xsl:template>
  90. <xsl:template match="*[contains(@class, ' task/cmd ')]" priority="1">
  91. <fo:block xsl:use-attribute-sets="cmd">
  92. <xsl:call-template name="commonattributes"/>
  93. <xsl:if test="../@importance='optional'">
  94. <xsl:call-template name="getVariable">
  95. <xsl:with-param name="id" select="'Optional Step'"/>
  96. </xsl:call-template>
  97. <xsl:text> </xsl:text>
  98. </xsl:if>
  99. <xsl:if test="../@importance='required'">
  100. <xsl:call-template name="getVariable">
  101. <xsl:with-param name="id" select="'Required Step'"/>
  102. </xsl:call-template>
  103. <xsl:text> </xsl:text>
  104. </xsl:if>
  105. <xsl:apply-templates/>
  106. </fo:block>
  107. </xsl:template>
  108. <xsl:template match="*[contains(@class, ' task/info ')]">
  109. <fo:block xsl:use-attribute-sets="info">
  110. <xsl:call-template name="commonattributes"/>
  111. <xsl:apply-templates/>
  112. </fo:block>
  113. </xsl:template>
  114. <xsl:template match="*[contains(@class, ' task/tutorialinfo ')]">
  115. <fo:block xsl:use-attribute-sets="tutorialinfo">
  116. <xsl:call-template name="commonattributes"/>
  117. <xsl:apply-templates/>
  118. </fo:block>
  119. </xsl:template>
  120. <xsl:template match="*[contains(@class, ' task/stepresult ')]">
  121. <fo:block xsl:use-attribute-sets="stepresult">
  122. <xsl:call-template name="commonattributes"/>
  123. <xsl:apply-templates/>
  124. </fo:block>
  125. </xsl:template>
  126. <xsl:template match="*[contains(@class, ' task/result ')]">
  127. <fo:block xsl:use-attribute-sets="result">
  128. <xsl:call-template name="commonattributes"/>
  129. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  130. <xsl:with-param name="use-label">
  131. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  132. <xsl:with-param name="pdf2-string">Task Result</xsl:with-param>
  133. <xsl:with-param name="common-string">task_results</xsl:with-param>
  134. </xsl:apply-templates>
  135. </xsl:with-param>
  136. </xsl:apply-templates>
  137. <fo:block xsl:use-attribute-sets="result__content">
  138. <xsl:apply-templates/>
  139. </fo:block>
  140. </fo:block>
  141. </xsl:template>
  142. <!-- If example has a title, process it first; otherwise, create default title (if needed) -->
  143. <xsl:template match="*[contains(@class, ' task/taskbody ')]/*[contains(@class, ' topic/example ')]">
  144. <fo:block xsl:use-attribute-sets="task.example">
  145. <xsl:call-template name="commonattributes"/>
  146. <xsl:choose>
  147. <xsl:when test="*[contains(@class, ' topic/title ')]">
  148. <xsl:apply-templates select="*[contains(@class, ' topic/title ')]"/>
  149. </xsl:when>
  150. <xsl:otherwise>
  151. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  152. <xsl:with-param name="use-label">
  153. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  154. <xsl:with-param name="pdf2-string">Task Example</xsl:with-param>
  155. <xsl:with-param name="common-string">task_example</xsl:with-param>
  156. </xsl:apply-templates>
  157. </xsl:with-param>
  158. </xsl:apply-templates>
  159. </xsl:otherwise>
  160. </xsl:choose>
  161. <fo:block xsl:use-attribute-sets="task.example__content">
  162. <xsl:apply-templates select="*[not(contains(@class, ' topic/title '))]|text()|processing-instruction()"/>
  163. </fo:block>
  164. </fo:block>
  165. </xsl:template>
  166. <xsl:template match="*[contains(@class, ' task/postreq ')]">
  167. <fo:block xsl:use-attribute-sets="postreq">
  168. <xsl:call-template name="commonattributes"/>
  169. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  170. <xsl:with-param name="use-label">
  171. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  172. <xsl:with-param name="pdf2-string">Task Postreq</xsl:with-param>
  173. <xsl:with-param name="common-string">task_postreq</xsl:with-param>
  174. </xsl:apply-templates>
  175. </xsl:with-param>
  176. </xsl:apply-templates>
  177. <fo:block xsl:use-attribute-sets="postreq__content">
  178. <xsl:apply-templates/>
  179. </fo:block>
  180. </fo:block>
  181. </xsl:template>
  182. <xsl:template match="*[contains(@class, ' task/stepxmp ')]">
  183. <fo:block xsl:use-attribute-sets="stepxmp">
  184. <xsl:call-template name="commonattributes"/>
  185. <xsl:apply-templates/>
  186. </fo:block>
  187. </xsl:template>
  188. <!--Steps-->
  189. <xsl:template match="*[contains(@class, ' task/steps ')]">
  190. <xsl:choose>
  191. <xsl:when test="$GENERATE-TASK-LABELS='YES'">
  192. <fo:block>
  193. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  194. <xsl:with-param name="use-label">
  195. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  196. <xsl:with-param name="pdf2-string">Task Steps</xsl:with-param>
  197. <xsl:with-param name="common-string">task_procedure</xsl:with-param>
  198. </xsl:apply-templates>
  199. </xsl:with-param>
  200. </xsl:apply-templates>
  201. <fo:list-block xsl:use-attribute-sets="steps">
  202. <xsl:call-template name="commonattributes"/>
  203. <xsl:apply-templates/>
  204. </fo:list-block>
  205. </fo:block>
  206. </xsl:when>
  207. <xsl:otherwise>
  208. <fo:list-block xsl:use-attribute-sets="steps">
  209. <xsl:call-template name="commonattributes"/>
  210. <xsl:apply-templates/>
  211. </fo:list-block>
  212. </xsl:otherwise>
  213. </xsl:choose>
  214. </xsl:template>
  215. <xsl:template match="*[contains(@class, ' task/steps-unordered ')]">
  216. <xsl:choose>
  217. <xsl:when test="$GENERATE-TASK-LABELS='YES'">
  218. <fo:block>
  219. <xsl:apply-templates select="." mode="dita2xslfo:task-heading">
  220. <xsl:with-param name="use-label">
  221. <!--<xsl:call-template name="getVariable">
  222. <xsl:with-param name="id" select="'#steps-unordered-label'"/>
  223. </xsl:call-template>-->
  224. <xsl:apply-templates select="." mode="dita2xslfo:retrieve-task-heading">
  225. <xsl:with-param name="pdf2-string">#steps-unordered-label</xsl:with-param>
  226. <xsl:with-param name="common-string">task_procedure_unordered</xsl:with-param>
  227. </xsl:apply-templates>
  228. </xsl:with-param>
  229. </xsl:apply-templates>
  230. <fo:list-block xsl:use-attribute-sets="steps-unordered">
  231. <xsl:call-template name="commonattributes"/>
  232. <xsl:apply-templates/>
  233. </fo:list-block>
  234. </fo:block>
  235. </xsl:when>
  236. <xsl:otherwise>
  237. <fo:list-block xsl:use-attribute-sets="steps-unordered">
  238. <xsl:call-template name="commonattributes"/>
  239. <xsl:apply-templates/>
  240. </fo:list-block>
  241. </xsl:otherwise>
  242. </xsl:choose>
  243. </xsl:template>
  244. <xsl:template match="*[contains(@class, ' task/steps ')]/*[contains(@class, ' task/step ')]">
  245. <!-- Switch to variable for the count rather than xsl:number, so that step specializations are also counted -->
  246. <xsl:variable name="actual-step-count" select="number(count(preceding-sibling::*[contains(@class, ' task/step ')])+1)"/>
  247. <fo:list-item xsl:use-attribute-sets="steps.step">
  248. <fo:list-item-label xsl:use-attribute-sets="steps.step__label">
  249. <fo:block xsl:use-attribute-sets="steps.step__label__content">
  250. <fo:inline>
  251. <xsl:call-template name="commonattributes"/>
  252. </fo:inline>
  253. <xsl:if test="preceding-sibling::*[contains(@class, ' task/step ')] | following-sibling::*[contains(@class, ' task/step ')]">
  254. <xsl:call-template name="getVariable">
  255. <xsl:with-param name="id" select="'Ordered List Number'"/>
  256. <xsl:with-param name="params">
  257. <number>
  258. <xsl:value-of select="$actual-step-count"/>
  259. </number>
  260. </xsl:with-param>
  261. </xsl:call-template>
  262. </xsl:if>
  263. </fo:block>
  264. </fo:list-item-label>
  265. <fo:list-item-body xsl:use-attribute-sets="steps.step__body">
  266. <fo:block xsl:use-attribute-sets="steps.step__content">
  267. <xsl:apply-templates/>
  268. </fo:block>
  269. </fo:list-item-body>
  270. </fo:list-item>
  271. </xsl:template>
  272. <xsl:template match="*[contains(@class, ' task/steps-unordered ')]/*[contains(@class, ' task/step ')]">
  273. <fo:list-item xsl:use-attribute-sets="steps-unordered.step">
  274. <fo:list-item-label xsl:use-attribute-sets="steps-unordered.step__label">
  275. <fo:block xsl:use-attribute-sets="steps-unordered.step__label__content">
  276. <fo:inline>
  277. <xsl:call-template name="commonattributes"/>
  278. </fo:inline>
  279. <xsl:call-template name="getVariable">
  280. <xsl:with-param name="id" select="'Unordered List bullet'"/>
  281. </xsl:call-template>
  282. </fo:block>
  283. </fo:list-item-label>
  284. <fo:list-item-body xsl:use-attribute-sets="steps-unordered.step__body">
  285. <fo:block xsl:use-attribute-sets="steps-unordered.step__content">
  286. <xsl:apply-templates/>
  287. </fo:block>
  288. </fo:list-item-body>
  289. </fo:list-item>
  290. </xsl:template>
  291. <xsl:template match="*[contains(@class, ' task/stepsection ')]">
  292. <fo:list-item xsl:use-attribute-sets="stepsection">
  293. <fo:list-item-label xsl:use-attribute-sets="stepsection__label">
  294. <fo:block xsl:use-attribute-sets="stepsection__label__content">
  295. <fo:inline>
  296. <xsl:call-template name="commonattributes"/>
  297. </fo:inline>
  298. </fo:block>
  299. </fo:list-item-label>
  300. <fo:list-item-body xsl:use-attribute-sets="stepsection__body">
  301. <fo:block xsl:use-attribute-sets="stepsection__content">
  302. <xsl:apply-templates/>
  303. </fo:block>
  304. </fo:list-item-body>
  305. </fo:list-item>
  306. </xsl:template>
  307. <!--Substeps-->
  308. <xsl:template match="*[contains(@class, ' task/substeps ')]">
  309. <fo:list-block xsl:use-attribute-sets="substeps">
  310. <xsl:call-template name="commonattributes"/>
  311. <xsl:apply-templates/>
  312. </fo:list-block>
  313. </xsl:template>
  314. <xsl:template match="*[contains(@class, ' task/substeps ')]/*[contains(@class, ' task/substep ')]">
  315. <fo:list-item xsl:use-attribute-sets="substeps.substep">
  316. <fo:list-item-label xsl:use-attribute-sets="substeps.substep__label">
  317. <fo:block xsl:use-attribute-sets="substeps.substep__label__content">
  318. <fo:inline>
  319. <xsl:call-template name="commonattributes"/>
  320. </fo:inline>
  321. <xsl:number format="a) "/>
  322. </fo:block>
  323. </fo:list-item-label>
  324. <fo:list-item-body xsl:use-attribute-sets="substeps.substep__body">
  325. <fo:block xsl:use-attribute-sets="substeps.substep__content">
  326. <xsl:apply-templates/>
  327. </fo:block>
  328. </fo:list-item-body>
  329. </fo:list-item>
  330. </xsl:template>
  331. <!--Choices-->
  332. <xsl:template match="*[contains(@class, ' task/choices ')]">
  333. <fo:list-block xsl:use-attribute-sets="choices">
  334. <xsl:call-template name="commonattributes"/>
  335. <xsl:apply-templates/>
  336. </fo:list-block>
  337. </xsl:template>
  338. <xsl:template match="*[contains(@class, ' task/choice ')]">
  339. <fo:list-item xsl:use-attribute-sets="choices.choice">
  340. <fo:list-item-label xsl:use-attribute-sets="choices.choice__label">
  341. <fo:block xsl:use-attribute-sets="choices.choice__label__content">
  342. <fo:inline>
  343. <xsl:call-template name="commonattributes"/>
  344. </fo:inline>
  345. <xsl:call-template name="getVariable">
  346. <xsl:with-param name="id" select="'Unordered List bullet'"/>
  347. </xsl:call-template>
  348. </fo:block>
  349. </fo:list-item-label>
  350. <fo:list-item-body xsl:use-attribute-sets="choices.choice__body">
  351. <fo:block xsl:use-attribute-sets="choices.choice__content">
  352. <xsl:apply-templates/>
  353. </fo:block>
  354. </fo:list-item-body>
  355. </fo:list-item>
  356. </xsl:template>
  357. <!-- Choice tables -->
  358. <xsl:template match="*[contains(@class, ' task/choicetable ')]">
  359. <fo:table xsl:use-attribute-sets="choicetable">
  360. <xsl:call-template name="commonattributes"/>
  361. <xsl:call-template name="univAttrs"/>
  362. <xsl:call-template name="globalAtts"/>
  363. <xsl:if test="@relcolwidth">
  364. <xsl:variable name="fix-relcolwidth">
  365. <xsl:apply-templates select="." mode="fix-relcolwidth">
  366. <xsl:with-param name="number-cells" select="2"/>
  367. </xsl:apply-templates>
  368. </xsl:variable>
  369. <xsl:call-template name="createSimpleTableColumns">
  370. <xsl:with-param name="theColumnWidthes" select="$fix-relcolwidth"/>
  371. </xsl:call-template>
  372. </xsl:if>
  373. <xsl:choose>
  374. <xsl:when test="*[contains(@class, ' task/chhead ')]">
  375. <xsl:apply-templates select="*[contains(@class, ' task/chhead ')]"/>
  376. </xsl:when>
  377. <xsl:otherwise>
  378. <fo:table-header xsl:use-attribute-sets="chhead">
  379. <fo:table-row xsl:use-attribute-sets="chhead__row">
  380. <fo:table-cell xsl:use-attribute-sets="chhead.choptionhd">
  381. <fo:block xsl:use-attribute-sets="chhead.choptionhd__content">
  382. <xsl:call-template name="getVariable">
  383. <xsl:with-param name="id" select="'Option'"/>
  384. </xsl:call-template>
  385. </fo:block>
  386. </fo:table-cell>
  387. <fo:table-cell xsl:use-attribute-sets="chhead.chdeschd">
  388. <fo:block xsl:use-attribute-sets="chhead.chdeschd__content">
  389. <xsl:call-template name="getVariable">
  390. <xsl:with-param name="id" select="'Description'"/>
  391. </xsl:call-template>
  392. </fo:block>
  393. </fo:table-cell>
  394. </fo:table-row>
  395. </fo:table-header>
  396. </xsl:otherwise>
  397. </xsl:choose>
  398. <fo:table-body xsl:use-attribute-sets="choicetable__body">
  399. <xsl:apply-templates select="*[contains(@class, ' task/chrow ')]"/>
  400. </fo:table-body>
  401. </fo:table>
  402. </xsl:template>
  403. <xsl:template match="*[contains(@class, ' task/chhead ')]">
  404. <fo:table-header xsl:use-attribute-sets="chhead">
  405. <xsl:call-template name="commonattributes"/>
  406. <fo:table-row xsl:use-attribute-sets="chhead__row">
  407. <xsl:apply-templates/>
  408. </fo:table-row>
  409. </fo:table-header>
  410. </xsl:template>
  411. <xsl:template match="*[contains(@class, ' task/chrow ')]">
  412. <fo:table-row xsl:use-attribute-sets="chrow">
  413. <xsl:call-template name="commonattributes"/>
  414. <xsl:apply-templates/>
  415. </fo:table-row>
  416. </xsl:template>
  417. <xsl:template match="*[contains(@class, ' task/chhead ')]/*[contains(@class, ' task/choptionhd ')]">
  418. <fo:table-cell xsl:use-attribute-sets="chhead.choptionhd">
  419. <xsl:call-template name="commonattributes"/>
  420. <fo:block xsl:use-attribute-sets="chhead.choptionhd__content">
  421. <xsl:apply-templates/>
  422. </fo:block>
  423. </fo:table-cell>
  424. </xsl:template>
  425. <xsl:template match="*[contains(@class, ' task/chhead ')]/*[contains(@class, ' task/chdeschd ')]">
  426. <fo:table-cell xsl:use-attribute-sets="chhead.chdeschd">
  427. <xsl:call-template name="commonattributes"/>
  428. <fo:block xsl:use-attribute-sets="chhead.chdeschd__content">
  429. <xsl:apply-templates/>
  430. </fo:block>
  431. </fo:table-cell>
  432. </xsl:template>
  433. <xsl:template match="*[contains(@class, ' task/chrow ')]/*[contains(@class, ' task/choption ')]">
  434. <xsl:variable name="keyCol" select="ancestor::*[contains(@class, ' task/choicetable ')][1]/@keycol"/>
  435. <fo:table-cell xsl:use-attribute-sets="chrow.choption">
  436. <xsl:call-template name="commonattributes"/>
  437. <xsl:choose>
  438. <xsl:when test="$keyCol = 1">
  439. <fo:block xsl:use-attribute-sets="chrow.choption__keycol-content">
  440. <xsl:apply-templates/>
  441. </fo:block>
  442. </xsl:when>
  443. <xsl:otherwise>
  444. <fo:block xsl:use-attribute-sets="chrow.choption__content">
  445. <xsl:apply-templates/>
  446. </fo:block>
  447. </xsl:otherwise>
  448. </xsl:choose>
  449. </fo:table-cell>
  450. </xsl:template>
  451. <xsl:template match="*[contains(@class, ' task/chrow ')]/*[contains(@class, ' task/chdesc ')]">
  452. <xsl:variable name="keyCol" select="number(ancestor::*[contains(@class, ' task/choicetable ')][1]/@keycol)"/>
  453. <fo:table-cell xsl:use-attribute-sets="chrow.chdesc">
  454. <xsl:call-template name="commonattributes"/>
  455. <xsl:choose>
  456. <xsl:when test="$keyCol = 2">
  457. <fo:block xsl:use-attribute-sets="chrow.chdesc__keycol-content">
  458. <xsl:apply-templates/>
  459. </fo:block>
  460. </xsl:when>
  461. <xsl:otherwise>
  462. <fo:block xsl:use-attribute-sets="chrow.chdesc__content">
  463. <xsl:apply-templates/>
  464. </fo:block>
  465. </xsl:otherwise>
  466. </xsl:choose>
  467. </fo:table-cell>
  468. </xsl:template>
  469. <!-- Example -->
  470. <xsl:template match="*[contains(@class, ' topic/example ')]" mode="dita2xslfo:task-heading">
  471. <xsl:param name="use-label"/>
  472. <xsl:if test="$GENERATE-TASK-LABELS='YES'">
  473. <fo:block xsl:use-attribute-sets="example.title">
  474. <fo:inline>
  475. <xsl:copy-of select="$use-label"/>
  476. </fo:inline>
  477. </fo:block>
  478. </xsl:if>
  479. </xsl:template>
  480. <xsl:template match="*" mode="dita2xslfo:task-heading">
  481. <xsl:param name="use-label"/>
  482. <xsl:if test="$GENERATE-TASK-LABELS='YES'">
  483. <fo:block xsl:use-attribute-sets="section.title">
  484. <fo:inline><xsl:copy-of select="$use-label"/></fo:inline>
  485. </fo:block>
  486. </xsl:if>
  487. </xsl:template>
  488. <!-- Set up to allow string retrieval based on the original PDF2 string;
  489. if not found, fall back to the common string -->
  490. <xsl:template match="*" mode="dita2xslfo:retrieve-task-heading">
  491. <xsl:param name="pdf2-string"/>
  492. <xsl:param name="common-string"/>
  493. <xsl:variable name="retrieved-pdf2-string">
  494. <!-- By default, will return the lookup value -->
  495. <xsl:call-template name="getVariable">
  496. <xsl:with-param name="id" select="$pdf2-string"/>
  497. </xsl:call-template>
  498. </xsl:variable>
  499. <xsl:choose>
  500. <xsl:when test="$retrieved-pdf2-string!=$pdf2-string and $retrieved-pdf2-string!=''">
  501. <xsl:value-of select="$retrieved-pdf2-string"/>
  502. </xsl:when>
  503. <xsl:otherwise>
  504. <xsl:call-template name="getVariable">
  505. <xsl:with-param name="id" select="$common-string"/>
  506. </xsl:call-template>
  507. </xsl:otherwise>
  508. </xsl:choose>
  509. </xsl:template>
  510. </xsl:stylesheet>