dita2odt-task.xsl 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- This file is part of the DITA Open Toolkit project.
  3. See the accompanying license.txt file for applicable licenses. -->
  4. <!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
  5. <!-- 20090904 RDA: Add support for stepsection; combine duplicated logic
  6. for main steps and steps-unordered templates. -->
  7. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  9. xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
  10. xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  11. xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  12. xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
  13. xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
  14. xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/"
  15. xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
  16. xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
  17. xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
  18. xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
  19. xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
  20. xmlns:math="http://www.w3.org/1998/Math/MathML"
  21. xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
  22. xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  23. xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"
  24. xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  25. xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
  26. xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
  27. xmlns:prodtools="http://www.ibm.com/xmlns/prodtools"
  28. xmlns:related-links="http://dita-ot.sourceforge.net/ns/200709/related-links"
  29. xmlns:dita2html="http://dita-ot.sourceforge.net/ns/200801/dita2html"
  30. xmlns:ditamsg="http://dita-ot.sourceforge.net/ns/200704/ditamsg"
  31. version="2.0"
  32. exclude-result-prefixes="xs related-links dita2html ditamsg">
  33. <xsl:output method="xml"/>
  34. <xsl:output indent="yes"/>
  35. <xsl:strip-space elements="*"/>
  36. <!-- Determines whether to generate titles for task sections. Values are YES and NO. -->
  37. <xsl:param name="GENERATE-TASK-LABELS" select="'NO'"/>
  38. <!-- == TASK UNIQUE SUBSTRUCTURES == -->
  39. <xsl:template match="*[contains(@class,' task/taskbody ')]" name="topic.task.taskbody">
  40. <!-- Added for DITA 1.1 "Shortdesc proposal" -->
  41. <!-- get the abstract para -->
  42. <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/abstract ')]"
  43. mode="outofline"/>
  44. <!-- get the short descr para -->
  45. <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/shortdesc ')]"
  46. mode="outofline"/>
  47. <!-- Insert pre-req links here, after shortdesc - unless there is a prereq section about -->
  48. <xsl:if test="not(*[contains(@class,' task/prereq ')])">
  49. <xsl:apply-templates select="following-sibling::*[contains(@class,' topic/related-links ')]"
  50. mode="prereqs"/>
  51. </xsl:if>
  52. <xsl:apply-templates/>
  53. </xsl:template>
  54. <xsl:template match="*[contains(@class,' task/prereq ')]" mode="get-output-class">p</xsl:template>
  55. <xsl:template match="*[contains(@class,' task/prereq ')]" name="topic.task.prereq">
  56. <xsl:apply-templates select="." mode="prereq-fmt"/>
  57. </xsl:template>
  58. <xsl:template match="*[contains(@class,' task/prereq ')]" mode="prereq-fmt">
  59. <!-- Title is not allowed now, but if we add it, make sure it is processed as in section -->
  60. <text:p>
  61. <text:span>
  62. <!-- start add rev flagging styles -->
  63. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  64. <xsl:apply-templates select="*[not(contains(@class,' topic/title '))] | text() | comment() | processing-instruction()"/>
  65. <!-- end add rev flagging styles -->
  66. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  67. </text:span>
  68. </text:p>
  69. <!-- Insert pre-req links - after prereq section -->
  70. <xsl:apply-templates select="../following-sibling::*[contains(@class,' topic/related-links ')]"
  71. mode="prereqs"/>
  72. </xsl:template>
  73. <xsl:template match="*" mode="make-steps-compact">
  74. <xsl:choose>
  75. <!-- expand the list when one of the steps has any of these: "*/*" = step context -->
  76. <xsl:when test="*/*[contains(@class,' task/info ')]">yes</xsl:when>
  77. <xsl:when test="*/*[contains(@class,' task/stepxmp ')]">yes</xsl:when>
  78. <xsl:when test="*/*[contains(@class,' task/tutorialinfo ')]">yes</xsl:when>
  79. <xsl:when test="*/*[contains(@class,' task/stepresult ')]">yes</xsl:when>
  80. <xsl:otherwise>no</xsl:otherwise>
  81. </xsl:choose>
  82. </xsl:template>
  83. <xsl:template match="*[contains(@class,' task/steps ')]" name="topic.task.steps">
  84. <!-- If there's one of these elements somewhere in a step, expand the whole step list -->
  85. <xsl:variable name="step_expand">
  86. <!-- set & save step_expand=yes/no for expanding/compacting list items -->
  87. <xsl:apply-templates select="." mode="make-steps-compact"/>
  88. </xsl:variable>
  89. <!-- start flagging -->
  90. <xsl:apply-templates select="." mode="start-add-odt-flags">
  91. <xsl:with-param name="family" select="'_list'"/>
  92. </xsl:apply-templates>
  93. <xsl:apply-templates select="." mode="steps-fmt">
  94. <xsl:with-param name="step_expand" select="$step_expand"/>
  95. </xsl:apply-templates>
  96. <!-- end flagging -->
  97. <xsl:apply-templates select="." mode="end-add-odt-flags">
  98. <xsl:with-param name="family" select="'_list'"/>
  99. </xsl:apply-templates>
  100. </xsl:template>
  101. <xsl:template
  102. match="*[contains(@class,' task/steps ') or contains(@class,' task/steps-unordered ')]"
  103. mode="common-processing-within-steps">
  104. <xsl:param name="step_expand"/>
  105. <xsl:param name="list-type">
  106. <xsl:choose>
  107. <!-- ordered list -->
  108. <xsl:when test="contains(@class,' task/steps ')">ordered_list_style</xsl:when>
  109. <!-- unordered list -->
  110. <xsl:otherwise>list_style</xsl:otherwise>
  111. </xsl:choose>
  112. </xsl:param>
  113. <xsl:apply-templates select="." mode="generate-task-label">
  114. <xsl:with-param name="use-label">
  115. <xsl:call-template name="getVariable">
  116. <xsl:with-param name="id">
  117. <xsl:choose>
  118. <xsl:when test="contains(@class,' task/steps ')">task_procedure</xsl:when>
  119. <xsl:otherwise>task_procedure_unordered</xsl:otherwise>
  120. </xsl:choose>
  121. </xsl:with-param>
  122. </xsl:call-template>
  123. </xsl:with-param>
  124. </xsl:apply-templates>
  125. <xsl:choose>
  126. <xsl:when
  127. test="*[contains(@class,' task/step ')] and not(*[contains(@class,' task/step ')][2])">
  128. <!-- Single step. Process any stepsection before the step (cannot appear after). -->
  129. <xsl:apply-templates select="*[contains(@class,' task/stepsection ')]"/>
  130. <xsl:apply-templates select="*[contains(@class,' task/step ')]" mode="onestep">
  131. <xsl:with-param name="step_expand" select="$step_expand"/>
  132. </xsl:apply-templates>
  133. </xsl:when>
  134. <xsl:when test="not(*[contains(@class,' task/stepsection ')])">
  135. <xsl:apply-templates select="." mode="step-elements-with-no-stepsection">
  136. <xsl:with-param name="step_expand" select="$step_expand"/>
  137. <xsl:with-param name="list-type" select="$list-type"/>
  138. </xsl:apply-templates>
  139. </xsl:when>
  140. <xsl:when
  141. test="*[1][contains(@class,' task/stepsection ')] and not(*[contains(@class,' task/stepsection ')][2])">
  142. <!-- Stepsection is first, no other appearances -->
  143. <xsl:apply-templates select="*[contains(@class,' task/stepsection ')]"/>
  144. <xsl:apply-templates select="." mode="step-elements-with-no-stepsection">
  145. <xsl:with-param name="step_expand" select="$step_expand"/>
  146. <xsl:with-param name="list-type" select="$list-type"/>
  147. </xsl:apply-templates>
  148. </xsl:when>
  149. <xsl:otherwise>
  150. <!-- Stepsection elements mixed in with steps -->
  151. <xsl:apply-templates select="." mode="step-elements-with-stepsection">
  152. <xsl:with-param name="step_expand" select="$step_expand"/>
  153. <xsl:with-param name="list-type" select="$list-type"/>
  154. </xsl:apply-templates>
  155. </xsl:otherwise>
  156. </xsl:choose>
  157. </xsl:template>
  158. <!-- step-elements-with-no-stepsection -->
  159. <xsl:template match="*" mode="step-elements-with-no-stepsection">
  160. <xsl:param name="step_expand"/>
  161. <xsl:param name="list-type"/>
  162. <!--
  163. <xsl:call-template name="setaname"/>
  164. -->
  165. <text:list text:style-name="{$list-type}">
  166. <!--
  167. <xsl:call-template name="commonattributes"/>
  168. <xsl:call-template name="gen-style"/>
  169. <xsl:call-template name="setid"/>
  170. -->
  171. <xsl:apply-templates select="*[contains(@class,' task/step ')]" mode="steps">
  172. <xsl:with-param name="step_expand" select="$step_expand"/>
  173. </xsl:apply-templates>
  174. </text:list>
  175. </xsl:template>
  176. <!-- step-elements-with-stepsection -->
  177. <xsl:template match="*" mode="step-elements-with-stepsection">
  178. <xsl:param name="step_expand"/>
  179. <xsl:param name="list-type"/>
  180. <xsl:for-each select="*">
  181. <xsl:choose>
  182. <xsl:when test="contains(@class,' task/stepsection ')">
  183. <xsl:apply-templates select="."/>
  184. </xsl:when>
  185. <xsl:when
  186. test="contains(@class,' task/step ') and preceding-sibling::*[1][contains(@class,' task/step ')]">
  187. <!-- Do nothing, was pulled in through recursion -->
  188. </xsl:when>
  189. <xsl:otherwise>
  190. <!-- First step in a series of steps -->
  191. <text:list text:style-name="{$list-type}">
  192. <xsl:variable name="start-value">
  193. <xsl:if test="$list-type='ordered_list_style' and preceding-sibling::*[contains(@class,' task/step ')]">
  194. <!-- Restart numbering for ordered steps that were interrupted by stepsection.
  195. The start attribute is valid in XHTML 1.0 Transitional, but not for XHTML 1.0 Strict.
  196. It is possible (preferable) to keep stepsection within an <li> and use CSS to
  197. fix numbering, but with testing in March of 2009, this does not work in IE.
  198. It is possible in Firefox 3. -->
  199. <xsl:value-of select="count(preceding-sibling::*[contains(@class,' task/step ')])+1"/>
  200. </xsl:if>
  201. </xsl:variable>
  202. <xsl:apply-templates select="." mode="steps">
  203. <xsl:with-param name="step_expand" select="$step_expand"/>
  204. <xsl:with-param name="start-value" select="$start-value"/>
  205. </xsl:apply-templates>
  206. <xsl:apply-templates select="following-sibling::*[1][contains(@class,' task/step ')]"
  207. mode="sequence-of-steps">
  208. <xsl:with-param name="step_expand" select="$step_expand"/>
  209. </xsl:apply-templates>
  210. </text:list>
  211. </xsl:otherwise>
  212. </xsl:choose>
  213. </xsl:for-each>
  214. </xsl:template>
  215. <xsl:template match="*" mode="sequence-of-steps">
  216. <xsl:param name="step_expand"/>
  217. <xsl:apply-templates select="." mode="steps">
  218. <xsl:with-param name="step_expand" select="$step_expand"/>
  219. </xsl:apply-templates>
  220. <xsl:apply-templates select="following-sibling::*[1][contains(@class,' task/step ')]"
  221. mode="sequence-of-steps">
  222. <xsl:with-param name="step_expand" select="$step_expand"/>
  223. </xsl:apply-templates>
  224. </xsl:template>
  225. <xsl:template match="*[contains(@class,' task/stepsection ')]">
  226. <text:span>
  227. <!-- start add flagging styles -->
  228. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  229. <xsl:apply-templates/>
  230. <!-- end add flagging styles -->
  231. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  232. </text:span>
  233. </xsl:template>
  234. <xsl:template match="*[contains(@class,' task/steps-unordered ')]"
  235. name="topic.task.steps-unordered">
  236. <!-- If there's a block element somewhere in the step list, expand the whole list -->
  237. <xsl:variable name="step_expand">
  238. <!-- set & save step_expand=yes/no for expanding/compacting list items -->
  239. <xsl:apply-templates select="." mode="make-steps-compact"/>
  240. </xsl:variable>
  241. <!-- start flagging -->
  242. <xsl:apply-templates select="." mode="start-add-odt-flags">
  243. <xsl:with-param name="family" select="'_list'"/>
  244. </xsl:apply-templates>
  245. <!-- render list -->
  246. <xsl:apply-templates select="." mode="stepsunord-fmt">
  247. <xsl:with-param name="step_expand" select="$step_expand"/>
  248. </xsl:apply-templates>
  249. <!-- end flagging -->
  250. <xsl:apply-templates select="." mode="end-add-odt-flags">
  251. <xsl:with-param name="family" select="'_list'"/>
  252. </xsl:apply-templates>
  253. </xsl:template>
  254. <xsl:template match="*[contains(@class,' task/steps ')]" mode="steps-fmt">
  255. <xsl:param name="step_expand"/>
  256. <xsl:apply-templates select="." mode="common-processing-within-steps">
  257. <xsl:with-param name="step_expand" select="$step_expand"/>
  258. <xsl:with-param name="list-type" select="'ordered_list_style'"/>
  259. </xsl:apply-templates>
  260. </xsl:template>
  261. <xsl:template match="*[contains(@class,' task/steps-unordered ')]" mode="stepsunord-fmt">
  262. <xsl:param name="step_expand"/>
  263. <xsl:apply-templates select="." mode="common-processing-within-steps">
  264. <xsl:with-param name="step_expand" select="$step_expand"/>
  265. <xsl:with-param name="list-type" select="'list_style'"/>
  266. </xsl:apply-templates>
  267. </xsl:template>
  268. <!-- only 1 step - output as a para -->
  269. <xsl:template match="*[contains(@class,' task/step ')]" mode="onestep">
  270. <xsl:param name="step_expand"/>
  271. <xsl:apply-templates select="." mode="onestep-fmt">
  272. <xsl:with-param name="step_expand" select="$step_expand"/>
  273. </xsl:apply-templates>
  274. </xsl:template>
  275. <xsl:template match="*[contains(@class,' task/step ')]" mode="onestep-fmt">
  276. <xsl:param name="step_expand"/>
  277. <xsl:variable name="flagrules">
  278. <xsl:call-template name="getrules"/>
  279. </xsl:variable>
  280. <text:list text:style-name="list_style">
  281. <text:list-item>
  282. <xsl:if test="@importance='optional'">
  283. <text:p>
  284. <text:span text:style-name="bold">
  285. <xsl:call-template name="getVariable">
  286. <xsl:with-param name="id" select="'Optional'"/>
  287. </xsl:call-template>
  288. <xsl:call-template name="getVariable">
  289. <xsl:with-param name="id" select="'ColonSymbol'"/>
  290. </xsl:call-template>
  291. <xsl:text> </xsl:text>
  292. </text:span>
  293. </text:p>
  294. </xsl:if>
  295. <xsl:if test="@importance='required'">
  296. <text:p>
  297. <text:span text:style-name="bold">
  298. <xsl:call-template name="getVariable">
  299. <xsl:with-param name="id" select="'Required'"/>
  300. </xsl:call-template>
  301. <xsl:call-template name="getVariable">
  302. <xsl:with-param name="id" select="'ColonSymbol'"/>
  303. </xsl:call-template>
  304. <xsl:text> </xsl:text>
  305. </text:span>
  306. </text:p>
  307. </xsl:if>
  308. <xsl:apply-templates mode="create_list_item"/>
  309. </text:list-item>
  310. </text:list>
  311. </xsl:template>
  312. <!-- multiple steps - output as list items -->
  313. <xsl:template match="*[contains(@class,' task/step ')]" mode="steps">
  314. <xsl:param name="step_expand"/>
  315. <xsl:param name="start-value">0</xsl:param>
  316. <xsl:variable name="revtest" as="xs:integer?">
  317. <xsl:if test="@rev and not($FILTERFILE='') and ($DRAFT='yes')">
  318. <xsl:call-template name="find-active-rev-flag">
  319. <xsl:with-param name="allrevs" select="@rev"/>
  320. </xsl:call-template>
  321. </xsl:if>
  322. </xsl:variable>
  323. <xsl:choose>
  324. <xsl:when test="$revtest=1">
  325. <!-- Rev is active - add the DIV -->
  326. <xsl:apply-templates select="." mode="steps-fmt">
  327. <xsl:with-param name="step_expand" select="$step_expand"/>
  328. </xsl:apply-templates>
  329. </xsl:when>
  330. <xsl:otherwise>
  331. <!-- Rev wasn't active - process normally -->
  332. <xsl:apply-templates select="." mode="steps-fmt">
  333. <xsl:with-param name="step_expand" select="$step_expand"/>
  334. <xsl:with-param name="start-value" select="$start-value"/>
  335. </xsl:apply-templates>
  336. </xsl:otherwise>
  337. </xsl:choose>
  338. </xsl:template>
  339. <xsl:template match="*[contains(@class,' task/step ')]" mode="steps-fmt">
  340. <xsl:param name="step_expand"/>
  341. <xsl:param name="start-value">0</xsl:param>
  342. <text:list-item>
  343. <xsl:if test="$start-value &gt; 0">
  344. <xsl:attribute name="text:start-value">
  345. <xsl:value-of select="$start-value"/>
  346. </xsl:attribute>
  347. </xsl:if>
  348. <xsl:if test="@importance='optional'">
  349. <text:p>
  350. <text:span text:style-name="bold">
  351. <xsl:call-template name="getVariable">
  352. <xsl:with-param name="id" select="'Optional'"/>
  353. </xsl:call-template>
  354. <xsl:call-template name="getVariable">
  355. <xsl:with-param name="id" select="'ColonSymbol'"/>
  356. </xsl:call-template>
  357. <xsl:text> </xsl:text>
  358. </text:span>
  359. </text:p>
  360. </xsl:if>
  361. <xsl:if test="@importance='required'">
  362. <text:p>
  363. <text:span text:style-name="bold">
  364. <xsl:call-template name="getVariable">
  365. <xsl:with-param name="id" select="'Required'"/>
  366. </xsl:call-template>
  367. <xsl:call-template name="getVariable">
  368. <xsl:with-param name="id" select="'ColonSymbol'"/>
  369. </xsl:call-template>
  370. <xsl:text> </xsl:text>
  371. </text:span>
  372. </text:p>
  373. </xsl:if>
  374. <xsl:apply-templates mode="create_list_item"/>
  375. </text:list-item>
  376. </xsl:template>
  377. <!-- nested steps - 1 level of nesting only -->
  378. <xsl:template match="*[contains(@class,' task/substeps ')]" name="topic.task.substeps">
  379. <!-- If there's a block element somewhere in the step list, expand the whole list -->
  380. <xsl:variable name="sub_step_expand">
  381. <!-- set & save sub_step_expand=yes/no for expanding/compacting list items -->
  382. <xsl:apply-templates select="." mode="make-steps-compact"/>
  383. </xsl:variable>
  384. <xsl:apply-templates select="." mode="substeps-fmt">
  385. <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
  386. </xsl:apply-templates>
  387. </xsl:template>
  388. <xsl:template match="*[contains(@class,' task/substeps ')]" mode="substeps-fmt">
  389. <xsl:param name="sub_step_expand"/>
  390. <xsl:variable name="flagrules">
  391. <xsl:call-template name="getrules"/>
  392. </xsl:variable>
  393. <!--
  394. <xsl:call-template name="setaname"/>
  395. -->
  396. <text:list text:style-name="ordered_list_style">
  397. <xsl:if test="parent::*/parent::*[contains(@class,' task/steps ')]">
  398. <!-- Is the grandparent an ordered step? -->
  399. <!--
  400. <xsl:attribute name="type">a</xsl:attribute>
  401. -->
  402. <!-- yup, letter these steps -->
  403. </xsl:if>
  404. <!-- otherwise, default to numbered -->
  405. <xsl:apply-templates>
  406. <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
  407. </xsl:apply-templates>
  408. </text:list>
  409. </xsl:template>
  410. <!-- nested step -->
  411. <xsl:template match="*[contains(@class,' task/substep ')]" name="topic.task.substep">
  412. <xsl:param name="sub_step_expand"/>
  413. <xsl:variable name="revtest" as="xs:integer?">
  414. <xsl:if test="@rev and not($FILTERFILE='') and ($DRAFT='yes')">
  415. <!-- revision? -->
  416. <xsl:call-template name="find-active-rev-flag">
  417. <!-- active? (revtest will be 1 when active)-->
  418. <xsl:with-param name="allrevs" select="@rev"/>
  419. </xsl:call-template>
  420. </xsl:if>
  421. </xsl:variable>
  422. <xsl:choose>
  423. <xsl:when test="$revtest=1">
  424. <!-- Rev is active - add the DIV -->
  425. <!--
  426. <span class="{@rev}">
  427. -->
  428. <xsl:apply-templates select="." mode="substep-fmt">
  429. <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
  430. </xsl:apply-templates>
  431. <!--
  432. </span>
  433. -->
  434. </xsl:when>
  435. <xsl:otherwise>
  436. <!-- Rev wasn't active - process normally -->
  437. <xsl:apply-templates select="." mode="substep-fmt">
  438. <xsl:with-param name="sub_step_expand" select="$sub_step_expand"/>
  439. </xsl:apply-templates>
  440. </xsl:otherwise>
  441. </xsl:choose>
  442. </xsl:template>
  443. <xsl:template match="*[contains(@class,' task/substep ')]" mode="substep-fmt">
  444. <xsl:param name="sub_step_expand"/>
  445. <xsl:variable name="flagrules">
  446. <xsl:call-template name="getrules"/>
  447. </xsl:variable>
  448. <text:list-item>
  449. <xsl:if test="$sub_step_expand='yes'">
  450. <!--
  451. <xsl:attribute name="class">substepexpand</xsl:attribute>
  452. -->
  453. </xsl:if>
  454. <!--
  455. <xsl:call-template name="commonattributes"/>
  456. <xsl:call-template name="gen-style">
  457. <xsl:with-param name="flagrules" select="$flagrules"/>
  458. </xsl:call-template>
  459. <xsl:call-template name="setidaname"/>
  460. <xsl:call-template name="start-flagit">
  461. <xsl:with-param name="flagrules" select="$flagrules"/>
  462. </xsl:call-template>
  463. <xsl:call-template name="start-revflag">
  464. <xsl:with-param name="flagrules" select="$flagrules"/>
  465. </xsl:call-template>
  466. -->
  467. <xsl:if test="@importance='optional'">
  468. <text:p>
  469. <text:span text:style-name="bold">
  470. <xsl:call-template name="getVariable">
  471. <xsl:with-param name="id" select="'Optional'"/>
  472. </xsl:call-template>
  473. <xsl:call-template name="getVariable">
  474. <xsl:with-param name="id" select="'ColonSymbol'"/>
  475. </xsl:call-template>
  476. <xsl:text> </xsl:text>
  477. </text:span>
  478. </text:p>
  479. </xsl:if>
  480. <xsl:if test="@importance='required'">
  481. <text:p>
  482. <text:span text:style-name="bold">
  483. <xsl:call-template name="getVariable">
  484. <xsl:with-param name="id" select="'Required'"/>
  485. </xsl:call-template>
  486. <xsl:call-template name="getVariable">
  487. <xsl:with-param name="id" select="'ColonSymbol'"/>
  488. </xsl:call-template>
  489. <xsl:text> </xsl:text>
  490. </text:span>
  491. </text:p>
  492. </xsl:if>
  493. <xsl:apply-templates mode="create_list_item"/>
  494. </text:list-item>
  495. <!--
  496. <xsl:call-template name="end-revflag">
  497. <xsl:with-param name="flagrules" select="$flagrules"/>
  498. </xsl:call-template>
  499. <xsl:call-template name="end-flagit">
  500. <xsl:with-param name="flagrules" select="$flagrules"/>
  501. </xsl:call-template>
  502. -->
  503. </xsl:template>
  504. <!-- choices contain choice items -->
  505. <xsl:template match="*[contains(@class,' task/choices ')]" name="topic.task.choices">
  506. <xsl:variable name="revtest" as="xs:integer?">
  507. <xsl:if test="@rev and not($FILTERFILE='') and ($DRAFT='yes')">
  508. <xsl:call-template name="find-active-rev-flag">
  509. <xsl:with-param name="allrevs" select="@rev"/>
  510. </xsl:call-template>
  511. </xsl:if>
  512. </xsl:variable>
  513. <xsl:choose>
  514. <xsl:when test="$revtest=1"> <!-- Rev is active - add the DIV -->
  515. <xsl:apply-templates select="." mode="choices-fmt"/>
  516. </xsl:when>
  517. <xsl:otherwise> <!-- Rev wasn't active - process normally -->
  518. <xsl:apply-templates select="." mode="choices-fmt"/>
  519. </xsl:otherwise>
  520. </xsl:choose>
  521. </xsl:template>
  522. <xsl:template match="*[contains(@class,' task/choices ')]" mode="choices-fmt">
  523. <xsl:variable name="flagrules">
  524. <xsl:call-template name="getrules"/>
  525. </xsl:variable>
  526. <text:list text:style-name="list_style">
  527. <xsl:apply-templates/>
  528. </text:list>
  529. </xsl:template>
  530. <!-- task choice table -->
  531. <xsl:template match="*[contains(@class, ' task/choicetable ')]">
  532. <xsl:choose>
  533. <!-- if the table is under p(direct child) -->
  534. <xsl:when test="parent::*[contains(@class, ' topic/p ')]">
  535. <!-- break p tag -->
  536. <xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
  537. <xsl:apply-templates/>
  538. <!-- start p tag again -->
  539. <xsl:text disable-output-escaping="yes">&lt;text:p&gt;</xsl:text>
  540. </xsl:when>
  541. <!-- nested by list -->
  542. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  543. <!-- caculate list depth -->
  544. <xsl:variable name="depth">
  545. <xsl:call-template name="calculate_list_depth"/>
  546. </xsl:variable>
  547. <!-- caculate span tag depth -->
  548. <xsl:variable name="span_depth">
  549. <xsl:call-template name="calculate_span_depth_for_tag">
  550. <xsl:with-param name="tag_class" select="' topic/li '"/>
  551. </xsl:call-template>
  552. </xsl:variable>
  553. <!-- break span tags -->
  554. <xsl:call-template name="break_span_tags">
  555. <xsl:with-param name="depth" select="$span_depth"/>
  556. <xsl:with-param name="order" select="0"/>
  557. </xsl:call-template>
  558. <!-- break first p tag if there are span tags -->
  559. <xsl:if test="$span_depth &gt;= 0">
  560. <xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
  561. </xsl:if>
  562. <!-- break list tag -->
  563. <xsl:call-template name="create_items_for_list">
  564. <xsl:with-param name="depth" select="$depth"/>
  565. <xsl:with-param name="order" select="0"/>
  566. </xsl:call-template>
  567. <!-- normal process -->
  568. <!-- start render table -->
  569. <xsl:variable name="tablenameId" select="generate-id(.)"/>
  570. <xsl:choose>
  571. <xsl:when test="not(./*[contains(@class,' task/chhead ')])">
  572. <!-- start flagging -->
  573. <xsl:apply-templates select="." mode="start-add-odt-flags">
  574. <xsl:with-param name="family" select="'_table'"/>
  575. </xsl:apply-templates>
  576. <table:table table:name="{concat('Table', $tablenameId)}">
  577. <!-- table background flagging -->
  578. <xsl:apply-templates select="." mode="start-add-odt-flags">
  579. <xsl:with-param name="family" select="'_table_attr'"/>
  580. </xsl:apply-templates>
  581. <xsl:variable name="colnumNum">
  582. <xsl:call-template name="count_columns_for_simpletable"/>
  583. </xsl:variable>
  584. <xsl:call-template name="create_columns_for_simpletable">
  585. <xsl:with-param name="column" select="$colnumNum"/>
  586. </xsl:call-template>
  587. <xsl:call-template name="create_head_for_choicetable"/>
  588. <xsl:apply-templates/>
  589. </table:table>
  590. <!-- end flagging -->
  591. <xsl:apply-templates select="." mode="end-add-odt-flags">
  592. <xsl:with-param name="family" select="'_table'"/>
  593. </xsl:apply-templates>
  594. </xsl:when>
  595. <xsl:otherwise>
  596. <xsl:call-template name="create_simpletable"/>
  597. </xsl:otherwise>
  598. </xsl:choose>
  599. <!-- start list tag again -->
  600. <xsl:call-template name="create_items_for_list">
  601. <xsl:with-param name="depth" select="$depth"/>
  602. <xsl:with-param name="order" select="1"/>
  603. </xsl:call-template>
  604. <!-- start p tag again if there are span tags -->
  605. <xsl:if test="$span_depth &gt;= 0">
  606. <xsl:text disable-output-escaping="yes">&lt;text:p&gt;</xsl:text>
  607. </xsl:if>
  608. <!-- span tags span tags again-->
  609. <xsl:call-template name="break_span_tags">
  610. <xsl:with-param name="depth" select="$span_depth"/>
  611. <xsl:with-param name="order" select="1"/>
  612. </xsl:call-template>
  613. </xsl:when>
  614. </xsl:choose>
  615. </xsl:template>
  616. <!-- create choicetable header. -->
  617. <xsl:template name="create_head_for_choicetable">
  618. <table:table-header-rows>
  619. <table:table-row>
  620. <table:table-cell office:value-type="string" table:style-name="cell_style_1_task">
  621. <!-- Option is always 1nd column in the 1st row -->
  622. <text:p>
  623. <text:span text:style-name="bold">
  624. <xsl:call-template name="getVariable">
  625. <xsl:with-param name="id" select="'Option'"/>
  626. </xsl:call-template>
  627. </text:span>
  628. </text:p>
  629. </table:table-cell>
  630. <table:table-cell office:value-type="string" table:style-name="cell_style_2_task">
  631. <!-- Description is always 1nd column in the 1st row -->
  632. <text:p>
  633. <text:span text:style-name="bold">
  634. <xsl:call-template name="getVariable">
  635. <xsl:with-param name="id" select="'Description'"/>
  636. </xsl:call-template>
  637. </text:span>
  638. </text:p>
  639. </table:table-cell>
  640. </table:table-row>
  641. </table:table-header-rows>
  642. </xsl:template>
  643. <xsl:template match="*[contains(@class,' task/chrow ')]" priority="2">
  644. <xsl:param name="width-multiplier">0</xsl:param>
  645. <table:table-row>
  646. <xsl:apply-templates mode="emit-cell-style"/>
  647. </table:table-row>
  648. </xsl:template>
  649. <!-- for choption in choice table. -->
  650. <xsl:template match="*[contains(@class, ' task/choption ')]" mode="emit-cell-style">
  651. <table:table-cell office:value-type="string">
  652. <xsl:call-template name="create_style_stable"/>
  653. <text:p>
  654. <!-- choption should always bolded -->
  655. <text:span text:style-name="bold">
  656. <xsl:apply-templates select="text()" mode="txt_for_choicetable"/>
  657. </text:span>
  658. </text:p>
  659. <xsl:apply-templates select="*[@class]"/>
  660. </table:table-cell>
  661. </xsl:template>
  662. <xsl:template match="text()" mode="txt_for_choicetable">
  663. <xsl:call-template name="gen_txt_content"/>
  664. </xsl:template>
  665. <xsl:template match="*[contains(@class, ' task/cmd ')]">
  666. <text:p text:style-name="indent_paragraph_style">
  667. <text:span>
  668. <!-- start add rev flagging styles -->
  669. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  670. <xsl:apply-templates/>
  671. <!-- end add rev flagging styles -->
  672. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  673. </text:span>
  674. </text:p>
  675. </xsl:template>
  676. <xsl:template match="*[contains(@class, ' task/stepresult ')]">
  677. <text:p text:style-name="indent_paragraph_style">
  678. <text:span>
  679. <!-- start add rev flagging styles -->
  680. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  681. <xsl:apply-templates/>
  682. <!-- end add rev flagging styles -->
  683. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  684. </text:span>
  685. </text:p>
  686. </xsl:template>
  687. <xsl:template match="*[contains(@class,' task/info ')]" name="topic.task.info">
  688. <text:p text:style-name="indent_paragraph_style">
  689. <text:span>
  690. <!-- start add rev flagging styles -->
  691. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  692. <xsl:apply-templates/>
  693. <!-- end add rev flagging styles -->
  694. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  695. </text:span>
  696. </text:p>
  697. </xsl:template>
  698. <xsl:template match="*[contains(@class,' task/tutorialinfo ')]" name="topic.task.tutorialinfo">
  699. <text:p text:style-name="indent_paragraph_style">
  700. <text:span>
  701. <!-- start add rev flagging styles -->
  702. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  703. <xsl:apply-templates/>
  704. <!-- end add rev flagging styles -->
  705. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  706. </text:span>
  707. </text:p>
  708. </xsl:template>
  709. <!-- these para-like items need a leading space -->
  710. <xsl:template match="*[contains(@class,' task/stepxmp ')]" name="topic.task.stepxmp">
  711. <text:p text:style-name="indent_paragraph_style">
  712. <text:span>
  713. <!-- start add rev flagging styles -->
  714. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  715. <xsl:apply-templates/>
  716. <!-- end add rev flagging styles -->
  717. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  718. </text:span>
  719. </text:p>
  720. </xsl:template>
  721. <xsl:template match="*[contains(@class,' task/context ')]">
  722. <xsl:apply-templates select="." mode="generate-task-label">
  723. <xsl:with-param name="use-label">
  724. <xsl:call-template name="getVariable">
  725. <xsl:with-param name="id" select="'task_context'"/>
  726. </xsl:call-template>
  727. </xsl:with-param>
  728. </xsl:apply-templates>
  729. <text:p text:style-name="indent_paragraph_style">
  730. <text:span>
  731. <!-- start add flagging styles -->
  732. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  733. <xsl:apply-templates/>
  734. <!-- end add flagging styles -->
  735. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  736. </text:span>
  737. </text:p>
  738. </xsl:template>
  739. <xsl:template match="*[contains(@class,' task/result ')]">
  740. <xsl:apply-templates select="." mode="generate-task-label">
  741. <xsl:with-param name="use-label">
  742. <xsl:call-template name="getVariable">
  743. <xsl:with-param name="id" select="'task_results'"/>
  744. </xsl:call-template>
  745. </xsl:with-param>
  746. </xsl:apply-templates>
  747. <text:p>
  748. <text:span>
  749. <!-- start add flagging styles -->
  750. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  751. <xsl:apply-templates/>
  752. <!-- end add flagging styles -->
  753. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  754. </text:span>
  755. </text:p>
  756. </xsl:template>
  757. <xsl:template match="*[contains(@class,' task/postreq ')]">
  758. <xsl:apply-templates select="." mode="generate-task-label">
  759. <xsl:with-param name="use-label">
  760. <xsl:call-template name="getVariable">
  761. <xsl:with-param name="id" select="'task_postreq'"/>
  762. </xsl:call-template>
  763. </xsl:with-param>
  764. </xsl:apply-templates>
  765. <text:p>
  766. <text:span>
  767. <!-- start add flagging styles -->
  768. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  769. <xsl:apply-templates/>
  770. <!-- end add flagging styles -->
  771. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  772. </text:span>
  773. </text:p>
  774. </xsl:template>
  775. <xsl:template match="*[contains(@class,' task/taskbody ')]/*[contains(@class,' topic/example ')][not(*[contains(@class,' topic/title ')])]">
  776. <xsl:apply-templates select="." mode="generate-task-label">
  777. <xsl:with-param name="use-label">
  778. <xsl:call-template name="getVariable">
  779. <xsl:with-param name="id" select="'task_example'"/>
  780. </xsl:call-template>
  781. </xsl:with-param>
  782. </xsl:apply-templates>
  783. <text:p>
  784. <xsl:apply-templates/>
  785. </text:p>
  786. </xsl:template>
  787. <xsl:template match="*" mode="generate-task-label">
  788. <xsl:param name="use-label"/>
  789. <xsl:if test="$GENERATE-TASK-LABELS='YES'">
  790. <xsl:variable name="headLevel" select="count(ancestor::*[contains(@class,' topic/topic ')])+1"/>
  791. <text:p text:style-name="{concat('Heading_20_', $headLevel)}">
  792. <xsl:value-of select="$use-label"/>
  793. </text:p>
  794. <!--
  795. <div class="tasklabel">
  796. <xsl:element name="{$headLevel}">
  797. <xsl:attribute name="class">sectiontitle tasklabel</xsl:attribute>
  798. <xsl:value-of select="$use-label"/>
  799. </xsl:element>
  800. </div>
  801. -->
  802. </xsl:if>
  803. </xsl:template>
  804. <!-- Related links -->
  805. <!-- Tasks have their own group. -->
  806. <xsl:template match="*[contains(@class, ' topic/link ')][@type='task']" mode="related-links:get-group" name="related-links:group.task">
  807. <xsl:text>task</xsl:text>
  808. </xsl:template>
  809. <!-- Priority of task group. -->
  810. <xsl:template match="*[contains(@class, ' topic/link ')][@type='task']" mode="related-links:get-group-priority" name="related-links:group-priority.task">
  811. <xsl:value-of select="2"/>
  812. </xsl:template>
  813. <xsl:template match="*[contains(@class, ' topic/link ')][@type='task']" mode="related-links:result-group" name="related-links:result.task">
  814. <xsl:param name="links"/>
  815. <xsl:variable name="samefile">
  816. <xsl:call-template name="check_file_location"/>
  817. </xsl:variable>
  818. <xsl:variable name="href-value">
  819. <xsl:call-template name="format_href_value"/>
  820. </xsl:variable>
  821. <text:p>
  822. <text:span text:style-name="bold">
  823. <xsl:call-template name="getVariable">
  824. <xsl:with-param name="id" select="'Related tasks'"/>
  825. </xsl:call-template>
  826. </text:span>
  827. </text:p>
  828. <text:p>
  829. <xsl:call-template name="create_related_links">
  830. <xsl:with-param name="samefile" select="$samefile"/>
  831. <xsl:with-param name="href-value" select="$href-value"/>
  832. </xsl:call-template>
  833. </text:p>
  834. </xsl:template>
  835. </xsl:stylesheet>