ui-d.xsl 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. 2005 All Rights Reserved. -->
  5. <xsl:stylesheet
  6. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  8. xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
  9. xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  10. xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  11. xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
  12. xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
  13. xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/"
  14. xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
  15. xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
  16. xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
  17. xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
  18. xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
  19. xmlns:math="http://www.w3.org/1998/Math/MathML"
  20. xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
  21. xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  22. xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"
  23. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  24. 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. version="2.0">
  29. <!-- Screen -->
  30. <xsl:template match="*[contains(@class,' ui-d/screen ')]">
  31. <xsl:choose>
  32. <!-- nested by body, li -->
  33. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')] or parent::*[contains(@class, ' topic/body ')]">
  34. <!-- start add flagging images -->
  35. <xsl:apply-templates select="." mode="start-add-odt-imgrevflags"/>
  36. <text:p text:style-name="Code_Style_Paragraph">
  37. <text:span>
  38. <!-- add flagging styles -->
  39. <xsl:apply-templates select="." mode="add-odt-flagging"/>
  40. <xsl:apply-templates/>
  41. </text:span>
  42. </text:p>
  43. <!-- end add flagging images -->
  44. <xsl:apply-templates select="." mode="end-add-odt-imgrevflags"/>
  45. </xsl:when>
  46. <!-- nested by entry -->
  47. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  48. <!-- start add flagging images -->
  49. <xsl:apply-templates select="." mode="start-add-odt-imgrevflags"/>
  50. <!-- create p tag -->
  51. <text:p>
  52. <!-- alignment styles -->
  53. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  54. <xsl:call-template name="set_align_value"/>
  55. </xsl:if>
  56. <!-- cell belongs to thead -->
  57. <xsl:choose>
  58. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  59. <text:span text:style-name="bold">
  60. <text:span text:style-name="Code_Text">
  61. <text:span>
  62. <!-- add flagging styles -->
  63. <xsl:apply-templates select="." mode="add-odt-flagging"/>
  64. <xsl:apply-templates/>
  65. </text:span>
  66. </text:span>
  67. </text:span>
  68. </xsl:when>
  69. <xsl:otherwise>
  70. <text:span>
  71. <!-- add flagging styles -->
  72. <xsl:apply-templates select="." mode="add-odt-flagging"/>
  73. <xsl:apply-templates/>
  74. </text:span>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. </text:p>
  78. <!-- end add flagging images -->
  79. <xsl:apply-templates select="." mode="end-add-odt-imgrevflags"/>
  80. </xsl:when>
  81. <!-- nested by stentry -->
  82. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  83. <!-- start add flagging images -->
  84. <xsl:apply-templates select="." mode="start-add-odt-imgrevflags"/>
  85. <text:p>
  86. <!-- cell belongs to sthead -->
  87. <xsl:choose>
  88. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  89. <text:span text:style-name="Code_Text">
  90. <text:span>
  91. <!-- add flagging styles -->
  92. <xsl:apply-templates select="." mode="add-odt-flagging"/>
  93. <xsl:apply-templates/>
  94. </text:span>
  95. </text:span>
  96. </xsl:when>
  97. <xsl:otherwise>
  98. <text:span>
  99. <!-- add flagging styles -->
  100. <xsl:apply-templates select="." mode="add-odt-flagging"/>
  101. <xsl:apply-templates/>
  102. </text:span>
  103. </xsl:otherwise>
  104. </xsl:choose>
  105. </text:p>
  106. <!-- end add flagging images -->
  107. <xsl:apply-templates select="." mode="end-add-odt-imgrevflags"/>
  108. </xsl:when>
  109. <xsl:when test="parent::*[contains(@class, ' topic/linkinfo ')]">
  110. <text:span>
  111. <text:span>
  112. <!-- start add flagging styles -->
  113. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  114. <xsl:apply-templates/>
  115. <!-- end add flagging styles -->
  116. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  117. </text:span>
  118. </text:span>
  119. <text:line-break/>
  120. </xsl:when>
  121. <!-- other tags -->
  122. <xsl:otherwise>
  123. <text:span text:style-name="Code_Text">
  124. <text:span>
  125. <!-- start add flagging styles -->
  126. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  127. <xsl:apply-templates/>
  128. <!-- end add flagging styles -->
  129. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  130. </text:span>
  131. </text:span>
  132. <text:line-break/>
  133. </xsl:otherwise>
  134. </xsl:choose>
  135. </xsl:template>
  136. <!-- ui-domain.ent domain: uicontrol | wintitle | menucascade | shortcut -->
  137. <xsl:template match="*[contains(@class,' ui-d/menucascade ')]">
  138. <xsl:choose>
  139. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  140. <text:p>
  141. <text:span>
  142. <!-- start add rev flagging styles -->
  143. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  144. <xsl:apply-templates/>
  145. <!-- end add rev flagging styles -->
  146. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  147. </text:span>
  148. </text:p>
  149. </xsl:when>
  150. <!-- nested by entry -->
  151. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  152. <!-- create p tag -->
  153. <text:p>
  154. <!-- alignment styles -->
  155. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  156. <xsl:call-template name="set_align_value"/>
  157. </xsl:if>
  158. <!-- cell belongs to thead -->
  159. <xsl:choose>
  160. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  161. <text:span text:style-name="bold">
  162. <text:span>
  163. <!-- start add rev flagging styles -->
  164. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  165. <xsl:apply-templates/>
  166. <!-- end add rev flagging styles -->
  167. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  168. </text:span>
  169. </text:span>
  170. </xsl:when>
  171. <xsl:otherwise>
  172. <text:span>
  173. <!-- start add rev flagging styles -->
  174. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  175. <xsl:apply-templates/>
  176. <!-- end add rev flagging styles -->
  177. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  178. </text:span>
  179. </xsl:otherwise>
  180. </xsl:choose>
  181. </text:p>
  182. </xsl:when>
  183. <!-- nested by stentry -->
  184. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  185. <text:p>
  186. <!-- cell belongs to sthead -->
  187. <xsl:choose>
  188. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  189. <text:span text:style-name="bold">
  190. <text:span>
  191. <!-- start add rev flagging styles -->
  192. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  193. <xsl:apply-templates/>
  194. <!-- end add rev flagging styles -->
  195. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  196. </text:span>
  197. </text:span>
  198. </xsl:when>
  199. <xsl:otherwise>
  200. <text:span>
  201. <!-- start add rev flagging styles -->
  202. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  203. <xsl:apply-templates/>
  204. <!-- end add rev flagging styles -->
  205. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  206. </text:span>
  207. </xsl:otherwise>
  208. </xsl:choose>
  209. </text:p>
  210. </xsl:when>
  211. <!-- nested by other tags -->
  212. <xsl:otherwise>
  213. <text:span>
  214. <!-- start add rev flagging styles -->
  215. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  216. <xsl:apply-templates/>
  217. <!-- end add rev flagging styles -->
  218. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  219. </text:span>
  220. </xsl:otherwise>
  221. </xsl:choose>
  222. </xsl:template>
  223. <xsl:template match="*[contains(@class,' ui-d/uicontrol ')]" priority="2">
  224. <xsl:choose>
  225. <!-- nested by li -->
  226. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  227. <text:p>
  228. <!-- insert an arrow with leading/trailing spaces before all but the first uicontrol in a menucascade -->
  229. <xsl:if test="ancestor::*[contains(@class,' ui-d/menucascade ')]">
  230. <xsl:variable name="uicontrolcount">
  231. <xsl:number count="*[contains(@class,' ui-d/uicontrol ')]"/>
  232. </xsl:variable>
  233. <xsl:if test="$uicontrolcount &gt; '1'">
  234. <xsl:text> &gt; </xsl:text>
  235. </xsl:if>
  236. </xsl:if>
  237. <text:span text:style-name="bold">
  238. <text:span>
  239. <!-- start add rev flagging styles -->
  240. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  241. <xsl:apply-templates/>
  242. <!-- end add rev flagging styles -->
  243. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  244. </text:span>
  245. </text:span>
  246. </text:p>
  247. </xsl:when>
  248. <!-- nested by entry -->
  249. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  250. <!-- create p tag -->
  251. <text:p>
  252. <!-- alignment styles -->
  253. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  254. <xsl:call-template name="set_align_value"/>
  255. </xsl:if>
  256. <!-- cell belongs to thead -->
  257. <xsl:choose>
  258. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  259. <text:span text:style-name="bold">
  260. <!-- insert an arrow with leading/trailing spaces before all but the first uicontrol in a menucascade -->
  261. <xsl:if test="ancestor::*[contains(@class,' ui-d/menucascade ')]">
  262. <xsl:variable name="uicontrolcount">
  263. <xsl:number count="*[contains(@class,' ui-d/uicontrol ')]"/>
  264. </xsl:variable>
  265. <xsl:if test="$uicontrolcount &gt; '1'">
  266. <xsl:text> &gt; </xsl:text>
  267. </xsl:if>
  268. </xsl:if>
  269. <text:span text:style-name="bold">
  270. <text:span>
  271. <!-- start add rev flagging styles -->
  272. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  273. <xsl:apply-templates/>
  274. <!-- end add rev flagging styles -->
  275. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  276. </text:span>
  277. </text:span>
  278. </text:span>
  279. </xsl:when>
  280. <xsl:otherwise>
  281. <!-- insert an arrow with leading/trailing spaces before all but the first uicontrol in a menucascade -->
  282. <xsl:if test="ancestor::*[contains(@class,' ui-d/menucascade ')]">
  283. <xsl:variable name="uicontrolcount">
  284. <xsl:number count="*[contains(@class,' ui-d/uicontrol ')]"/>
  285. </xsl:variable>
  286. <xsl:if test="$uicontrolcount &gt; '1'">
  287. <xsl:text> &gt; </xsl:text>
  288. </xsl:if>
  289. </xsl:if>
  290. <text:span text:style-name="bold">
  291. <text:span>
  292. <!-- start add rev flagging styles -->
  293. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  294. <xsl:apply-templates/>
  295. <!-- end add rev flagging styles -->
  296. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  297. </text:span>
  298. </text:span>
  299. </xsl:otherwise>
  300. </xsl:choose>
  301. </text:p>
  302. </xsl:when>
  303. <!-- nested by stentry -->
  304. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  305. <text:p>
  306. <!-- cell belongs to sthead -->
  307. <xsl:choose>
  308. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  309. <text:span text:style-name="bold">
  310. <!-- insert an arrow with leading/trailing spaces before all but the first uicontrol in a menucascade -->
  311. <xsl:if test="ancestor::*[contains(@class,' ui-d/menucascade ')]">
  312. <xsl:variable name="uicontrolcount">
  313. <xsl:number count="*[contains(@class,' ui-d/uicontrol ')]"/>
  314. </xsl:variable>
  315. <xsl:if test="$uicontrolcount &gt; '1'">
  316. <xsl:text> &gt; </xsl:text>
  317. </xsl:if>
  318. </xsl:if>
  319. <text:span text:style-name="bold">
  320. <text:span>
  321. <!-- start add rev flagging styles -->
  322. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  323. <xsl:apply-templates/>
  324. <!-- end add rev flagging styles -->
  325. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  326. </text:span>
  327. </text:span>
  328. </text:span>
  329. </xsl:when>
  330. <xsl:otherwise>
  331. <!-- insert an arrow with leading/trailing spaces before all but the first uicontrol in a menucascade -->
  332. <xsl:if test="ancestor::*[contains(@class,' ui-d/menucascade ')]">
  333. <xsl:variable name="uicontrolcount">
  334. <xsl:number count="*[contains(@class,' ui-d/uicontrol ')]"/>
  335. </xsl:variable>
  336. <xsl:if test="$uicontrolcount &gt; '1'">
  337. <xsl:text> &gt; </xsl:text>
  338. </xsl:if>
  339. </xsl:if>
  340. <text:span text:style-name="bold">
  341. <text:span>
  342. <!-- start add rev flagging styles -->
  343. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  344. <xsl:apply-templates/>
  345. <!-- end add rev flagging styles -->
  346. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  347. </text:span>
  348. </text:span>
  349. </xsl:otherwise>
  350. </xsl:choose>
  351. </text:p>
  352. </xsl:when>
  353. <!-- nested by other tags -->
  354. <xsl:otherwise>
  355. <!-- insert an arrow with leading/trailing spaces before all but the first uicontrol in a menucascade -->
  356. <xsl:if test="ancestor::*[contains(@class,' ui-d/menucascade ')]">
  357. <xsl:variable name="uicontrolcount">
  358. <xsl:number count="*[contains(@class,' ui-d/uicontrol ')]"/>
  359. </xsl:variable>
  360. <xsl:if test="$uicontrolcount &gt; '1'">
  361. <xsl:text> &gt; </xsl:text>
  362. </xsl:if>
  363. </xsl:if>
  364. <text:span text:style-name="bold">
  365. <text:span>
  366. <!-- start add rev flagging styles -->
  367. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  368. <xsl:apply-templates/>
  369. <!-- end add rev flagging styles -->
  370. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  371. </text:span>
  372. </text:span>
  373. </xsl:otherwise>
  374. </xsl:choose>
  375. </xsl:template>
  376. <xsl:template match="*[contains(@class,' ui-d/shortcut ')]" name="topic.ui-d.shortcut">
  377. <text:span text:style-name="underline">
  378. <text:span>
  379. <!-- start add rev flagging styles -->
  380. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  381. <xsl:apply-templates/>
  382. <!-- end add rev flagging styles -->
  383. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  384. </text:span>
  385. </text:span>
  386. </xsl:template>
  387. </xsl:stylesheet>