1 <?xml version="1.0" encoding="UTF-8"?>
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
5 <xsl:output method="xml" indent="no"/>
7 <xsl:param name="keyword.namespace" select="'Atmel.Language.C'"/>
9 <xsl:template name="generate.book.title">
10 <xsl:text>LUFA Library</xsl:text>
13 <xsl:template name="generate.book.id">
14 <xsl:param name="book.title"/>
17 <xsl:value-of select="@id"/>
20 <xsl:value-of select="translate($book.title, ' ','')"/>
25 <xsl:template name="generate.index.id">
26 <xsl:param name="name"/>
27 <xsl:variable name="book.title">
28 <xsl:call-template name="generate.book.title"/>
30 <xsl:variable name="book.id">
31 <xsl:call-template name="generate.book.id">
32 <xsl:with-param name="book.title" select="$book.title"/>
36 <indexterm id="{$keyword.namespace}.{$name}">
38 <xsl:value-of select="$book.title"/>
41 <xsl:value-of select="$name"/>
46 <xsl:template match="doxygen">
47 <xsl:variable name="book.title">
48 <xsl:call-template name="generate.book.title"/>
51 <xsl:variable name="book.id">
52 <xsl:call-template name="generate.book.id">
53 <xsl:with-param name="book.title" select="$book.title"/>
57 <book id="{$book.id}">
59 <xsl:value-of select="$book.title"/>
62 <!-- Add index chapter -->
63 <xsl:apply-templates select="compounddef[@kind = 'page' and @id = 'indexpage']">
64 <xsl:with-param name="element.type" select="'chapter'"/>
65 <xsl:with-param name="page.title" select="'Library Information'"/>
66 </xsl:apply-templates>
68 <!-- Add free-floating chapters -->
69 <xsl:apply-templates select="compounddef[@kind = 'page' and not(@id = 'indexpage') and not(//innerpage/@refid = @id)]">
70 <xsl:with-param name="element.type" select="'chapter'"/>
71 </xsl:apply-templates>
73 <!-- Add Modules chapter -->
75 <title>Modules</title>
76 <xsl:apply-templates select="compounddef[@kind = 'group' and not(//innergroup/@refid = @id)]"/>
81 <xsl:template match="compounddef[@kind = 'page']">
82 <xsl:param name="element.type" select="'section'"/>
83 <xsl:param name="page.title" select="title"/>
85 <xsl:element name="{$element.type}">
86 <xsl:attribute name="id">
87 <xsl:value-of select="@id"/>
90 <xsl:variable name="name">
91 <xsl:text>LUFA.</xsl:text>
92 <xsl:value-of select="translate(compoundname, '_', '/')"/>
95 <xsl:call-template name="generate.index.id">
96 <xsl:with-param name="name" select="$name"/>
100 <xsl:value-of select="$page.title"/>
103 <xsl:apply-templates select="detaileddescription"/>
105 <xsl:for-each select="innerpage">
106 <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
111 <xsl:template match="compounddef[@kind = 'group']">
114 <xsl:value-of select="title"/>
117 <xsl:variable name="name">
118 <xsl:text>LUFA.</xsl:text>
119 <xsl:value-of select="translate(compoundname, '_', '/')"/>
122 <xsl:call-template name="generate.index.id">
123 <xsl:with-param name="name" select="$name"/>
126 <xsl:apply-templates select="detaileddescription"/>
128 <xsl:apply-templates select="sectiondef"/>
130 <xsl:for-each select="innerclass">
131 <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
134 <xsl:for-each select="innergroup">
135 <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'group' and @id = current()/@refid]"/>
140 <xsl:template match="compounddef[@kind = 'struct' or @kind = 'union']">
141 <xsl:variable name="name" select="compoundname"/>
143 <section id="{@id}" xreflabel="{$name}">
146 <xsl:when test="@kind = 'struct'">
147 <xsl:text>Struct </xsl:text>
150 <xsl:when test="@kind = 'union'">
151 <xsl:text>Union </xsl:text>
155 <xsl:value-of select="$name"/>
158 <xsl:call-template name="generate.index.id">
159 <xsl:with-param name="name" select="$name"/>
162 <xsl:apply-templates select="detaileddescription"/>
164 <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
165 <table tabstyle="striped">
167 <xsl:value-of select="$name"/>
175 <entry>Description</entry>
180 <xsl:for-each select="memberdef">
181 <row id="{@id}" xreflabel="{name}">
183 <xsl:value-of select="type"/>
186 <xsl:value-of select="name"/>
187 <xsl:if test="starts-with(argsstring, '[')">
188 <xsl:text>[]</xsl:text>
191 <xsl:variable name="struct.element.name">
192 <xsl:value-of select="$name"/>
193 <xsl:text>.</xsl:text>
194 <xsl:value-of select="name"/>
197 <xsl:call-template name="generate.index.id">
198 <xsl:with-param name="name" select="$struct.element.name"/>
202 <xsl:apply-templates select="detaileddescription"/>
213 <xsl:template match="memberdef[@kind = 'function']">
214 <section id="{@id}" xreflabel="{name}">
216 <xsl:text>Function </xsl:text>
217 <xsl:value-of select="name"/>
218 <xsl:text>()</xsl:text>
221 <xsl:call-template name="generate.index.id">
222 <xsl:with-param name="name" select="name"/>
226 <emphasis role="italic">
227 <xsl:value-of select="briefdescription"/>
231 <programlisting language="c">
232 <emphasis role="keyword">
233 <xsl:value-of select="type"/>
235 <xsl:text> </xsl:text>
236 <xsl:value-of select="name"/>
237 <xsl:text>(</xsl:text>
240 <xsl:when test="not(param[1]/declname)">
241 <emphasis role="keyword">void</emphasis>
245 <xsl:for-each select="param">
246 <xsl:if test="position() > 1">
247 <xsl:text>,</xsl:text>
249 <xsl:text> 	</xsl:text>
250 <emphasis role="keyword">
251 <xsl:value-of select="type"/>
253 <xsl:text> </xsl:text>
254 <xsl:value-of select="declname"/>
259 <xsl:text>)</xsl:text>
262 <xsl:apply-templates select="detaileddescription"/>
266 <xsl:template match="memberdef[@kind = 'enum']">
267 <section id="{@id}" xreflabel="{name}">
269 <xsl:text>Enum </xsl:text>
270 <xsl:value-of select="name"/>
273 <xsl:call-template name="generate.index.id">
274 <xsl:with-param name="name" select="name"/>
277 <xsl:apply-templates select="detaileddescription"/>
279 <table tabstyle="striped">
280 <title>Members</title>
284 <entry>Enum Value</entry>
285 <entry>Description</entry>
290 <xsl:for-each select="enumvalue">
293 <para id="{@id}" xreflabel="{name}">
294 <xsl:value-of select="name"/>
296 <xsl:call-template name="generate.index.id">
297 <xsl:with-param name="name" select="name"/>
302 <xsl:apply-templates select="detaileddescription"/>
312 <xsl:template match="memberdef[@kind = 'define']">
313 <section id="{@id}" xreflabel="{name}">
315 <xsl:text>Macro </xsl:text>
316 <xsl:value-of select="name"/>
319 <xsl:call-template name="generate.index.id">
320 <xsl:with-param name="name" select="name"/>
323 <programlisting language="c">
324 <emphasis role="preprocessor">
325 <xsl:text>#define </xsl:text>
326 <xsl:value-of select="name"/>
327 <xsl:if test="count(param) > 0">
328 <xsl:text>(</xsl:text>
329 <xsl:for-each select="param/defname">
330 <xsl:if test="position() > 1">
331 <xsl:text>,</xsl:text>
333 <xsl:value-of select="."/>
335 <xsl:text>)</xsl:text>
337 <xsl:text> </xsl:text>
339 <!-- Split long macro definitions across multiple lines -->
340 <xsl:if test="(string-length(initializer) > 50) or (count(param) > 0)">
341 <xsl:text>\ 	</xsl:text>
344 <xsl:value-of select="initializer"/>
346 <xsl:text> </xsl:text>
349 <xsl:apply-templates select="detaileddescription"/>
353 <xsl:template match="memberdef[@kind = 'typedef']">
354 <section id="{@id}" xreflabel="{name}">
356 <xsl:text>Type </xsl:text>
357 <xsl:value-of select="name"/>
360 <xsl:call-template name="generate.index.id">
361 <xsl:with-param name="name" select="name"/>
364 <programlisting language="c">
365 <emphasis role="keyword">
366 <xsl:text>typedef </xsl:text>
367 <xsl:value-of select="type"/>
369 <xsl:text> </xsl:text>
370 <xsl:value-of select="name"/>
371 <xsl:text> </xsl:text>
372 <xsl:value-of select="argsstring"/>
375 <xsl:apply-templates select="detaileddescription"/>
380 <xsl:template match="memberdef[@kind = 'variable']">
381 <section id="{@id}" xreflabel="{name}">
383 <xsl:text>Variable </xsl:text>
384 <xsl:value-of select="name"/>
387 <xsl:call-template name="generate.index.id">
388 <xsl:with-param name="name" select="name"/>
391 <programlisting language="c">
392 <emphasis role="keyword">
393 <xsl:value-of select="type"/>
395 <xsl:text> </xsl:text>
396 <xsl:value-of select="name"/>
399 <xsl:apply-templates select="detaileddescription"/>
403 <xsl:template match="linebreak | simplesectsep">
404 <!-- MUST be on two separate lines, as this is a *literal* newline -->
409 <xsl:template match="verbatim">
411 <xsl:apply-templates/>
415 <xsl:template match="sectiondef">
417 <xsl:value-of select="description"/>
420 <xsl:apply-templates select="memberdef"/>
423 <xsl:template match="simplesect" mode="struct">
425 <xsl:apply-templates/>
429 <xsl:template match="simplesect">
431 <xsl:when test="@kind = 'par'">
434 <xsl:value-of select="title"/>
436 <xsl:apply-templates/>
440 <xsl:when test="@kind = 'return'">
442 <title>Returns</title>
443 <xsl:apply-templates/>
447 <xsl:when test="@kind = 'warning'">
449 <title>Warning</title>
450 <xsl:apply-templates/>
454 <xsl:when test="@kind = 'pre'">
456 <title>Precondition</title>
457 <xsl:apply-templates/>
461 <xsl:when test="@kind = 'see'">
463 <title>See also</title>
464 <xsl:apply-templates/>
468 <xsl:when test="@kind = 'note'">
471 <xsl:apply-templates/>
478 <xsl:template match="parameterlist[@kind = 'param']">
479 <table tabstyle="striped">
480 <title>Parameters</title>
484 <entry>Data Direction</entry>
485 <entry>Parameter Name</entry>
486 <entry>Description</entry>
490 <xsl:for-each select="parameteritem">
492 <xsl:apply-templates select="."/>
500 <xsl:template match="parameterlist[@kind = 'retval']">
501 <table tabstyle="striped">
502 <title>Return Values</title>
506 <entry>Return Value</entry>
507 <entry>Description</entry>
511 <xsl:for-each select="parameteritem">
513 <xsl:apply-templates select="."/>
521 <xsl:template match="parameteritem">
522 <xsl:if test="parent::parameterlist/@kind = 'param'">
526 <xsl:when test="not(descendant::parametername/@direction)">
527 <emphasis role="italic">?</emphasis>
531 <emphasis role="bold">
532 [<xsl:value-of select="descendant::parametername/@direction"/>]
542 <xsl:value-of select="parameternamelist/parametername"/>
547 <xsl:apply-templates select="parameterdescription"/>
551 <xsl:template match="parameterdescription">
553 <xsl:apply-templates/>
557 <xsl:template match="type">
558 <xsl:apply-templates/>
561 <xsl:template match="bold">
562 <emphasis role="bold">
563 <xsl:apply-templates/>
567 <xsl:template match="emphasis">
568 <emphasis role="italic">
569 <xsl:apply-templates/>
573 <xsl:template match="small">
574 <xsl:apply-templates/>
577 <xsl:template match="mdash | ndash">
578 <!-- Doxygen bug; double dashed are replaced with single HTML dash
579 entities, even in verbatim-like <tt> sections -->
580 <xsl:text>--</xsl:text>
583 <xsl:template match="computeroutput | preformatted">
585 <xsl:apply-templates/>
589 <xsl:template match="codeline">
590 <xsl:apply-templates/>
593 <xsl:template match="ulink">
595 <xsl:value-of select="."/>
599 <xsl:template match="superscript">
601 <xsl:apply-templates/>
605 <xsl:template match="subscript">
607 <xsl:apply-templates/>
611 <xsl:template match="para">
613 <xsl:apply-templates/>
617 <xsl:template match="ref">
619 <!-- Don't show links inside program listings -->
620 <xsl:when test="ancestor::programlisting">
621 <xsl:value-of select="."/>
624 <!-- Don't show links to file compound definitions, as they are discarded -->
625 <xsl:when test="ancestor::*/compounddef[@kind = 'file' and @id = current()/@refid]">
626 <xsl:value-of select="."/>
629 <!-- Show links outside program listings -->
631 <link linkend="{@refid}">
632 <xsl:value-of select="text()"/>
638 <xsl:template match="entry">
640 <xsl:apply-templates/>
644 <xsl:template match="table">
646 <xsl:when test="caption">
647 <table tabstyle="striped">
649 <xsl:value-of select="caption"/>
652 <xsl:call-template name="write.table.content"/>
657 <informaltable tabstyle="striped">
658 <xsl:call-template name="write.table.content"/>
664 <xsl:template name="write.table.content">
665 <tgroup cols="{@cols}">
667 <xsl:for-each select="row[1]">
669 <xsl:apply-templates select="entry"/>
675 <xsl:for-each select="row[position() != 1]">
677 <xsl:apply-templates select="entry"/>
684 <xsl:template match="itemizedlist">
686 <xsl:apply-templates/>
690 <xsl:template match="orderedlist">
692 <xsl:apply-templates/>
696 <xsl:template match="listitem">
698 <xsl:apply-templates/>
702 <xsl:template match="programlisting">
703 <programlisting language="c">
704 <xsl:for-each select="codeline[position() > 1 or highlight]">
705 <xsl:apply-templates select="."/>
706 <xsl:text> </xsl:text>
711 <xsl:template match="highlight">
712 <emphasis role="{@class}">
713 <xsl:apply-templates/>
717 <xsl:template match="sp[ancestor::codeline]">
718 <xsl:text> </xsl:text>
721 <xsl:template match="image">
724 <imagedata align="center">
725 <xsl:attribute name="fileref">
726 <xsl:text>images/</xsl:text>
727 <xsl:value-of select="@name"/>
734 <xsl:template match="detaileddescription">
735 <xsl:apply-templates/>
738 <xsl:template match="sect1 | sect2 | sect3 | sect4 | sect5 | sect6 | sect7 | sect8 | sect9">
741 <xsl:attribute name="id">
742 <xsl:value-of select="@id"/>
747 <xsl:value-of select="title"/>
750 <xsl:apply-templates/>
754 <xsl:template match="anchor">
756 <indexterm id="{@id}"/>
760 <xsl:template match="title"/>
762 <xsl:template match="htmlonly"/>
764 <xsl:template match="*">
765 <xsl:message>NO XSL TEMPLATE MATCH: <xsl:value-of select="name()"/></xsl:message>