dita2odt-reference.xsl 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  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. <xsl:stylesheet
  6. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  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:xsd="http://www.w3.org/2001/XMLSchema"
  25. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  26. xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
  27. xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
  28. xmlns:prodtools="http://www.ibm.com/xmlns/prodtools"
  29. version="2.0"
  30. xmlns:related-links="http://dita-ot.sourceforge.net/ns/200709/related-links"
  31. exclude-result-prefixes="xs related-links">
  32. <xsl:output method="xml"/>
  33. <xsl:output indent="yes"/>
  34. <xsl:strip-space elements="*"/>
  35. <!-- == REFERENCE UNIQUE SUBSTRUCTURES == -->
  36. <!-- Simple Table -->
  37. <xsl:template match="*[contains(@class,' reference/properties ')]">
  38. <xsl:variable name="tablenameId" select="generate-id(.)"/>
  39. <!-- start flagging -->
  40. <xsl:apply-templates select="." mode="start-add-odt-flags">
  41. <xsl:with-param name="family" select="'_table'"/>
  42. </xsl:apply-templates>
  43. <xsl:choose>
  44. <xsl:when test="parent::*[contains(@class, ' reference/refbody ')]">
  45. <table:table table:name="{concat('Table', $tablenameId)}" table:style-name="table_style">
  46. <xsl:variable name="colnumNum">
  47. <xsl:call-template name="count_columns_for_properties"/>
  48. </xsl:variable>
  49. <xsl:call-template name="create_columns_for_simpletable">
  50. <xsl:with-param name="column" select="$colnumNum"/>
  51. </xsl:call-template>
  52. <xsl:apply-templates/>
  53. </table:table>
  54. </xsl:when>
  55. <xsl:otherwise>
  56. <xsl:variable name="span_depth">
  57. <xsl:call-template name="calculate_span_depth"/>
  58. </xsl:variable>
  59. <!-- break span tags -->
  60. <xsl:call-template name="break_span_tags">
  61. <xsl:with-param name="depth" select="$span_depth"/>
  62. <xsl:with-param name="order" select="'0'"/>
  63. </xsl:call-template>
  64. <!-- break first p tag if there are span tags -->
  65. <xsl:if test="$span_depth &gt;= 0">
  66. <xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
  67. </xsl:if>
  68. <xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
  69. <!-- start render table -->
  70. <table:table table:name="{concat('Table', $tablenameId)}" table:style-name="table_style">
  71. <xsl:variable name="colnumNum">
  72. <xsl:call-template name="count_columns_for_properties"/>
  73. </xsl:variable>
  74. <xsl:call-template name="create_columns_for_simpletable">
  75. <xsl:with-param name="column" select="$colnumNum"/>
  76. </xsl:call-template>
  77. <xsl:apply-templates/>
  78. </table:table>
  79. <!-- start p tag again if there are span tags-->
  80. <xsl:if test="$span_depth &gt;= 0">
  81. <xsl:text disable-output-escaping="yes">&lt;text:p&gt;</xsl:text>
  82. </xsl:if>
  83. <!-- span tags span tags again-->
  84. <xsl:call-template name="break_span_tags">
  85. <xsl:with-param name="depth" select="$span_depth"/>
  86. <xsl:with-param name="order" select="'1'"/>
  87. </xsl:call-template>
  88. </xsl:otherwise>
  89. </xsl:choose>
  90. <text:p/>
  91. <!-- end flagging -->
  92. <xsl:apply-templates select="." mode="end-add-odt-flags">
  93. <xsl:with-param name="family" select="'_table'"/>
  94. </xsl:apply-templates>
  95. </xsl:template>
  96. <xsl:template match="*[contains(@class, ' reference/proptypehd ')] |*[contains(@class, ' reference/propvaluehd ')] |*[contains(@class, ' reference/propdeschd ')]" mode="create_header">
  97. <table:table-cell office:value-type="string">
  98. <xsl:call-template name="create_style_properties"/>
  99. <xsl:apply-templates/>
  100. </table:table-cell>
  101. </xsl:template>
  102. <!-- Process the header row in a properties table -->
  103. <xsl:template match="*[contains(@class,' reference/prophead ')]" name="topic.reference.prophead">
  104. <xsl:param name="width-multiplier"/>
  105. <table:table-header-rows>
  106. <table:table-row>
  107. <!-- create proptype header -->
  108. <xsl:choose>
  109. <xsl:when test="*[contains(@class,' reference/proptypehd ')]">
  110. <xsl:apply-templates select="*[contains(@class,' reference/proptypehd ')]" mode="create_header"/>
  111. </xsl:when>
  112. <xsl:when test="following-sibling::*/*[contains(@class,' reference/proptype ')]">
  113. <table:table-cell office:value-type="string" table:style-name="cell_style_1">
  114. <!-- propertype is always 1nd column in the 1st row -->
  115. <text:p>
  116. <text:span text:style-name="bold">
  117. <xsl:call-template name="getVariable">
  118. <xsl:with-param name="id" select="'Type'"/>
  119. </xsl:call-template>
  120. </text:span>
  121. </text:p>
  122. </table:table-cell>
  123. </xsl:when>
  124. </xsl:choose>
  125. <!-- create propvalue header -->
  126. <xsl:choose>
  127. <xsl:when test="*[contains(@class,' reference/propvaluehd ')]">
  128. <xsl:apply-templates select="*[contains(@class,' reference/propvaluehd ')]" mode="create_header"/>
  129. </xsl:when>
  130. <xsl:when test="following-sibling::*/*[contains(@class,' reference/propvalue ')]">
  131. <table:table-cell office:value-type="string">
  132. <!-- check column location -->
  133. <xsl:choose>
  134. <!-- 1nd column in the 1st row -->
  135. <xsl:when test="not(following-sibling::*/*[contains(@class,' reference/proptype ')])">
  136. <xsl:attribute name="table:style-name">cell_style_1</xsl:attribute>
  137. </xsl:when>
  138. <xsl:otherwise>
  139. <!-- other columns in the 1st row -->
  140. <xsl:attribute name="table:style-name">cell_style_2</xsl:attribute>
  141. </xsl:otherwise>
  142. </xsl:choose>
  143. <text:p>
  144. <!-- cell belongs to sthead -->
  145. <text:span text:style-name="bold">
  146. <xsl:call-template name="getVariable">
  147. <xsl:with-param name="id" select="'Value'"/>
  148. </xsl:call-template>
  149. </text:span>
  150. </text:p>
  151. </table:table-cell>
  152. </xsl:when>
  153. </xsl:choose>
  154. <!-- create propdesc header -->
  155. <xsl:choose>
  156. <xsl:when test="*[contains(@class,' reference/propdeschd ')]">
  157. <xsl:apply-templates select="*[contains(@class,' reference/propdeschd ')]" mode="create_header"/>
  158. </xsl:when>
  159. <xsl:when test="following-sibling::*/*[contains(@class,' reference/propdesc ')]">
  160. <table:table-cell office:value-type="string">
  161. <!-- check column location -->
  162. <xsl:choose>
  163. <!-- 1nd column in the 1st row -->
  164. <xsl:when test="not(following-sibling::*/*[contains(@class,' reference/proptype ')]) and not(following-sibling::*/*[contains(@class,' reference/propvalue ')])">
  165. <xsl:attribute name="table:style-name">cell_style_1</xsl:attribute>
  166. </xsl:when>
  167. <xsl:otherwise>
  168. <!-- other columns in the 1st row -->
  169. <xsl:attribute name="table:style-name">cell_style_2</xsl:attribute>
  170. </xsl:otherwise>
  171. </xsl:choose>
  172. <text:p>
  173. <!-- cell belongs to sthead -->
  174. <text:span text:style-name="bold">
  175. <xsl:call-template name="getVariable">
  176. <xsl:with-param name="id" select="'Description'"/>
  177. </xsl:call-template>
  178. </text:span>
  179. </text:p>
  180. </table:table-cell>
  181. </xsl:when>
  182. </xsl:choose>
  183. </table:table-row>
  184. </table:table-header-rows>
  185. </xsl:template>
  186. <!-- Process a standard row in the properties table. Apply-templates on the entries one at a time;
  187. if one is missing which should be present, create an empty cell. -->
  188. <xsl:template match="*[contains(@class,' reference/property ')]" name="topic.reference.property">
  189. <xsl:param name="width-multiplier"/>
  190. <!-- If there was no header, then this is the first child of properties; create default headers -->
  191. <xsl:if test=".=../*[1]">
  192. <table:table-header-rows>
  193. <table:table-row>
  194. <xsl:if test="../*/*[contains(@class,' reference/proptype ')]">
  195. <table:table-cell office:value-type="string" table:style-name="cell_style_1">
  196. <!-- propertype is always 1nd column in the 1st row -->
  197. <text:p>
  198. <text:span text:style-name="bold">
  199. <xsl:call-template name="getVariable">
  200. <xsl:with-param name="id" select="'Type'"/>
  201. </xsl:call-template>
  202. </text:span>
  203. </text:p>
  204. </table:table-cell>
  205. </xsl:if>
  206. <xsl:if test="../*/*[contains(@class,' reference/propvalue ')]">
  207. <table:table-cell office:value-type="string">
  208. <!-- check column location -->
  209. <xsl:choose>
  210. <!-- 1nd column in the 1st row -->
  211. <xsl:when test="not(../*/*[contains(@class,' reference/proptype ')])">
  212. <xsl:attribute name="table:style-name">cell_style_1</xsl:attribute>
  213. </xsl:when>
  214. <xsl:otherwise>
  215. <!-- other columns in the 1st row -->
  216. <xsl:attribute name="table:style-name">cell_style_2</xsl:attribute>
  217. </xsl:otherwise>
  218. </xsl:choose>
  219. <text:p>
  220. <!-- cell belongs to sthead -->
  221. <text:span text:style-name="bold">
  222. <xsl:call-template name="getVariable">
  223. <xsl:with-param name="id" select="'Value'"/>
  224. </xsl:call-template>
  225. </text:span>
  226. </text:p>
  227. </table:table-cell>
  228. </xsl:if>
  229. <xsl:if test="../*/*[contains(@class,' reference/propdesc ')]">
  230. <table:table-cell office:value-type="string">
  231. <!-- check column location -->
  232. <xsl:choose>
  233. <!-- 1nd column in the 1st row -->
  234. <xsl:when test="not(../*/*[contains(@class,' reference/proptype ')]) and not(../*/*[contains(@class,' reference/propvalue ')])">
  235. <xsl:attribute name="table:style-name">cell_style_1</xsl:attribute>
  236. </xsl:when>
  237. <xsl:otherwise>
  238. <!-- other columns in the 1st row -->
  239. <xsl:attribute name="table:style-name">cell_style_2</xsl:attribute>
  240. </xsl:otherwise>
  241. </xsl:choose>
  242. <text:p>
  243. <!-- cell belongs to sthead -->
  244. <text:span text:style-name="bold">
  245. <xsl:call-template name="getVariable">
  246. <xsl:with-param name="id" select="'Description'"/>
  247. </xsl:call-template>
  248. </text:span>
  249. </text:p>
  250. </table:table-cell>
  251. </xsl:if>
  252. </table:table-row>
  253. </table:table-header-rows>
  254. </xsl:if>
  255. <!-- For each of the 3 entry types:
  256. - If it is in this row, apply
  257. - Otherwise, if it is in the table at all, create empty entry -->
  258. <table:table-row>
  259. <xsl:choose> <!-- Process or create proptype -->
  260. <xsl:when test="*[contains(@class,' reference/proptype ')]">
  261. <xsl:apply-templates select="*[contains(@class,' reference/proptype ')]">
  262. <xsl:with-param name="width-multiplier" select="$width-multiplier"/>
  263. </xsl:apply-templates>
  264. </xsl:when>
  265. <!-- create an empty proptype -->
  266. <xsl:when test="../*/*[contains(@class,' reference/proptype ')] | ../*[1]/*[contains(@class,' reference/proptypehd ')]">
  267. <table:table-cell office:value-type="string" table:style-name="cell_style_3">
  268. <!-- this cell is in the first column. -->
  269. <text:p>
  270. <!-- Create an empty cell. Add accessiblity attribute. -->
  271. <!--
  272. <xsl:call-template name="addPropertiesHeadersAttribute">
  273. <xsl:with-param name="classVal"> reference/proptypehd </xsl:with-param>
  274. <xsl:with-param name="elementType">type</xsl:with-param>
  275. </xsl:call-template>
  276. -->
  277. <!--
  278. <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
  279. -->
  280. <xsl:text> </xsl:text>
  281. </text:p>
  282. </table:table-cell>
  283. </xsl:when>
  284. </xsl:choose>
  285. <xsl:choose> <!-- Process or create propvalue -->
  286. <xsl:when test="*[contains(@class,' reference/propvalue ')]">
  287. <xsl:apply-templates select="*[contains(@class,' reference/propvalue ')]">
  288. <xsl:with-param name="width-multiplier" select="$width-multiplier"/>
  289. </xsl:apply-templates>
  290. </xsl:when>
  291. <!-- create an empty propvalue -->
  292. <xsl:when test="../*/*[contains(@class,' reference/propvalue ')] | ../*[1]/*[contains(@class,' reference/propvaluehd ')]">
  293. <table:table-cell office:value-type="string">
  294. <xsl:choose>
  295. <!-- this cell is in the first column. -->
  296. <xsl:when test="not(../*/*[contains(@class,' reference/proptype ')]) and not(../*[1]/*[contains(@class,' reference/proptypehd ')])">
  297. <xsl:attribute name="table:style-name">cell_style_3</xsl:attribute>
  298. </xsl:when>
  299. <xsl:otherwise>
  300. <xsl:attribute name="table:style-name">cell_style_4</xsl:attribute>
  301. </xsl:otherwise>
  302. </xsl:choose>
  303. <text:p>
  304. <xsl:call-template name="addPropertiesHeadersAttribute">
  305. <xsl:with-param name="classVal"> reference/propvaluehd </xsl:with-param>
  306. <xsl:with-param name="elementType">value</xsl:with-param>
  307. </xsl:call-template>
  308. <xsl:text> </xsl:text>
  309. </text:p>
  310. </table:table-cell>
  311. </xsl:when>
  312. </xsl:choose>
  313. <xsl:choose> <!-- Process or create propdesc -->
  314. <xsl:when test="*[contains(@class,' reference/propdesc ')]">
  315. <xsl:apply-templates select="*[contains(@class,' reference/propdesc ')]">
  316. <xsl:with-param name="width-multiplier" select="$width-multiplier"/>
  317. </xsl:apply-templates>
  318. </xsl:when>
  319. <!-- create an empty propdesc -->
  320. <xsl:when test="../*/*[contains(@class,' reference/propdesc ')] | ../*[1]/*[contains(@class,' reference/propdeschd ')]">
  321. <table:table-cell office:value-type="string">
  322. <xsl:choose>
  323. <!-- this cell is in the first column. -->
  324. <xsl:when test="not(../*/*[contains(@class,' reference/proptype ')]) and not(../*[1]/*[contains(@class,' reference/proptypehd ')]) and not(../*/*[contains(@class,' reference/propvalue ')]) and not(../*[1]/*[contains(@class,' reference/propvaluehd ')])">
  325. <xsl:attribute name="table:style-name">cell_style_3</xsl:attribute>
  326. </xsl:when>
  327. <xsl:otherwise>
  328. <xsl:attribute name="table:style-name">cell_style_4</xsl:attribute>
  329. </xsl:otherwise>
  330. </xsl:choose>
  331. <text:p>
  332. <xsl:call-template name="addPropertiesHeadersAttribute">
  333. <xsl:with-param name="classVal"> reference/propdeschd </xsl:with-param>
  334. <xsl:with-param name="elementType">desc</xsl:with-param>
  335. </xsl:call-template>
  336. <xsl:text> </xsl:text>
  337. </text:p>
  338. </table:table-cell>
  339. </xsl:when>
  340. </xsl:choose>
  341. </table:table-row>
  342. </xsl:template>
  343. <xsl:template match="*[contains(@class,' reference/proptype ')]" name="topic.reference.proptype">
  344. <xsl:param name="width-multiplier">0</xsl:param>
  345. <xsl:apply-templates select="." mode="propertiesEntry">
  346. <xsl:with-param name="width-multiplier" select="$width-multiplier"/>
  347. <xsl:with-param name="elementType">type</xsl:with-param>
  348. </xsl:apply-templates>
  349. </xsl:template>
  350. <xsl:template match="*[contains(@class,' reference/propvalue ')]" name="topic.reference.propvalue">
  351. <xsl:param name="width-multiplier">0</xsl:param>
  352. <xsl:apply-templates select="." mode="propertiesEntry">
  353. <xsl:with-param name="width-multiplier" select="$width-multiplier"/>
  354. <xsl:with-param name="elementType">value</xsl:with-param>
  355. </xsl:apply-templates>
  356. </xsl:template>
  357. <xsl:template match="*[contains(@class,' reference/propdesc ')]" name="topic.reference.propdesc">
  358. <xsl:param name="width-multiplier">0</xsl:param>
  359. <xsl:apply-templates select="." mode="propertiesEntry">
  360. <xsl:with-param name="width-multiplier" select="$width-multiplier"/>
  361. <xsl:with-param name="elementType">desc</xsl:with-param>
  362. </xsl:apply-templates>
  363. </xsl:template>
  364. <!-- Add the headers attribute to a cell inside the properties table. This may be called from either
  365. a <property> row or from a cell inside the row. -->
  366. <xsl:template name="addPropertiesHeadersAttribute">
  367. <xsl:param name="classVal"/>
  368. <xsl:param name="elementType"/>
  369. <xsl:attribute name="id">
  370. <xsl:choose>
  371. <!-- First choice: if there is a matching cell inside a user-specified header, and it has an ID -->
  372. <xsl:when test="ancestor::*[contains(@class,' reference/properties ')]/*[1][contains(@class,' reference/prophead ')]/*[contains(@class,$classVal)]/@id">
  373. <xsl:value-of select="ancestor::*[contains(@class,' reference/properties ')]/*[1][contains(@class,' reference/prophead ')]/*[contains(@class,$classVal)]/@id"/>
  374. </xsl:when>
  375. <!-- Second choice: if there is a matching cell inside a user-specified header, use its generated ID -->
  376. <xsl:when test="ancestor::*[contains(@class,' reference/properties ')]/*[1][contains(@class,' reference/prophead ')]/*[contains(@class,$classVal)]">
  377. <xsl:value-of select="generate-id(ancestor::*[contains(@class,' reference/properties ')]/*[1][contains(@class,' reference/prophead ')]/*[contains(@class,$classVal)])"/>
  378. </xsl:when>
  379. <!-- Third choice: no user-specified header for this column. ID is based on the table's generated ID. -->
  380. <xsl:otherwise>
  381. <xsl:value-of select="generate-id(ancestor::*[contains(@class,' reference/properties ')])"/>-<xsl:value-of select="$elementType"/>
  382. </xsl:otherwise>
  383. </xsl:choose>
  384. </xsl:attribute>
  385. </xsl:template>
  386. <!-- Template based on the stentry template in dit2htm. Only change is to add elementType
  387. paramenter, and call addPropertiesHeadersAttribute instead of output-stentry-headers. -->
  388. <xsl:template match="*" mode="propertiesEntry">
  389. <xsl:param name="width-multiplier">0</xsl:param>
  390. <xsl:param name="elementType"/>
  391. <table:table-cell office:value-type="string">
  392. <xsl:call-template name="create_style_properties"/>
  393. <xsl:call-template name="output-stentry-id"/>
  394. <!--
  395. <xsl:call-template name="addPropertiesHeadersAttribute">
  396. <xsl:with-param name="classVal"> reference/prop<xsl:value-of select="$elementType"/>hd<xsl:text> </xsl:text></xsl:with-param>
  397. <xsl:with-param name="elementType" select="$elementType"/>
  398. </xsl:call-template>
  399. -->
  400. <xsl:variable name="localkeycol">
  401. <xsl:choose>
  402. <xsl:when test="ancestor::*[contains(@class,' topic/simpletable ')]/@keycol">
  403. <xsl:value-of select="ancestor::*[contains(@class,' topic/simpletable ')]/@keycol"/>
  404. </xsl:when>
  405. <xsl:otherwise>0</xsl:otherwise>
  406. </xsl:choose>
  407. </xsl:variable>
  408. <!-- Determine which column this entry is in. -->
  409. <xsl:variable name="thiscolnum" select="number(count(preceding-sibling::*)+1)"/>
  410. <!-- Determine which column this entry is in. -->
  411. <xsl:choose>
  412. <xsl:when test="$thiscolnum=$localkeycol">
  413. <text:span text:style-name="bold">
  414. <xsl:call-template name="propentry-templates"/>
  415. </text:span>
  416. </xsl:when>
  417. <xsl:otherwise>
  418. <xsl:call-template name="propentry-templates"/>
  419. </xsl:otherwise>
  420. </xsl:choose>
  421. </table:table-cell>
  422. </xsl:template>
  423. <xsl:template name="propentry-templates">
  424. <xsl:choose>
  425. <xsl:when test="*|text()|processing-instruction()">
  426. <xsl:apply-templates/>
  427. </xsl:when>
  428. <xsl:when test="@specentry">
  429. <xsl:value-of select="@specentry"/>
  430. </xsl:when>
  431. <xsl:otherwise>
  432. <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text> <!-- nbsp -->
  433. </xsl:otherwise>
  434. </xsl:choose>
  435. </xsl:template>
  436. <xsl:template name="create_style_properties">
  437. <!-- create style attribute -->
  438. <xsl:variable name="colpos" as="xs:integer?">
  439. <xsl:choose>
  440. <xsl:when test="contains(@class, ' reference/proptype ') or contains(@class, ' reference/proptypehd ')">
  441. <xsl:sequence select="1"/>
  442. </xsl:when>
  443. <xsl:when test="contains(@class, ' reference/propvalue ') or contains(@class, ' reference/propvaluehd ')">
  444. <xsl:choose>
  445. <xsl:when test="../../*/*[contains(@class,' reference/proptype ')] | ../../*[1]/*[contains(@class,' reference/proptypehd ')]">
  446. <xsl:sequence select="2"/>
  447. </xsl:when>
  448. <xsl:otherwise>
  449. <xsl:sequence select="1"/>
  450. </xsl:otherwise>
  451. </xsl:choose>
  452. </xsl:when>
  453. <xsl:when test="contains(@class, ' reference/propdesc ') or contains(@class, ' reference/propdeschd')">
  454. <xsl:choose>
  455. <xsl:when test="../../*/*[contains(@class,' reference/propvalue ')] | ../../*[1]/*[contains(@class,' reference/propvaluehd ')] |
  456. ../../*/*[contains(@class,' reference/proptype ')] | ../../*[1]/*[contains(@class,' reference/proptypehd ')]">
  457. <xsl:sequence select="2"/>
  458. </xsl:when>
  459. <xsl:otherwise>
  460. <xsl:sequence select="1"/>
  461. </xsl:otherwise>
  462. </xsl:choose>
  463. </xsl:when>
  464. </xsl:choose>
  465. </xsl:variable>
  466. <xsl:variable name="rowpos" as="xs:integer">
  467. <xsl:choose>
  468. <!-- row belongs to thead -->
  469. <xsl:when test="parent::*[contains(@class, ' topic/sthead ')]">
  470. <xsl:sequence select="1"/>
  471. </xsl:when>
  472. <!-- there's no thead -->
  473. <!-- thead will be created in properties. -->
  474. <xsl:otherwise>
  475. <xsl:sequence select="2"/>
  476. </xsl:otherwise>
  477. </xsl:choose>
  478. </xsl:variable>
  479. <xsl:choose>
  480. <!-- first column and first row -->
  481. <xsl:when test="$rowpos = 1 and $colpos = 1">
  482. <xsl:attribute name="table:style-name">cell_style_1</xsl:attribute>
  483. </xsl:when>
  484. <!-- not first column but first row -->
  485. <xsl:when test="$rowpos = 1 and $colpos != 1">
  486. <xsl:attribute name="table:style-name">cell_style_2</xsl:attribute>
  487. </xsl:when>
  488. <!-- first column but not first row -->
  489. <xsl:when test="$rowpos != 1 and $colpos = 1">
  490. <xsl:attribute name="table:style-name">cell_style_3</xsl:attribute>
  491. </xsl:when>
  492. <!-- other cells -->
  493. <xsl:otherwise>
  494. <xsl:attribute name="table:style-name">cell_style_4</xsl:attribute>
  495. </xsl:otherwise>
  496. </xsl:choose>
  497. </xsl:template>
  498. <xsl:template name="count_columns_for_properties">
  499. <xsl:choose>
  500. <!-- has desc -->
  501. <xsl:when test="*[contains(@class, ' reference/prophead ')]/*[contains(@class, ' reference/propdeschd ')] |
  502. *[contains(@class, ' reference/property ')]/*[contains(@class, ' reference/propdesc ')]">
  503. <xsl:value-of select="3"/>
  504. </xsl:when>
  505. <!-- only has value -->
  506. <xsl:when test="*[contains(@class, ' reference/prophead ')]/*[contains(@class, ' reference/propvaluehd ')] |
  507. *[contains(@class, ' reference/property ')]/*[contains(@class, ' reference/propvalue ')]">
  508. <xsl:value-of select="2"/>
  509. </xsl:when>
  510. <xsl:otherwise>
  511. <xsl:value-of select="1"/>
  512. </xsl:otherwise>
  513. </xsl:choose>
  514. </xsl:template>
  515. <!--Get Related Information Reference-->
  516. <!-- References have their own group. -->
  517. <xsl:template match="*[contains(@class, ' topic/link ')][@type='reference']" mode="related-links:get-group" name="related-links:group.reference">
  518. <xsl:text>reference</xsl:text>
  519. </xsl:template>
  520. <!-- Priority of reference group. -->
  521. <xsl:template match="*[contains(@class, ' topic/link ')][@type='reference']" mode="related-links:get-group-priority" name="related-links:group-priority.reference">
  522. <xsl:value-of select="1"/>
  523. </xsl:template>
  524. <!-- Reference wrapper for HTML: "Related reference" in <div>. -->
  525. <xsl:template match="*[contains(@class, ' topic/link ')][@type='reference']" mode="related-links:result-group" name="related-links:result.reference">
  526. <xsl:param name="links"/>
  527. <xsl:variable name="samefile">
  528. <xsl:call-template name="check_file_location"/>
  529. </xsl:variable>
  530. <xsl:variable name="href-value">
  531. <xsl:call-template name="format_href_value"/>
  532. </xsl:variable>
  533. <text:p>
  534. <text:span text:style-name="bold">
  535. <xsl:call-template name="getVariable">
  536. <xsl:with-param name="id" select="'Related references'"/>
  537. </xsl:call-template>
  538. </text:span>
  539. </text:p>
  540. <text:p>
  541. <xsl:call-template name="create_related_links">
  542. <xsl:with-param name="samefile" select="$samefile"/>
  543. <xsl:with-param name="href-value" select="$href-value"/>
  544. </xsl:call-template>
  545. </text:p>
  546. </xsl:template>
  547. <!--
  548. <xsl:template match="*[contains(@class, ' topic/link ')][@type='reference']">
  549. <xsl:param name="links"/>
  550. <xsl:variable name="samefile">
  551. <xsl:call-template name="check_file_location"/>
  552. </xsl:variable>
  553. <xsl:variable name="href-value">
  554. <xsl:call-template name="format_href_value"/>
  555. </xsl:variable>
  556. <xsl:element name="text:span">
  557. <xsl:attribute name="text:style-name">bold</xsl:attribute>
  558. <xsl:call-template name="getVariable">
  559. <xsl:with-param name="stringName" select="'Related references'"/>
  560. </xsl:call-template>
  561. </xsl:element>
  562. <xsl:element name="text:line-break"/>
  563. <xsl:call-template name="create_related_links">
  564. <xsl:with-param name="samefile" select="$samefile"/>
  565. <xsl:with-param name="href-value" select="$href-value"/>
  566. </xsl:call-template>
  567. </xsl:template>
  568. -->
  569. </xsl:stylesheet>