lufa_docbook_transform.xslt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="xml" indent="no"/>
  4. <xsl:template name="generate.book.title">
  5. <xsl:text>LUFA Library</xsl:text>
  6. </xsl:template>
  7. <xsl:template name="generate.book.id">
  8. <xsl:param name="book.title"/>
  9. <xsl:choose>
  10. <xsl:when test="@id">
  11. <xsl:value-of select="@id"/>
  12. </xsl:when>
  13. <xsl:otherwise>
  14. <xsl:value-of select="translate($book.title, ' ','')"/>
  15. </xsl:otherwise>
  16. </xsl:choose>
  17. </xsl:template>
  18. <xsl:template name="generate.index.id">
  19. <xsl:param name="name"/>
  20. <xsl:variable name="book.title">
  21. <xsl:call-template name="generate.book.title"/>
  22. </xsl:variable>
  23. <xsl:variable name="book.id">
  24. <xsl:call-template name="generate.book.id">
  25. <xsl:with-param name="book.title" select="$book.title"/>
  26. </xsl:call-template>
  27. </xsl:variable>
  28. <indexterm id="{$name}">
  29. <primary>
  30. <xsl:value-of select="$book.title"/>
  31. </primary>
  32. <secondary>
  33. <xsl:value-of select="$name"/>
  34. </secondary>
  35. </indexterm>
  36. </xsl:template>
  37. <xsl:template match="doxygen">
  38. <xsl:variable name="book.title">
  39. <xsl:call-template name="generate.book.title"/>
  40. </xsl:variable>
  41. <xsl:variable name="book.id">
  42. <xsl:call-template name="generate.book.id">
  43. <xsl:with-param name="book.title" select="$book.title"/>
  44. </xsl:call-template>
  45. </xsl:variable>
  46. <book id="{$book.id}">
  47. <title>
  48. <xsl:value-of select="$book.title"/>
  49. </title>
  50. <!-- Add index chapter -->
  51. <xsl:apply-templates select="compounddef[@kind = 'page' and @id = 'indexpage']">
  52. <xsl:with-param name="element.type" select="'chapter'"/>
  53. <xsl:with-param name="page.title" select="'Library Information'"/>
  54. </xsl:apply-templates>
  55. <!-- Add free-floating chapters -->
  56. <xsl:apply-templates select="compounddef[@kind = 'page' and not(@id = 'indexpage') and not(//innerpage/@refid = @id)]">
  57. <xsl:with-param name="element.type" select="'chapter'"/>
  58. </xsl:apply-templates>
  59. <!-- Add Modules chapter -->
  60. <chapter>
  61. <title>Modules</title>
  62. <xsl:apply-templates select="compounddef[@kind = 'group' and not(//innergroup/@refid = @id)]"/>
  63. </chapter>
  64. </book>
  65. </xsl:template>
  66. <xsl:template match="compounddef[@kind = 'page']">
  67. <xsl:param name="element.type" select="'section'"/>
  68. <xsl:param name="page.title" select="title"/>
  69. <xsl:element name="{$element.type}">
  70. <xsl:attribute name="id">
  71. <xsl:value-of select="@id"/>
  72. </xsl:attribute>
  73. <xsl:variable name="name">
  74. <xsl:text>LUFA.</xsl:text>
  75. <xsl:value-of select="translate(compoundname, '_', '.')"/>
  76. </xsl:variable>
  77. <xsl:call-template name="generate.index.id">
  78. <xsl:with-param name="name" select="$name"/>
  79. </xsl:call-template>
  80. <title>
  81. <xsl:value-of select="$page.title"/>
  82. </title>
  83. <xsl:apply-templates select="detaileddescription"/>
  84. <xsl:if test="not(innerpage) and count(detaileddescription//sect1)">
  85. <para>
  86. <emphasis role="bold">Subsections:</emphasis>
  87. <itemizedlist>
  88. <xsl:for-each select="detaileddescription//sect1">
  89. <listitem>
  90. <link linkend="{@id}">
  91. <xsl:value-of select="title"/>
  92. </link>
  93. </listitem>
  94. </xsl:for-each>
  95. </itemizedlist>
  96. </para>
  97. </xsl:if>
  98. <xsl:for-each select="innerpage">
  99. <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
  100. </xsl:for-each>
  101. </xsl:element>
  102. </xsl:template>
  103. <xsl:template match="compounddef[@kind = 'group']">
  104. <section id="{@id}">
  105. <title>
  106. <xsl:value-of select="title"/>
  107. </title>
  108. <xsl:variable name="name">
  109. <xsl:text>LUFA.</xsl:text>
  110. <xsl:value-of select="translate(compoundname, '_', '.')"/>
  111. </xsl:variable>
  112. <xsl:call-template name="generate.index.id">
  113. <xsl:with-param name="name" select="$name"/>
  114. </xsl:call-template>
  115. <xsl:apply-templates select="detaileddescription"/>
  116. <xsl:if test="count(innergroup)">
  117. <para>
  118. <emphasis role="bold">Subgroups:</emphasis>
  119. <itemizedlist>
  120. <xsl:for-each select="innergroup">
  121. <listitem>
  122. <link linkend="{@refid}">
  123. <xsl:value-of select="text()"/>
  124. </link>
  125. </listitem>
  126. </xsl:for-each>
  127. </itemizedlist>
  128. </para>
  129. </xsl:if>
  130. <xsl:apply-templates select="sectiondef"/>
  131. <xsl:for-each select="innerclass">
  132. <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
  133. </xsl:for-each>
  134. <xsl:for-each select="innergroup">
  135. <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'group' and @id = current()/@refid]"/>
  136. </xsl:for-each>
  137. </section>
  138. </xsl:template>
  139. <xsl:template match="compounddef[@kind = 'struct' or @kind = 'union']">
  140. <xsl:variable name="name" select="compoundname"/>
  141. <section id="{@id}" xreflabel="{$name}">
  142. <title>
  143. <xsl:choose>
  144. <xsl:when test="@kind = 'struct'">
  145. <xsl:text>Struct </xsl:text>
  146. </xsl:when>
  147. <xsl:when test="@kind = 'union'">
  148. <xsl:text>Union </xsl:text>
  149. </xsl:when>
  150. </xsl:choose>
  151. <xsl:value-of select="$name"/>
  152. </title>
  153. <xsl:call-template name="generate.index.id">
  154. <xsl:with-param name="name" select="$name"/>
  155. </xsl:call-template>
  156. <xsl:apply-templates select="detaileddescription"/>
  157. <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
  158. <table>
  159. <title>
  160. <xsl:value-of select="$name"/>
  161. </title>
  162. <tgroup cols="3">
  163. <thead>
  164. <row>
  165. <entry>Type</entry>
  166. <entry>Name</entry>
  167. <entry>Description</entry>
  168. </row>
  169. </thead>
  170. <tbody>
  171. <xsl:for-each select="memberdef">
  172. <row id="{@id}" xreflabel="{name}">
  173. <entry>
  174. <xsl:value-of select="type"/>
  175. </entry>
  176. <entry>
  177. <xsl:value-of select="name"/>
  178. <xsl:if test="starts-with(argsstring, '[')">
  179. <xsl:text>[]</xsl:text>
  180. </xsl:if>
  181. <xsl:variable name="struct.element.name">
  182. <xsl:value-of select="$name"/>
  183. <xsl:text>.</xsl:text>
  184. <xsl:value-of select="name"/>
  185. </xsl:variable>
  186. <xsl:call-template name="generate.index.id">
  187. <xsl:with-param name="name" select="$struct.element.name"/>
  188. </xsl:call-template>
  189. </entry>
  190. <entry>
  191. <xsl:apply-templates select="detaileddescription"/>
  192. </entry>
  193. </row>
  194. </xsl:for-each>
  195. </tbody>
  196. </tgroup>
  197. </table>
  198. </xsl:for-each>
  199. </section>
  200. </xsl:template>
  201. <xsl:template match="memberdef[@kind = 'function']">
  202. <section id="{@id}" xreflabel="{name}">
  203. <title>
  204. <xsl:text>Function </xsl:text>
  205. <xsl:value-of select="name"/>
  206. <xsl:text>()</xsl:text>
  207. </title>
  208. <xsl:call-template name="generate.index.id">
  209. <xsl:with-param name="name" select="name"/>
  210. </xsl:call-template>
  211. <para>
  212. <emphasis role="italic">
  213. <xsl:value-of select="briefdescription"/>
  214. </emphasis>
  215. </para>
  216. <programlisting language="c">
  217. <emphasis role="keyword">
  218. <xsl:value-of select="type"/>
  219. </emphasis>
  220. <xsl:text> </xsl:text>
  221. <xsl:value-of select="name"/>
  222. <xsl:text>(</xsl:text>
  223. <xsl:choose>
  224. <xsl:when test="not(param[1]/declname)">
  225. <emphasis role="keyword">void</emphasis>
  226. </xsl:when>
  227. <xsl:otherwise>
  228. <xsl:for-each select="param">
  229. <xsl:if test="position() > 1">
  230. <xsl:text>,</xsl:text>
  231. </xsl:if>
  232. <xsl:text>&#10;&#9;</xsl:text>
  233. <emphasis role="keyword">
  234. <xsl:value-of select="type"/>
  235. </emphasis>
  236. <xsl:text> </xsl:text>
  237. <xsl:value-of select="declname"/>
  238. </xsl:for-each>
  239. </xsl:otherwise>
  240. </xsl:choose>
  241. <xsl:text>)</xsl:text>
  242. </programlisting>
  243. <xsl:apply-templates select="detaileddescription"/>
  244. </section>
  245. </xsl:template>
  246. <xsl:template match="memberdef[@kind = 'enum']">
  247. <section id="{@id}" xreflabel="{name}">
  248. <title>
  249. <xsl:text>Enum </xsl:text>
  250. <xsl:value-of select="name"/>
  251. </title>
  252. <xsl:call-template name="generate.index.id">
  253. <xsl:with-param name="name" select="name"/>
  254. </xsl:call-template>
  255. <xsl:apply-templates select="detaileddescription"/>
  256. <table>
  257. <title>Members</title>
  258. <tgroup cols="2">
  259. <thead>
  260. <row>
  261. <entry>Enum Value</entry>
  262. <entry>Description</entry>
  263. </row>
  264. </thead>
  265. <tbody>
  266. <xsl:for-each select="enumvalue">
  267. <row>
  268. <entry>
  269. <para id="{@id}" xreflabel="{name}">
  270. <xsl:value-of select="name"/>
  271. <xsl:call-template name="generate.index.id">
  272. <xsl:with-param name="name" select="name"/>
  273. </xsl:call-template>
  274. </para>
  275. </entry>
  276. <entry>
  277. <xsl:apply-templates select="detaileddescription"/>
  278. </entry>
  279. </row>
  280. </xsl:for-each>
  281. </tbody>
  282. </tgroup>
  283. </table>
  284. </section>
  285. </xsl:template>
  286. <xsl:template match="memberdef[@kind = 'define']">
  287. <section id="{@id}" xreflabel="{name}">
  288. <title>
  289. <xsl:text>Macro </xsl:text>
  290. <xsl:value-of select="name"/>
  291. </title>
  292. <xsl:call-template name="generate.index.id">
  293. <xsl:with-param name="name" select="name"/>
  294. </xsl:call-template>
  295. <programlisting language="c">
  296. <emphasis role="preprocessor">
  297. <xsl:text>#define </xsl:text>
  298. <xsl:value-of select="name"/>
  299. <xsl:if test="count(param) > 0">
  300. <xsl:text>(</xsl:text>
  301. <xsl:for-each select="param/defname">
  302. <xsl:if test="position() > 1">
  303. <xsl:text>,</xsl:text>
  304. </xsl:if>
  305. <xsl:value-of select="."/>
  306. </xsl:for-each>
  307. <xsl:text>)</xsl:text>
  308. </xsl:if>
  309. <xsl:text> </xsl:text>
  310. <!-- Split long macro definitions across multiple lines -->
  311. <xsl:if test="(string-length(initializer) > 50) or (count(param) > 0)">
  312. <xsl:text>\&#10;&#9;</xsl:text>
  313. </xsl:if>
  314. <xsl:value-of select="initializer"/>
  315. </emphasis>
  316. <xsl:text> </xsl:text>
  317. </programlisting>
  318. <xsl:apply-templates select="detaileddescription"/>
  319. </section>
  320. </xsl:template>
  321. <xsl:template match="memberdef[@kind = 'typedef']">
  322. <section id="{@id}" xreflabel="{name}">
  323. <title>
  324. <xsl:text>Type </xsl:text>
  325. <xsl:value-of select="name"/>
  326. </title>
  327. <xsl:call-template name="generate.index.id">
  328. <xsl:with-param name="name" select="name"/>
  329. </xsl:call-template>
  330. <programlisting language="c">
  331. <emphasis role="keyword">
  332. <xsl:text>typedef </xsl:text>
  333. <xsl:value-of select="type"/>
  334. </emphasis>
  335. <xsl:text> </xsl:text>
  336. <xsl:value-of select="name"/>
  337. <xsl:text> </xsl:text>
  338. <xsl:value-of select="argsstring"/>
  339. </programlisting>
  340. <xsl:apply-templates select="detaileddescription"/>
  341. </section>
  342. </xsl:template>
  343. <xsl:template match="memberdef[@kind = 'variable']">
  344. <section id="{@id}" xreflabel="{name}">
  345. <title>
  346. <xsl:text>Variable </xsl:text>
  347. <xsl:value-of select="name"/>
  348. </title>
  349. <xsl:call-template name="generate.index.id">
  350. <xsl:with-param name="name" select="name"/>
  351. </xsl:call-template>
  352. <programlisting language="c">
  353. <emphasis role="keyword">
  354. <xsl:value-of select="type"/>
  355. </emphasis>
  356. <xsl:text> </xsl:text>
  357. <xsl:value-of select="name"/>
  358. </programlisting>
  359. <xsl:apply-templates select="detaileddescription"/>
  360. </section>
  361. </xsl:template>
  362. <xsl:template match="linebreak | simplesectsep">
  363. <!-- MUST be on two separate lines, as this is a *literal* newline -->
  364. <literallayout>
  365. </literallayout>
  366. </xsl:template>
  367. <xsl:template match="verbatim">
  368. <programlisting>
  369. <xsl:apply-templates/>
  370. </programlisting>
  371. </xsl:template>
  372. <xsl:template match="sectiondef">
  373. <para>
  374. <xsl:value-of select="description"/>
  375. </para>
  376. <xsl:apply-templates select="memberdef"/>
  377. </xsl:template>
  378. <xsl:template match="simplesect" mode="struct">
  379. <footnote>
  380. <xsl:apply-templates/>
  381. </footnote>
  382. </xsl:template>
  383. <xsl:template match="simplesect">
  384. <xsl:choose>
  385. <xsl:when test="@kind = 'par'">
  386. <note>
  387. <title>
  388. <xsl:value-of select="title"/>
  389. </title>
  390. <xsl:apply-templates/>
  391. </note>
  392. </xsl:when>
  393. <xsl:when test="@kind = 'return'">
  394. <note>
  395. <title>Returns</title>
  396. <xsl:apply-templates/>
  397. </note>
  398. </xsl:when>
  399. <xsl:when test="@kind = 'warning'">
  400. <warning>
  401. <title>Warning</title>
  402. <xsl:apply-templates/>
  403. </warning>
  404. </xsl:when>
  405. <xsl:when test="@kind = 'pre'">
  406. <note>
  407. <title>Precondition</title>
  408. <xsl:apply-templates/>
  409. </note>
  410. </xsl:when>
  411. <xsl:when test="@kind = 'see'">
  412. <note>
  413. <title>See also</title>
  414. <xsl:apply-templates/>
  415. </note>
  416. </xsl:when>
  417. <xsl:when test="@kind = 'note'">
  418. <note>
  419. <title>Note</title>
  420. <xsl:apply-templates/>
  421. </note>
  422. </xsl:when>
  423. </xsl:choose>
  424. </xsl:template>
  425. <xsl:template match="parameterlist[@kind = 'param']">
  426. <table>
  427. <title>Parameters</title>
  428. <tgroup cols="3">
  429. <thead>
  430. <row>
  431. <entry>Data Direction</entry>
  432. <entry>Parameter Name</entry>
  433. <entry>Description</entry>
  434. </row>
  435. </thead>
  436. <tbody>
  437. <xsl:for-each select="parameteritem">
  438. <row>
  439. <xsl:apply-templates select="."/>
  440. </row>
  441. </xsl:for-each>
  442. </tbody>
  443. </tgroup>
  444. </table>
  445. </xsl:template>
  446. <xsl:template match="parameterlist[@kind = 'retval']">
  447. <table>
  448. <title>Return Values</title>
  449. <tgroup cols="2">
  450. <thead>
  451. <row>
  452. <entry>Return Value</entry>
  453. <entry>Description</entry>
  454. </row>
  455. </thead>
  456. <tbody>
  457. <xsl:for-each select="parameteritem">
  458. <row>
  459. <xsl:apply-templates select="."/>
  460. </row>
  461. </xsl:for-each>
  462. </tbody>
  463. </tgroup>
  464. </table>
  465. </xsl:template>
  466. <xsl:template match="parameteritem">
  467. <xsl:if test="parent::parameterlist/@kind = 'param'">
  468. <entry>
  469. <para>
  470. <xsl:choose>
  471. <xsl:when test="not(descendant::parametername/@direction)">
  472. <emphasis role="italic">?</emphasis>
  473. </xsl:when>
  474. <xsl:otherwise>
  475. <emphasis role="bold">
  476. [<xsl:value-of select="descendant::parametername/@direction"/>]
  477. </emphasis>
  478. </xsl:otherwise>
  479. </xsl:choose>
  480. </para>
  481. </entry>
  482. </xsl:if>
  483. <entry>
  484. <para>
  485. <xsl:value-of select="parameternamelist/parametername"/>
  486. </para>
  487. </entry>
  488. <entry>
  489. <xsl:apply-templates select="parameterdescription"/>
  490. </entry>
  491. </xsl:template>
  492. <xsl:template match="parameterdescription">
  493. <para>
  494. <xsl:apply-templates/>
  495. </para>
  496. </xsl:template>
  497. <xsl:template match="type">
  498. <xsl:apply-templates/>
  499. </xsl:template>
  500. <xsl:template match="bold">
  501. <emphasis role="bold">
  502. <xsl:apply-templates/>
  503. </emphasis>
  504. </xsl:template>
  505. <xsl:template match="emphasis">
  506. <emphasis role="italic">
  507. <xsl:apply-templates/>
  508. </emphasis>
  509. </xsl:template>
  510. <xsl:template match="small">
  511. <xsl:apply-templates/>
  512. </xsl:template>
  513. <xsl:template match="mdash | ndash">
  514. <!-- Doxygen bug; double dashed are replaced with single HTML dash
  515. entities, even in verbatim-like <tt> sections -->
  516. <xsl:text>--</xsl:text>
  517. </xsl:template>
  518. <xsl:template match="computeroutput | preformatted">
  519. <computeroutput>
  520. <xsl:apply-templates/>
  521. </computeroutput>
  522. </xsl:template>
  523. <xsl:template match="codeline">
  524. <xsl:apply-templates/>
  525. </xsl:template>
  526. <xsl:template match="ulink">
  527. <ulink url="{@url}">
  528. <xsl:value-of select="."/>
  529. </ulink>
  530. </xsl:template>
  531. <xsl:template match="superscript">
  532. <superscript>
  533. <xsl:apply-templates/>
  534. </superscript>
  535. </xsl:template>
  536. <xsl:template match="subscript">
  537. <subscript>
  538. <xsl:apply-templates/>
  539. </subscript>
  540. </xsl:template>
  541. <xsl:template match="para">
  542. <para>
  543. <xsl:apply-templates/>
  544. </para>
  545. </xsl:template>
  546. <xsl:template match="ref">
  547. <xsl:choose>
  548. <!-- Don't show links inside program listings -->
  549. <xsl:when test="ancestor::programlisting">
  550. <xsl:value-of select="."/>
  551. </xsl:when>
  552. <!-- Don't show links to file compound definitions, as they are discarded -->
  553. <xsl:when test="ancestor::*/compounddef[@kind = 'file' and @id = current()/@refid]">
  554. <xsl:value-of select="."/>
  555. </xsl:when>
  556. <!-- Show links outside program listings -->
  557. <xsl:otherwise>
  558. <link linkend="{@refid}">
  559. <xsl:value-of select="text()"/>
  560. </link>
  561. </xsl:otherwise>
  562. </xsl:choose>
  563. </xsl:template>
  564. <xsl:template match="entry">
  565. <entry>
  566. <xsl:apply-templates/>
  567. </entry>
  568. </xsl:template>
  569. <xsl:template match="table[caption]">
  570. <table>
  571. <title>
  572. <xsl:value-of select="caption"/>
  573. </title>
  574. <tgroup cols="{@cols}">
  575. <thead>
  576. <xsl:apply-templates select="row[entry/@thead = 'yes']"/>
  577. </thead>
  578. <tbody>
  579. <xsl:apply-templates select="row[entry/@thead != 'yes']"/>
  580. </tbody>
  581. </tgroup>
  582. </table>
  583. </xsl:template>
  584. <xsl:template match="table[not(caption)]">
  585. <informaltable>
  586. <tgroup cols="{@cols}">
  587. <thead>
  588. <xsl:apply-templates select="row[entry/@thead = 'yes']"/>
  589. </thead>
  590. <tbody>
  591. <xsl:apply-templates select="row[entry/@thead != 'yes']"/>
  592. </tbody>
  593. </tgroup>
  594. </informaltable>
  595. </xsl:template>
  596. <xsl:template match="row">
  597. <row>
  598. <xsl:apply-templates/>
  599. </row>
  600. </xsl:template>
  601. <xsl:template match="itemizedlist">
  602. <itemizedlist>
  603. <xsl:apply-templates/>
  604. </itemizedlist>
  605. </xsl:template>
  606. <xsl:template match="orderedlist">
  607. <orderedlist>
  608. <xsl:apply-templates/>
  609. </orderedlist>
  610. </xsl:template>
  611. <xsl:template match="listitem">
  612. <listitem>
  613. <xsl:apply-templates/>
  614. </listitem>
  615. </xsl:template>
  616. <xsl:template match="programlisting">
  617. <programlisting language="c">
  618. <xsl:for-each select="codeline[position() > 1 or highlight]">
  619. <xsl:apply-templates select="."/>
  620. <xsl:text>&#10;</xsl:text>
  621. </xsl:for-each>
  622. </programlisting>
  623. </xsl:template>
  624. <xsl:template match="highlight">
  625. <emphasis role="{@class}">
  626. <xsl:apply-templates/>
  627. </emphasis>
  628. </xsl:template>
  629. <xsl:template match="highlight[1]/text()">
  630. <xsl:choose>
  631. <xsl:when test="substring(., 1, 1) = '*'">
  632. <xsl:value-of select="substring(., 2)"/>
  633. </xsl:when>
  634. <xsl:otherwise>
  635. <xsl:value-of select="."/>
  636. </xsl:otherwise>
  637. </xsl:choose>
  638. </xsl:template>
  639. <xsl:template match="sp[ancestor::codeline]">
  640. <xsl:text> </xsl:text>
  641. </xsl:template>
  642. <xsl:template match="image">
  643. <mediaobject>
  644. <imageobject>
  645. <imagedata align="center">
  646. <xsl:attribute name="fileref">
  647. <xsl:text>images/</xsl:text>
  648. <xsl:value-of select="@name"/>
  649. </xsl:attribute>
  650. </imagedata>
  651. </imageobject>
  652. </mediaobject>
  653. </xsl:template>
  654. <xsl:template match="detaileddescription">
  655. <xsl:apply-templates/>
  656. </xsl:template>
  657. <xsl:template match="sect1 | sect2 | sect3 | sect4 | sect5 | sect6 | sect7 | sect8 | sect9">
  658. <section>
  659. <xsl:if test="@id">
  660. <xsl:attribute name="id">
  661. <xsl:value-of select="@id"/>
  662. </xsl:attribute>
  663. </xsl:if>
  664. <title>
  665. <xsl:value-of select="title"/>
  666. </title>
  667. <xsl:apply-templates/>
  668. </section>
  669. </xsl:template>
  670. <xsl:template match="anchor">
  671. <xsl:if test="@id">
  672. <indexterm id="{@id}"/>
  673. </xsl:if>
  674. </xsl:template>
  675. <xsl:template match="title"/>
  676. <xsl:template match="htmlonly"/>
  677. <xsl:template match="*">
  678. <xsl:message>NO XSL TEMPLATE MATCH: <xsl:value-of select="local-name()"/></xsl:message>
  679. </xsl:template>
  680. </xsl:stylesheet>