sw-d.xsl 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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. <xsl:output method="xml"/>
  30. <!--
  31. <xsl:template match="*[contains(@class,' sw-d/systemoutput ')]">
  32. <xsl:element name="text:span">
  33. <xsl:attribute name="text:style-name">Courier_New</xsl:attribute>
  34. <xsl:apply-templates/>
  35. </xsl:element>
  36. </xsl:template>
  37. -->
  38. <xsl:template match="*[contains(@class,' sw-d/msgph ')]|*[contains(@class,' sw-d/systemoutput ')]">
  39. <xsl:choose>
  40. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  41. <text:p>
  42. <text:span text:style-name="Courier_New">
  43. <text:span>
  44. <!-- start add rev flagging styles -->
  45. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  46. <xsl:apply-templates/>
  47. <!-- end add rev flagging styles -->
  48. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  49. </text:span>
  50. </text:span>
  51. </text:p>
  52. </xsl:when>
  53. <!-- nested by entry -->
  54. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  55. <!-- create p tag -->
  56. <text:p>
  57. <!-- alignment styles -->
  58. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  59. <xsl:call-template name="set_align_value"/>
  60. </xsl:if>
  61. <!-- cell belongs to thead -->
  62. <xsl:choose>
  63. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  64. <text:span text:style-name="bold">
  65. <text:span text:style-name="Courier_New">
  66. <text:span>
  67. <!-- start add rev flagging styles -->
  68. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  69. <xsl:apply-templates/>
  70. <!-- end add rev flagging styles -->
  71. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  72. </text:span>
  73. </text:span>
  74. </text:span>
  75. </xsl:when>
  76. <xsl:otherwise>
  77. <text:span text:style-name="Courier_New">
  78. <text:span>
  79. <!-- start add rev flagging styles -->
  80. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  81. <xsl:apply-templates/>
  82. <!-- end add rev flagging styles -->
  83. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  84. </text:span>
  85. </text:span>
  86. </xsl:otherwise>
  87. </xsl:choose>
  88. </text:p>
  89. </xsl:when>
  90. <!-- nested by stentry -->
  91. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  92. <text:p>
  93. <!-- cell belongs to sthead -->
  94. <xsl:choose>
  95. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  96. <text:span text:style-name="bold">
  97. <text:span text:style-name="Courier_New">
  98. <text:span>
  99. <!-- start add rev flagging styles -->
  100. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  101. <xsl:apply-templates/>
  102. <!-- end add rev flagging styles -->
  103. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  104. </text:span>
  105. </text:span>
  106. </text:span>
  107. </xsl:when>
  108. <xsl:otherwise>
  109. <text:span text:style-name="Courier_New">
  110. <text:span>
  111. <!-- start add rev flagging styles -->
  112. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  113. <xsl:apply-templates/>
  114. <!-- end add rev flagging styles -->
  115. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  116. </text:span>
  117. </text:span>
  118. </xsl:otherwise>
  119. </xsl:choose>
  120. </text:p>
  121. </xsl:when>
  122. <!-- nested by other tags -->
  123. <xsl:otherwise>
  124. <text:span text:style-name="Courier_New">
  125. <text:span>
  126. <!-- start add rev flagging styles -->
  127. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  128. <xsl:apply-templates/>
  129. <!-- end add rev flagging styles -->
  130. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  131. </text:span>
  132. </text:span>
  133. </xsl:otherwise>
  134. </xsl:choose>
  135. </xsl:template>
  136. <xsl:template match="*[contains(@class,' sw-d/varname ')]|*[contains(@class,' sw-d/filepath ')]">
  137. <xsl:choose>
  138. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  139. <text:p>
  140. <text:span text:style-name="Courier_New">
  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:span>
  149. </text:p>
  150. </xsl:when>
  151. <!-- nested by entry -->
  152. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  153. <!-- create p tag -->
  154. <text:p>
  155. <!-- alignment styles -->
  156. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  157. <xsl:call-template name="set_align_value"/>
  158. </xsl:if>
  159. <!-- cell belongs to thead -->
  160. <xsl:choose>
  161. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  162. <text:span text:style-name="bold">
  163. <text:span text:style-name="Courier_New">
  164. <text:span>
  165. <!-- start add rev flagging styles -->
  166. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  167. <xsl:apply-templates/>
  168. <!-- end add rev flagging styles -->
  169. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  170. </text:span>
  171. </text:span>
  172. </text:span>
  173. </xsl:when>
  174. <xsl:otherwise>
  175. <text:span text:style-name="Courier_New">
  176. <text:span>
  177. <!-- start add rev flagging styles -->
  178. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  179. <xsl:apply-templates/>
  180. <!-- end add rev flagging styles -->
  181. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  182. </text:span>
  183. </text:span>
  184. </xsl:otherwise>
  185. </xsl:choose>
  186. </text:p>
  187. </xsl:when>
  188. <!-- nested by stentry -->
  189. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  190. <text:p>
  191. <!-- cell belongs to sthead -->
  192. <xsl:choose>
  193. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  194. <text:span text:style-name="bold">
  195. <text:span text:style-name="Courier_New">
  196. <text:span>
  197. <!-- start add rev flagging styles -->
  198. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  199. <xsl:apply-templates/>
  200. <!-- end add rev flagging styles -->
  201. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  202. </text:span>
  203. </text:span>
  204. </text:span>
  205. </xsl:when>
  206. <xsl:otherwise>
  207. <text:span text:style-name="Courier_New">
  208. <text:span>
  209. <!-- start add rev flagging styles -->
  210. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  211. <xsl:apply-templates/>
  212. <!-- end add rev flagging styles -->
  213. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  214. </text:span>
  215. </text:span>
  216. </xsl:otherwise>
  217. </xsl:choose>
  218. </text:p>
  219. </xsl:when>
  220. <!-- nested by other tags -->
  221. <xsl:otherwise>
  222. <text:span text:style-name="Courier_New">
  223. <text:span>
  224. <!-- start add rev flagging styles -->
  225. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  226. <xsl:apply-templates/>
  227. <!-- end add rev flagging styles -->
  228. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  229. </text:span>
  230. </text:span>
  231. </xsl:otherwise>
  232. </xsl:choose>
  233. </xsl:template>
  234. <xsl:template match="*[contains(@class,' sw-d/msgblock ')]" name="create_msgblock">
  235. <xsl:choose>
  236. <xsl:when test="parent::*[contains(@class, ' topic/body ')]">
  237. <text:p>
  238. <text:span>
  239. <!-- start add flagging styles -->
  240. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  241. <xsl:call-template name="create_msgblock_content"/>
  242. <xsl:apply-templates/>
  243. <!-- end add flagging styles -->
  244. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  245. </text:span>
  246. </text:p>
  247. </xsl:when>
  248. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  249. <text:p>
  250. <text:span>
  251. <!-- start add flagging styles -->
  252. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  253. <xsl:call-template name="create_msgblock_content"/>
  254. <xsl:apply-templates/>
  255. <!-- end add flagging styles -->
  256. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  257. </text:span>
  258. </text:p>
  259. </xsl:when>
  260. <xsl:when test="parent::*[contains(@class, ' topic/linkinfo ')]">
  261. <text:span>
  262. <!-- start add flagging styles -->
  263. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  264. <xsl:call-template name="create_msgblock_content"/>
  265. <xsl:apply-templates/>
  266. <!-- end add flagging styles -->
  267. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  268. </text:span>
  269. <text:line-break/>
  270. </xsl:when>
  271. <!-- nested by entry -->
  272. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  273. <!-- create p tag -->
  274. <text:p>
  275. <!-- alignment styles -->
  276. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  277. <xsl:call-template name="set_align_value"/>
  278. </xsl:if>
  279. <!-- cell belongs to thead -->
  280. <xsl:choose>
  281. <xsl:when test="parent::*[contains(@class, ' topic/entry ')] /parent::*[contains(@class, ' topic/row ')]/parent::*[contains(@class, ' topic/thead ')]">
  282. <text:span text:style-name="bold">
  283. <text:span>
  284. <!-- start add flagging styles -->
  285. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  286. <xsl:call-template name="create_msgblock_content"/>
  287. <xsl:apply-templates/>
  288. <!-- end add flagging styles -->
  289. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  290. </text:span>
  291. </text:span>
  292. </xsl:when>
  293. <xsl:otherwise>
  294. <text:span>
  295. <!-- start add flagging styles -->
  296. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  297. <xsl:call-template name="create_msgblock_content"/>
  298. <xsl:apply-templates/>
  299. <!-- end add flagging styles -->
  300. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  301. </text:span>
  302. </xsl:otherwise>
  303. </xsl:choose>
  304. </text:p>
  305. </xsl:when>
  306. <!-- nested by stentry -->
  307. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  308. <text:p>
  309. <!-- cell belongs to sthead -->
  310. <xsl:choose>
  311. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]/ parent::*[contains(@class, ' topic/sthead ')]">
  312. <text:span text:style-name="bold">
  313. <text:span>
  314. <!-- start add flagging styles -->
  315. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  316. <xsl:call-template name="create_msgblock_content"/>
  317. <xsl:apply-templates/>
  318. <!-- end add flagging styles -->
  319. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  320. </text:span>
  321. </text:span>
  322. </xsl:when>
  323. <xsl:otherwise>
  324. <text:span>
  325. <!-- start add flagging styles -->
  326. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  327. <xsl:call-template name="create_msgblock_content"/>
  328. <xsl:apply-templates/>
  329. <!-- end add flagging styles -->
  330. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  331. </text:span>
  332. </xsl:otherwise>
  333. </xsl:choose>
  334. </text:p>
  335. </xsl:when>
  336. <!-- other tags -->
  337. <xsl:otherwise>
  338. <text:span>
  339. <!-- start add flagging styles -->
  340. <xsl:apply-templates select="." mode="start-add-odt-flags"/>
  341. <xsl:call-template name="create_msgblock_content"/>
  342. <xsl:apply-templates/>
  343. <!-- end add flagging styles -->
  344. <xsl:apply-templates select="." mode="end-add-odt-flags"/>
  345. </text:span>
  346. <text:line-break/>
  347. </xsl:otherwise>
  348. </xsl:choose>
  349. </xsl:template>
  350. <xsl:template name="create_msgblock_content">
  351. <xsl:if test="@spectitle and not(@spectitle='')">
  352. <text:line-break/>
  353. <text:span text:style-name="bold">
  354. <xsl:value-of select="@spectitle"/>
  355. </text:span>
  356. <text:line-break/>
  357. </xsl:if>
  358. </xsl:template>
  359. <xsl:template match="*[contains(@class,' sw-d/userinput ')]">
  360. <text:span text:style-name="Courier_New">
  361. <text:span>
  362. <!-- start add rev flagging styles -->
  363. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  364. <xsl:apply-templates/>
  365. <!-- end add rev flagging styles -->
  366. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  367. </text:span>
  368. </text:span>
  369. </xsl:template>
  370. <xsl:template match="*[contains(@class, ' sw-d/msgnum ')]|*[contains(@class, ' sw-d/cmdname ')]">
  371. <xsl:choose>
  372. <xsl:when test="parent::*[contains(@class, ' topic/li ')] or parent::*[contains(@class, ' topic/sli ')]">
  373. <text:p>
  374. <text:span>
  375. <!-- start add rev flagging styles -->
  376. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  377. <xsl:apply-templates/>
  378. <!-- end add rev flagging styles -->
  379. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  380. </text:span>
  381. </text:p>
  382. </xsl:when>
  383. <!-- nested by entry -->
  384. <xsl:when test="parent::*[contains(@class, ' topic/entry ')]">
  385. <!-- create p tag -->
  386. <text:p>
  387. <!-- alignment styles -->
  388. <xsl:if test="parent::*[contains(@class, ' topic/entry ')]/@align">
  389. <xsl:call-template name="set_align_value"/>
  390. </xsl:if>
  391. <text:span>
  392. <!-- start add rev flagging styles -->
  393. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  394. <xsl:apply-templates/>
  395. <!-- end add rev flagging styles -->
  396. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  397. </text:span>
  398. </text:p>
  399. </xsl:when>
  400. <!-- nested by stentry -->
  401. <xsl:when test="parent::*[contains(@class, ' topic/stentry ')]">
  402. <text:p>
  403. <text:span>
  404. <!-- start add rev flagging styles -->
  405. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  406. <xsl:apply-templates/>
  407. <!-- end add rev flagging styles -->
  408. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  409. </text:span>
  410. </text:p>
  411. </xsl:when>
  412. <xsl:otherwise>
  413. <text:span>
  414. <!-- start add rev flagging styles -->
  415. <xsl:apply-templates select="." mode="start-add-odt-revflags"/>
  416. <xsl:apply-templates/>
  417. <!-- end add rev flagging styles -->
  418. <xsl:apply-templates select="." mode="end-add-odt-revflags"/>
  419. </text:span>
  420. </xsl:otherwise>
  421. </xsl:choose>
  422. </xsl:template>
  423. </xsl:stylesheet>