upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

lufa_docbook_transform.xslt 19KB

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