hi-d.xsl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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. xmlns:styleUtils="org.dita.dost.util.StyleUtils" exclude-result-prefixes="styleUtils"
  29. version="2.0">
  30. <xsl:output method="xml"/>
  31. <xsl:output indent="yes"/>
  32. <xsl:strip-space elements="*"/>
  33. <xsl:template match="*[contains(@class,' hi-d/b ')]">
  34. <xsl:choose>
  35. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  36. <text:p>
  37. <xsl:apply-templates/>
  38. </text:p>
  39. </xsl:when>
  40. <!-- nested by entry -->
  41. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  42. <!-- alignment styles -->
  43. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  44. <xsl:call-template name="set_align_value"/>
  45. </xsl:if>
  46. <xsl:apply-templates/>
  47. </xsl:when>
  48. <!-- nested by stentry -->
  49. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  50. <text:p>
  51. <xsl:apply-templates/>
  52. </text:p>
  53. </xsl:when>
  54. <!-- nested by other tags -->
  55. <xsl:otherwise>
  56. <!--
  57. <xsl:element name="text:span">
  58. <xsl:attribute name="text:style-name">bold</xsl:attribute>
  59. -->
  60. <xsl:apply-templates/>
  61. <!--
  62. </xsl:element>
  63. -->
  64. </xsl:otherwise>
  65. </xsl:choose>
  66. </xsl:template>
  67. <xsl:template match="*[contains(@class,' hi-d/i ')]">
  68. <xsl:choose>
  69. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  70. <text:p>
  71. <xsl:apply-templates/>
  72. </text:p>
  73. </xsl:when>
  74. <!-- nested by entry -->
  75. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  76. <!-- create p tag -->
  77. <text:p>
  78. <!-- alignment styles -->
  79. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  80. <xsl:call-template name="set_align_value"/>
  81. </xsl:if>
  82. <!-- cell belongs to thead -->
  83. <xsl:choose>
  84. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]
  85. /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  86. <text:span text:style-name="bold">
  87. <xsl:apply-templates/>
  88. </text:span>
  89. </xsl:when>
  90. <xsl:otherwise>
  91. <xsl:apply-templates/>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </text:p>
  95. </xsl:when>
  96. <!-- nested by stentry -->
  97. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  98. <text:p>
  99. <!-- cell belongs to sthead -->
  100. <xsl:choose>
  101. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/
  102. parent::*[contains(@class, ' topic/sthead ')]">
  103. <text:span text:style-name="bold">
  104. <xsl:apply-templates/>
  105. </text:span>
  106. </xsl:when>
  107. <xsl:otherwise>
  108. <xsl:apply-templates/>
  109. </xsl:otherwise>
  110. </xsl:choose>
  111. </text:p>
  112. </xsl:when>
  113. <!-- nested by other tags -->
  114. <xsl:otherwise>
  115. <!--
  116. <xsl:element name="text:span">
  117. <xsl:attribute name="text:style-name">italic</xsl:attribute>
  118. <xsl:apply-templates/>
  119. </xsl:element>
  120. -->
  121. <xsl:apply-templates/>
  122. </xsl:otherwise>
  123. </xsl:choose>
  124. </xsl:template>
  125. <xsl:template match="*[contains(@class,' hi-d/u ')]">
  126. <xsl:choose>
  127. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  128. <text:p>
  129. <xsl:apply-templates/>
  130. </text:p>
  131. </xsl:when>
  132. <!-- nested by entry -->
  133. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  134. <!-- create p tag -->
  135. <text:p>
  136. <!-- alignment styles -->
  137. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  138. <xsl:call-template name="set_align_value"/>
  139. </xsl:if>
  140. <!-- cell belongs to thead -->
  141. <xsl:choose>
  142. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]
  143. /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  144. <text:span text:style-name="bold">
  145. <xsl:apply-templates/>
  146. </text:span>
  147. </xsl:when>
  148. <xsl:otherwise>
  149. <xsl:apply-templates/>
  150. </xsl:otherwise>
  151. </xsl:choose>
  152. </text:p>
  153. </xsl:when>
  154. <!-- nested by stentry -->
  155. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  156. <text:p>
  157. <!-- cell belongs to sthead -->
  158. <xsl:choose>
  159. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/
  160. parent::*[contains(@class, ' topic/sthead ')]">
  161. <text:span text:style-name="bold">
  162. <xsl:apply-templates/>
  163. </text:span>
  164. </xsl:when>
  165. <xsl:otherwise>
  166. <xsl:apply-templates/>
  167. </xsl:otherwise>
  168. </xsl:choose>
  169. </text:p>
  170. </xsl:when>
  171. <!-- nested by other tags -->
  172. <xsl:otherwise>
  173. <!--
  174. <xsl:element name="text:span">
  175. <xsl:attribute name="text:style-name">underline</xsl:attribute>
  176. <xsl:apply-templates/>
  177. </xsl:element>
  178. -->
  179. <xsl:apply-templates/>
  180. </xsl:otherwise>
  181. </xsl:choose>
  182. </xsl:template>
  183. <xsl:template match="*[contains(@class,' hi-d/tt ')]">
  184. <xsl:choose>
  185. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  186. <text:p>
  187. <text:span text:style-name="Courier">
  188. <xsl:apply-templates/>
  189. </text:span>
  190. </text:p>
  191. </xsl:when>
  192. <!-- nested by entry -->
  193. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  194. <!-- create p tag -->
  195. <text:p>
  196. <!-- alignment styles -->
  197. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  198. <xsl:call-template name="set_align_value"/>
  199. </xsl:if>
  200. <text:span text:style-name="Courier">
  201. <xsl:apply-templates/>
  202. </text:span>
  203. </text:p>
  204. </xsl:when>
  205. <!-- nested by stentry -->
  206. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  207. <text:p>
  208. <text:span text:style-name="Courier">
  209. <xsl:apply-templates/>
  210. </text:span>
  211. </text:p>
  212. </xsl:when>
  213. <!-- nested by other tags -->
  214. <xsl:otherwise>
  215. <text:span text:style-name="Courier">
  216. <xsl:apply-templates/>
  217. </text:span>
  218. </xsl:otherwise>
  219. </xsl:choose>
  220. </xsl:template>
  221. <xsl:template match="*[contains(@class,' hi-d/sup ')]">
  222. <xsl:choose>
  223. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  224. <text:p>
  225. <xsl:apply-templates/>
  226. </text:p>
  227. </xsl:when>
  228. <!-- nested by entry -->
  229. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  230. <!-- create p tag -->
  231. <text:p>
  232. <!-- alignment styles -->
  233. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  234. <xsl:call-template name="set_align_value"/>
  235. </xsl:if>
  236. <!-- cell belongs to thead -->
  237. <xsl:choose>
  238. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  239. <text:span text:style-name="bold">
  240. <xsl:apply-templates/>
  241. </text:span>
  242. </xsl:when>
  243. <xsl:otherwise>
  244. <xsl:apply-templates/>
  245. </xsl:otherwise>
  246. </xsl:choose>
  247. </text:p>
  248. </xsl:when>
  249. <!-- nested by stentry -->
  250. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  251. <text:p>
  252. <!-- cell belongs to sthead -->
  253. <xsl:choose>
  254. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  255. <text:span text:style-name="bold">
  256. <xsl:apply-templates/>
  257. </text:span>
  258. </xsl:when>
  259. <xsl:otherwise>
  260. <xsl:apply-templates/>
  261. </xsl:otherwise>
  262. </xsl:choose>
  263. </text:p>
  264. </xsl:when>
  265. <!-- nested by other tags -->
  266. <xsl:otherwise>
  267. <!--
  268. <xsl:element name="text:span">
  269. <xsl:attribute name="text:style-name">sup</xsl:attribute>
  270. <xsl:apply-templates/>
  271. </xsl:element>
  272. -->
  273. <xsl:apply-templates/>
  274. </xsl:otherwise>
  275. </xsl:choose>
  276. </xsl:template>
  277. <xsl:template match="*[contains(@class,' hi-d/sub ')]">
  278. <xsl:choose>
  279. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  280. <text:p>
  281. <xsl:apply-templates/>
  282. </text:p>
  283. </xsl:when>
  284. <!-- nested by entry -->
  285. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  286. <!-- create p tag -->
  287. <text:p>
  288. <!-- alignment styles -->
  289. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  290. <xsl:call-template name="set_align_value"/>
  291. </xsl:if>
  292. <!-- cell belongs to thead -->
  293. <xsl:choose>
  294. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  295. <text:span text:style-name="bold">
  296. <xsl:apply-templates/>
  297. </text:span>
  298. </xsl:when>
  299. <xsl:otherwise>
  300. <xsl:apply-templates/>
  301. </xsl:otherwise>
  302. </xsl:choose>
  303. </text:p>
  304. </xsl:when>
  305. <!-- nested by stentry -->
  306. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  307. <text:p>
  308. <!-- cell belongs to sthead -->
  309. <xsl:choose>
  310. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  311. <text:span text:style-name="bold">
  312. <xsl:apply-templates/>
  313. </text:span>
  314. </xsl:when>
  315. <xsl:otherwise>
  316. <xsl:apply-templates/>
  317. </xsl:otherwise>
  318. </xsl:choose>
  319. </text:p>
  320. </xsl:when>
  321. <!-- nested by other tags -->
  322. <xsl:otherwise>
  323. <!--
  324. <xsl:element name="text:span">
  325. <xsl:attribute name="text:style-name">sub</xsl:attribute>
  326. <xsl:apply-templates/>
  327. </xsl:element>
  328. -->
  329. <xsl:apply-templates/>
  330. </xsl:otherwise>
  331. </xsl:choose>
  332. </xsl:template>
  333. <xsl:template match="text()|*[contains(@class, ' topic/state ')]" mode="create_hi_style">
  334. <!-- generating style name based on the styles used on the text. -->
  335. <xsl:variable name="style_name">
  336. <xsl:call-template name="get_style_name"/>
  337. </xsl:variable>
  338. <xsl:variable name="hasStyleName" select="styleUtils:insertHiStyleName($style_name)"/>
  339. <xsl:if test="$style_name != '' and $hasStyleName = 'false'">
  340. <!-- common hi style -->
  341. <style:style style:name="{$style_name}" style:family="text">
  342. <style:text-properties>
  343. <!-- bold-->
  344. <xsl:if test="contains($style_name, 'bold')">
  345. <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
  346. <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
  347. <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
  348. </xsl:if>
  349. <!-- italic -->
  350. <xsl:if test="contains($style_name, 'italic')">
  351. <xsl:attribute name="fo:font-style">italic</xsl:attribute>
  352. <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
  353. <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
  354. </xsl:if>
  355. <!-- underline -->
  356. <xsl:if test="contains($style_name, 'underline')">
  357. <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
  358. <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
  359. <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
  360. <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute>
  361. </xsl:if>
  362. <!-- sub -->
  363. <xsl:if test="contains($style_name, 'sub')">
  364. <xsl:choose>
  365. <xsl:when test="contains($style_name ,'sub1')">
  366. <xsl:attribute name="style:text-position">-10% 58%</xsl:attribute>
  367. </xsl:when>
  368. <xsl:when test="contains($style_name ,'sub2')">
  369. <xsl:attribute name="style:text-position">-20% 58%</xsl:attribute>
  370. </xsl:when>
  371. <xsl:when test="contains($style_name ,'sub3')">
  372. <xsl:attribute name="style:text-position">-30% 58%</xsl:attribute>
  373. </xsl:when>
  374. <xsl:when test="contains($style_name ,'sub4')">
  375. <xsl:attribute name="style:text-position">-40% 58%</xsl:attribute>
  376. </xsl:when>
  377. <xsl:when test="contains($style_name ,'sub5')">
  378. <xsl:attribute name="style:text-position">-50% 58%</xsl:attribute>
  379. </xsl:when>
  380. <xsl:otherwise>
  381. <xsl:attribute name="style:text-position">-60% 58%</xsl:attribute>
  382. </xsl:otherwise>
  383. </xsl:choose>
  384. </xsl:if>
  385. <!-- sup -->
  386. <xsl:if test="contains($style_name, 'sup')">
  387. <xsl:choose>
  388. <xsl:when test="contains($style_name ,'sup1')">
  389. <xsl:attribute name="style:text-position">40% 58%</xsl:attribute>
  390. </xsl:when>
  391. <xsl:when test="contains($style_name ,'sup2')">
  392. <xsl:attribute name="style:text-position">50% 58%</xsl:attribute>
  393. </xsl:when>
  394. <xsl:when test="contains($style_name ,'sup3')">
  395. <xsl:attribute name="style:text-position">60% 58%</xsl:attribute>
  396. </xsl:when>
  397. <xsl:when test="contains($style_name ,'sup4')">
  398. <xsl:attribute name="style:text-position">70% 58%</xsl:attribute>
  399. </xsl:when>
  400. <xsl:when test="contains($style_name ,'sup5')">
  401. <xsl:attribute name="style:text-position">80% 58%</xsl:attribute>
  402. </xsl:when>
  403. <xsl:otherwise>
  404. <xsl:attribute name="style:text-position">90% 58%</xsl:attribute>
  405. </xsl:otherwise>
  406. </xsl:choose>
  407. </xsl:if>
  408. <!-- line-through -->
  409. <xsl:if test="contains($style_name, 'line-through')">
  410. <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
  411. <xsl:attribute name="style:text-line-through-type">single</xsl:attribute>
  412. <xsl:attribute name="style:text-line-through-width">auto</xsl:attribute>
  413. <xsl:attribute name="style:text-line-through-color">font-color</xsl:attribute>
  414. </xsl:if>
  415. <!-- overline -->
  416. <xsl:if test="contains($style_name, 'overline')">
  417. <xsl:attribute name="style:text-overline-style">solid</xsl:attribute>
  418. <xsl:attribute name="style:text-overline-type">single</xsl:attribute>
  419. <xsl:attribute name="style:text-overline-width">auto</xsl:attribute>
  420. <xsl:attribute name="style:text-overline-color">font-color</xsl:attribute>
  421. </xsl:if>
  422. <!-- codeblock/screen -->
  423. <xsl:if test="contains($style_name, 'code')">
  424. <xsl:attribute name="fo:background-color">#d9d9d9</xsl:attribute>
  425. </xsl:if>
  426. </style:text-properties>
  427. </style:style>
  428. <!-- boolean hi style -->
  429. <style:style style:name="{concat('boolean_', $style_name)}" style:family="text" style:parent-style-name="boolean_style">
  430. <style:text-properties>
  431. <!-- bold-->
  432. <xsl:if test="contains($style_name, 'bold')">
  433. <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
  434. <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
  435. <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
  436. </xsl:if>
  437. <!-- italic -->
  438. <xsl:if test="contains($style_name, 'italic')">
  439. <xsl:attribute name="fo:font-style">italic</xsl:attribute>
  440. <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
  441. <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
  442. </xsl:if>
  443. <!-- underline -->
  444. <xsl:if test="contains($style_name, 'underline')">
  445. <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
  446. <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
  447. <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
  448. <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute>
  449. </xsl:if>
  450. <!-- sub -->
  451. <xsl:if test="contains($style_name, 'sub')">
  452. <xsl:choose>
  453. <xsl:when test="contains($style_name ,'sub1')">
  454. <xsl:attribute name="style:text-position">-10% 58%</xsl:attribute>
  455. </xsl:when>
  456. <xsl:when test="contains($style_name ,'sub2')">
  457. <xsl:attribute name="style:text-position">-20% 58%</xsl:attribute>
  458. </xsl:when>
  459. <xsl:when test="contains($style_name ,'sub3')">
  460. <xsl:attribute name="style:text-position">-30% 58%</xsl:attribute>
  461. </xsl:when>
  462. <xsl:when test="contains($style_name ,'sub4')">
  463. <xsl:attribute name="style:text-position">-40% 58%</xsl:attribute>
  464. </xsl:when>
  465. <xsl:when test="contains($style_name ,'sub5')">
  466. <xsl:attribute name="style:text-position">-50% 58%</xsl:attribute>
  467. </xsl:when>
  468. <xsl:otherwise>
  469. <xsl:attribute name="style:text-position">-60% 58%</xsl:attribute>
  470. </xsl:otherwise>
  471. </xsl:choose>
  472. </xsl:if>
  473. <!-- sup -->
  474. <xsl:if test="contains($style_name, 'sup')">
  475. <xsl:choose>
  476. <xsl:when test="contains($style_name ,'sup1')">
  477. <xsl:attribute name="style:text-position">40% 58%</xsl:attribute>
  478. </xsl:when>
  479. <xsl:when test="contains($style_name ,'sup2')">
  480. <xsl:attribute name="style:text-position">50% 58%</xsl:attribute>
  481. </xsl:when>
  482. <xsl:when test="contains($style_name ,'sup3')">
  483. <xsl:attribute name="style:text-position">60% 58%</xsl:attribute>
  484. </xsl:when>
  485. <xsl:when test="contains($style_name ,'sup4')">
  486. <xsl:attribute name="style:text-position">70% 58%</xsl:attribute>
  487. </xsl:when>
  488. <xsl:when test="contains($style_name ,'sup5')">
  489. <xsl:attribute name="style:text-position">80% 58%</xsl:attribute>
  490. </xsl:when>
  491. <xsl:otherwise>
  492. <xsl:attribute name="style:text-position">90% 58%</xsl:attribute>
  493. </xsl:otherwise>
  494. </xsl:choose>
  495. </xsl:if>
  496. <!-- codeblock/screen -->
  497. <xsl:if test="contains($style_name, 'code')">
  498. <xsl:attribute name="fo:background-color">#d9d9d9</xsl:attribute>
  499. </xsl:if>
  500. </style:text-properties>
  501. </style:style>
  502. </xsl:if>
  503. </xsl:template>
  504. <xsl:template name="get_style_name">
  505. <xsl:if test="ancestor::*[contains(@class, ' hi-d/i ')] | ancestor::*[contains(@class, ' topic/term ')] | ancestor::*[contains(@class, ' topic/cite ')]">
  506. <xsl:value-of select="'italic'"/>
  507. </xsl:if>
  508. <xsl:if test="ancestor::*[contains(@class, ' hi-d/u ')]">
  509. <xsl:value-of select="'underline'"/>
  510. </xsl:if>
  511. <xsl:if test="ancestor::*[contains(@class, ' hi-d/b ')]">
  512. <xsl:value-of select="'bold'"/>
  513. </xsl:if>
  514. <xsl:if test="ancestor::*[contains(@class, ' hi-d/sub ')]">
  515. <xsl:value-of select="'sub'"/>
  516. <xsl:variable name="depth" select="count(ancestor::*[contains(@class, ' hi-d/sub ')])"/>
  517. <xsl:choose>
  518. <xsl:when test="$depth &gt; 5">
  519. <xsl:value-of select="6"/>
  520. </xsl:when>
  521. <xsl:otherwise>
  522. <xsl:value-of select="$depth"/>
  523. </xsl:otherwise>
  524. </xsl:choose>
  525. </xsl:if>
  526. <xsl:if test="ancestor::*[contains(@class, ' hi-d/sup ')]">
  527. <xsl:value-of select="'sup'"/>
  528. <xsl:variable name="depth" select="count(ancestor::*[contains(@class, ' hi-d/sup ')])"/>
  529. <xsl:choose>
  530. <xsl:when test="$depth &gt; 5">
  531. <xsl:value-of select="6"/>
  532. </xsl:when>
  533. <xsl:otherwise>
  534. <xsl:value-of select="$depth"/>
  535. </xsl:otherwise>
  536. </xsl:choose>
  537. </xsl:if>
  538. <xsl:if test="ancestor::*[contains(@class, ' ui-d/screen ')] | ancestor::*[contains(@class, ' pr-d/codeblock ')]">
  539. <xsl:value-of select="'code'"/>
  540. </xsl:if>
  541. <xsl:if test="ancestor::*[contains(@class, ' hi-d/line-through ')]">
  542. <xsl:text>line-through</xsl:text>
  543. </xsl:if>
  544. <xsl:if test="ancestor::*[contains(@class, ' hi-d/overline ')]">
  545. <xsl:text>overline</xsl:text>
  546. </xsl:if>
  547. </xsl:template>
  548. </xsl:stylesheet>