Fix ring buffer example.
[pub/USBasp.git] / LUFA / StudioIntegration / HV1 / lufa_docbook_transform.xslt
index 9026dd6..2ebda6d 100644 (file)
                        </title>
 
                        <!-- Add index chapter -->
                        </title>
 
                        <!-- Add index chapter -->
-                       <xsl:call-template name="generate.top.level.page">
-                               <xsl:with-param name="top.level.page" select="compounddef[@kind = 'page' and @id = 'indexpage']"/>
-                       </xsl:call-template>
+                       <xsl:apply-templates select="compounddef[@kind = 'page' and @id = 'indexpage']">
+                               <xsl:with-param name="element.type" select="'chapter'"/>
+                               <xsl:with-param name="page.title"   select="'Library Information'"/>
+                       </xsl:apply-templates>
 
                        <!-- Add free-floating chapters -->
 
                        <!-- Add free-floating chapters -->
-                       <xsl:for-each select="compounddef[@kind = 'page' and not(@id = 'indexpage')]">
-                               <xsl:if test="not(//innerpage[@refid = current()/@id])">
-                                       <xsl:call-template name="generate.top.level.page">
-                                               <xsl:with-param name="top.level.page" select="current()"/>
-                                       </xsl:call-template>
-                               </xsl:if>
-                       </xsl:for-each>
+                       <xsl:apply-templates select="compounddef[@kind = 'page' and not(@id = 'indexpage') and not(//innerpage/@refid = @id)]">
+                               <xsl:with-param name="element.type" select="'chapter'"/>
+                       </xsl:apply-templates>
 
 
-                       <!-- Add Module chapter -->
+                       <!-- Add Modules chapter -->
                        <chapter>
                                <title>Modules</title>
                        <chapter>
                                <title>Modules</title>
-                               <xsl:for-each select="compounddef[@kind = 'group']">
-                                       <xsl:if test="not(//innergroup[@refid = current()/@id])">
-                                               <xsl:apply-templates select="current()"/>
-                                       </xsl:if>
-                               </xsl:for-each>
+                               <xsl:apply-templates select="compounddef[@kind = 'group' and not(//innergroup/@refid = @id)]"/>
                        </chapter>
                </book>
        </xsl:template>
 
                        </chapter>
                </book>
        </xsl:template>
 
-       <xsl:template name="generate.top.level.page">
-               <xsl:param name="top.level.page"/>
-
-               <chapter id="{$top.level.page/@id}">
-                       <title>
-                               <xsl:value-of select="$top.level.page/title"/>
-                       </title>
+       <xsl:template match="compounddef[@kind = 'page']">
+               <xsl:param name="element.type" select="'section'"/>
+               <xsl:param name="page.title"   select="title"/>
 
 
-                       <xsl:apply-templates select="$top.level.page/detaileddescription"/>
+               <xsl:element name="{$element.type}">
+                       <xsl:attribute name="id">
+                               <xsl:value-of select="@id"/>
+                       </xsl:attribute>
 
 
-                       <xsl:for-each select="$top.level.page/innerpage">
-                               <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
-                       </xsl:for-each>
-               </chapter>
-       </xsl:template>
+                       <xsl:variable name="name">
+                               <xsl:text>LUFA.</xsl:text>
+                               <xsl:value-of select="translate(compoundname, '_', '.')"/>
+                       </xsl:variable>
 
 
-       <xsl:template match="compounddef">
-               <!-- Discard compounddef elements unless a later template matches -->
-       </xsl:template>
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="$name"/>
+                       </xsl:call-template>
 
 
-       <xsl:template match="compounddef[@kind = 'page']">
-               <section id="{@id}">
                        <title>
                        <title>
-                               <xsl:value-of select="title"/>
+                               <xsl:value-of select="$page.title"/>
                        </title>
 
                        <xsl:apply-templates select="detaileddescription"/>
 
                        </title>
 
                        <xsl:apply-templates select="detaileddescription"/>
 
+                       <xsl:if test="not(innerpage) and count(detaileddescription//sect1)">
+                               <para>
+                                       <emphasis role="bold">Subsections:</emphasis>
+                                       <itemizedlist>
+                                               <xsl:for-each select="detaileddescription//sect1">
+                                                       <listitem>
+                                                               <link linkend="{@id}">
+                                                                       <xsl:value-of select="title"/>
+                                                               </link>
+                                                       </listitem>
+                                               </xsl:for-each>
+                                       </itemizedlist>
+                               </para>
+                       </xsl:if>
+
                        <xsl:for-each select="innerpage">
                                <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
                        </xsl:for-each>
                        <xsl:for-each select="innerpage">
                                <xsl:apply-templates select="ancestor::*/compounddef[@kind = 'page' and @id = current()/@refid]"/>
                        </xsl:for-each>
-               </section>
+               </xsl:element>
        </xsl:template>
 
        <xsl:template match="compounddef[@kind = 'group']">
        </xsl:template>
 
        <xsl:template match="compounddef[@kind = 'group']">
                        </title>
 
                        <xsl:variable name="name">
                        </title>
 
                        <xsl:variable name="name">
-                               <xsl:choose>
-                                       <xsl:when test="contains(compoundname, '_')">
-                                               <xsl:value-of select="translate(compoundname, '_', '/')"/>
-                                               <xsl:text>.h</xsl:text>
-                                       </xsl:when>
-
-                                       <xsl:otherwise>
-                                               <xsl:value-of select="compoundname"/>
-                                               <xsl:text>.h</xsl:text>
-                                       </xsl:otherwise>
-                               </xsl:choose>
+                               <xsl:text>LUFA.</xsl:text>
+                               <xsl:value-of select="translate(compoundname, '_', '.')"/>
                        </xsl:variable>
 
                        </xsl:variable>
 
-                       <xsl:variable name="name.escaped">
-                               <xsl:choose>
-                                       <xsl:when test="contains(compoundname, '_')">
-                                               <xsl:value-of select="translate(compoundname, '_', '.')"/>
-                                               <xsl:text>.h</xsl:text>
-                                       </xsl:when>
-
-                                       <xsl:otherwise>
-                                               <xsl:value-of select="compoundname"/>
-                                               <xsl:text>.h</xsl:text>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </xsl:variable>
-
-                       <indexterm id="{$keyword.namespace}.{$name.escaped}">
-                               <primary>Header</primary>
-                               <secondary>
-                                       <xsl:value-of select="$name"/>
-                               </secondary>
-                       </indexterm>
-
                        <xsl:call-template name="generate.index.id">
                                <xsl:with-param name="name" select="$name"/>
                        </xsl:call-template>
 
                        <xsl:call-template name="generate.index.id">
                                <xsl:with-param name="name" select="$name"/>
                        </xsl:call-template>
 
-                       <indexterm>
-                               <primary>
-                                       <xsl:value-of select="$name"/>
-                               </primary>
-                       </indexterm>
+                       <xsl:apply-templates select="detaileddescription"/>
 
 
-                       <xsl:apply-templates select="detaileddescription" />
+                       <xsl:if test="count(innergroup)">
+                               <para>
+                                       <emphasis role="bold">Subgroups:</emphasis>
+                                       <itemizedlist>
+                                               <xsl:for-each select="innergroup">
+                                                       <listitem>
+                                                               <link linkend="{@refid}">
+                                                                       <xsl:value-of select="text()"/>
+                                                               </link>
+                                                       </listitem>
+                                               </xsl:for-each>
+                                       </itemizedlist>
+                               </para>
+                       </xsl:if>
 
 
-                       <xsl:apply-templates select="sectiondef" />
+                       <xsl:apply-templates select="sectiondef"/>
 
                        <xsl:for-each select="innerclass">
                                <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
 
                        <xsl:for-each select="innerclass">
                                <xsl:apply-templates select="ancestor::*/compounddef[@id = current()/@refid]"/>
                        <xsl:apply-templates select="detaileddescription"/>
 
                        <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
                        <xsl:apply-templates select="detaileddescription"/>
 
                        <xsl:for-each select="sectiondef[@kind = 'public-attrib']">
-                               <table tabstyle="striped">
+                               <table>
                                        <title>
                                                <xsl:value-of select="$name"/>
                                        </title>
                                        <title>
                                                <xsl:value-of select="$name"/>
                                        </title>
+
                                        <tgroup cols="3">
                                        <tgroup cols="3">
-                                               <colspec colnum="1" colname="start.col"/>
-                                               <colspec colnum="3" colname="stop.col"/>
-                                               <spanspec spanname="full" namest="start.col" nameend="stop.col"/>
                                                <thead>
                                                        <row>
                                                                <entry>Type</entry>
                                                <thead>
                                                        <row>
                                                                <entry>Type</entry>
                                                                <entry>Description</entry>
                                                        </row>
                                                </thead>
                                                                <entry>Description</entry>
                                                        </row>
                                                </thead>
+
                                                <tbody>
                                                        <xsl:for-each select="memberdef">
                                                                <row id="{@id}" xreflabel="{name}">
                                                                        <entry>
                                                <tbody>
                                                        <xsl:for-each select="memberdef">
                                                                <row id="{@id}" xreflabel="{name}">
                                                                        <entry>
-                                                                               <xsl:apply-templates select="type"/>
+                                                                               <xsl:value-of select="type"/>
                                                                        </entry>
                                                                        <entry>
                                                                                <xsl:value-of select="name"/>
                                                                                <xsl:if test="starts-with(argsstring, '[')">
                                                                                        <xsl:text>[]</xsl:text>
                                                                                </xsl:if>
                                                                        </entry>
                                                                        <entry>
                                                                                <xsl:value-of select="name"/>
                                                                                <xsl:if test="starts-with(argsstring, '[')">
                                                                                        <xsl:text>[]</xsl:text>
                                                                                </xsl:if>
-                                                                               <indexterm id="{$keyword.namespace}.{$name}.{name}"/>
+
+                                                                               <xsl:variable name="struct.element.name">
+                                                                                       <xsl:value-of select="$name"/>
+                                                                                       <xsl:text>.</xsl:text>
+                                                                                       <xsl:value-of select="name"/>
+                                                                               </xsl:variable>
+
+                                                                               <xsl:call-template name="generate.index.id">
+                                                                                       <xsl:with-param name="name" select="$struct.element.name"/>
+                                                                               </xsl:call-template>
                                                                        </entry>
                                                                        <entry>
                                                                                <xsl:apply-templates select="detaileddescription"/>
                                                                        </entry>
                                                                        <entry>
                                                                                <xsl:apply-templates select="detaileddescription"/>
                                <xsl:text>(</xsl:text>
 
                                <xsl:choose>
                                <xsl:text>(</xsl:text>
 
                                <xsl:choose>
-                                       <xsl:when test="argsstring = '(void)'">
+                                       <xsl:when test="not(param[1]/declname)">
                                                <emphasis role="keyword">void</emphasis>
                                        </xsl:when>
 
                                                <emphasis role="keyword">void</emphasis>
                                        </xsl:when>
 
                                                        <xsl:if test="position() > 1">
                                                                <xsl:text>,</xsl:text>
                                                        </xsl:if>
                                                        <xsl:if test="position() > 1">
                                                                <xsl:text>,</xsl:text>
                                                        </xsl:if>
-                                                       <xsl:text>&#10;&#9;&#9;</xsl:text>
+                                                       <xsl:text>&#10;&#9;</xsl:text>
                                                        <emphasis role="keyword">
                                                                <xsl:value-of select="type"/>
                                                        </emphasis>
                                                        <emphasis role="keyword">
                                                                <xsl:value-of select="type"/>
                                                        </emphasis>
        </xsl:template>
 
        <xsl:template match="memberdef[@kind = 'enum']">
        </xsl:template>
 
        <xsl:template match="memberdef[@kind = 'enum']">
-               <xsl:variable name="name" select="name"/>
-
                <section id="{@id}" xreflabel="{name}">
                        <title>
                                <xsl:text>Enum </xsl:text>
                <section id="{@id}" xreflabel="{name}">
                        <title>
                                <xsl:text>Enum </xsl:text>
-                               <xsl:value-of select="$name"/>
+                               <xsl:value-of select="name"/>
                        </title>
 
                        <xsl:call-template name="generate.index.id">
                        </title>
 
                        <xsl:call-template name="generate.index.id">
-                               <xsl:with-param name="name" select="$name"/>
+                               <xsl:with-param name="name" select="name"/>
                        </xsl:call-template>
 
                        <xsl:apply-templates select="detaileddescription"/>
 
                        </xsl:call-template>
 
                        <xsl:apply-templates select="detaileddescription"/>
 
-                       <table tabstyle="striped">
+                       <table>
                                <title>Members</title>
                                <tgroup cols="2">
                                        <thead>
                                <title>Members</title>
                                <tgroup cols="2">
                                        <thead>
                                                        <entry>Description</entry>
                                                </row>
                                        </thead>
                                                        <entry>Description</entry>
                                                </row>
                                        </thead>
+
                                        <tbody>
                                                <xsl:for-each select="enumvalue">
                                                        <row>
                                                                <entry>
                                                                        <para id="{@id}" xreflabel="{name}">
                                                                                <xsl:value-of select="name"/>
                                        <tbody>
                                                <xsl:for-each select="enumvalue">
                                                        <row>
                                                                <entry>
                                                                        <para id="{@id}" xreflabel="{name}">
                                                                                <xsl:value-of select="name"/>
-                                                                               <indexterm id="{$keyword.namespace}.{$name}.{name}"/>
+
+                                                                               <xsl:call-template name="generate.index.id">
+                                                                                       <xsl:with-param name="name" select="name"/>
+                                                                               </xsl:call-template>
                                                                        </para>
                                                                </entry>
                                                                <entry>
                                                                        </para>
                                                                </entry>
                                                                <entry>
 
                                        <!-- Split long macro definitions across multiple lines -->
                                        <xsl:if test="(string-length(initializer) > 50) or (count(param) > 0)">
 
                                        <!-- Split long macro definitions across multiple lines -->
                                        <xsl:if test="(string-length(initializer) > 50) or (count(param) > 0)">
-                                               <xsl:text>\&#10;&#09;&#9;</xsl:text>
+                                               <xsl:text>\&#10;&#9;</xsl:text>
                                        </xsl:if>
 
                                        <xsl:value-of select="initializer"/>
                                        </xsl:if>
 
                                        <xsl:value-of select="initializer"/>
                </section>
        </xsl:template>
 
                </section>
        </xsl:template>
 
-       <xsl:template match="memberdef[@kind = 'variable' or @kind = 'typedef']">
+       <xsl:template match="memberdef[@kind = 'typedef']">
                <section id="{@id}" xreflabel="{name}">
                <section id="{@id}" xreflabel="{name}">
-                       <!-- Doxygen gets confused and thinks function pointer type definitions
-                                are variables, so we need to map them to this common section and
-                                check the definition to see which of the two it is. -->
-                       <xsl:choose>
-                               <xsl:when test="contains(definition, 'typedef')">
-                                       <title>
-                                               <xsl:text>Type </xsl:text>
-                                               <xsl:value-of select="name"/>
-                                       </title>
+                       <title>
+                               <xsl:text>Type </xsl:text>
+                               <xsl:value-of select="name"/>
+                       </title>
 
 
-                                       <xsl:call-template name="generate.index.id">
-                                               <xsl:with-param name="name" select="name"/>
-                                       </xsl:call-template>
-
-                                       <programlisting language="c">
-                                               <emphasis role="keyword">
-                                                       <xsl:text>typedef </xsl:text>
-                                                       <xsl:value-of select="type"/>
-                                               </emphasis>
-                                               <xsl:text> </xsl:text>
-                                               <xsl:value-of select="name"/>
-                                               <xsl:text> </xsl:text>
-                                               <xsl:value-of select="argsstring"/>
-                                       </programlisting>
-                               </xsl:when>
-
-                               <xsl:otherwise>
-                                       <title>
-                                               <xsl:text>Variable </xsl:text>
-                                               <xsl:value-of select="name"/>
-                                       </title>
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="name"/>
+                       </xsl:call-template>
+
+                       <programlisting language="c">
+                               <emphasis role="keyword">
+                                       <xsl:text>typedef </xsl:text>
+                                       <xsl:value-of select="type"/>
+                               </emphasis>
+                               <xsl:text> </xsl:text>
+                               <xsl:value-of select="name"/>
+                               <xsl:text> </xsl:text>
+                               <xsl:value-of select="argsstring"/>
+                       </programlisting>
 
 
-                                       <xsl:call-template name="generate.index.id">
-                                               <xsl:with-param name="name" select="name"/>
-                                       </xsl:call-template>
+                       <xsl:apply-templates select="detaileddescription"/>
+               </section>
+       </xsl:template>
 
 
-                                       <programlisting language="c">
-                                               <emphasis role="keyword">
-                                                       <xsl:value-of select="type"/>
-                                               </emphasis>
-                                               <xsl:text> </xsl:text>
-                                               <xsl:value-of select="name"/>
-                                       </programlisting>
-                               </xsl:otherwise>
-                       </xsl:choose>
+
+       <xsl:template match="memberdef[@kind = 'variable']">
+               <section id="{@id}" xreflabel="{name}">
+                       <title>
+                               <xsl:text>Variable </xsl:text>
+                               <xsl:value-of select="name"/>
+                       </title>
+
+                       <xsl:call-template name="generate.index.id">
+                               <xsl:with-param name="name" select="name"/>
+                       </xsl:call-template>
+
+                       <programlisting language="c">
+                               <emphasis role="keyword">
+                                       <xsl:value-of select="type"/>
+                               </emphasis>
+                               <xsl:text> </xsl:text>
+                               <xsl:value-of select="name"/>
+                       </programlisting>
 
                        <xsl:apply-templates select="detaileddescription"/>
                </section>
        </xsl:template>
 
 
                        <xsl:apply-templates select="detaileddescription"/>
                </section>
        </xsl:template>
 
-       <xsl:template match="linebreak">
+       <xsl:template match="linebreak | simplesectsep">
+               <!-- MUST be on two separate lines, as this is a *literal* newline -->
                <literallayout>
                </literallayout>
        </xsl:template>
                <literallayout>
                </literallayout>
        </xsl:template>
                                        <title>
                                                <xsl:value-of select="title"/>
                                        </title>
                                        <title>
                                                <xsl:value-of select="title"/>
                                        </title>
-                                       <xsl:apply-templates select="para"/>
+                                       <xsl:apply-templates/>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'return'">
                                <note>
                                        <title>Returns</title>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'return'">
                                <note>
                                        <title>Returns</title>
-                                       <xsl:apply-templates select="para"/>
+                                       <xsl:apply-templates/>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'warning'">
                                <warning>
                                        <title>Warning</title>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'warning'">
                                <warning>
                                        <title>Warning</title>
-                                       <xsl:apply-templates select="para"/>
+                                       <xsl:apply-templates/>
                                </warning>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'pre'">
                                <note>
                                        <title>Precondition</title>
                                </warning>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'pre'">
                                <note>
                                        <title>Precondition</title>
-                                       <xsl:apply-templates select="para"/>
+                                       <xsl:apply-templates/>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'see'">
                                <note>
                                        <title>See also</title>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'see'">
                                <note>
                                        <title>See also</title>
-                                       <xsl:apply-templates select="para"/>
+                                       <xsl:apply-templates/>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'note'">
                                <note>
                                        <title>Note</title>
                                </note>
                        </xsl:when>
 
                        <xsl:when test="@kind = 'note'">
                                <note>
                                        <title>Note</title>
-                                       <xsl:apply-templates select="para"/>
+                                       <xsl:apply-templates/>
                                </note>
                        </xsl:when>
 
                                </note>
                        </xsl:when>
 
        </xsl:template>
 
        <xsl:template match="parameterlist[@kind = 'param']">
        </xsl:template>
 
        <xsl:template match="parameterlist[@kind = 'param']">
-               <table tabstyle="striped">
+               <table>
                        <title>Parameters</title>
                        <tgroup cols="3">
                                <thead>
                        <title>Parameters</title>
                        <tgroup cols="3">
                                <thead>
        </xsl:template>
 
        <xsl:template match="parameterlist[@kind = 'retval']">
        </xsl:template>
 
        <xsl:template match="parameterlist[@kind = 'retval']">
-               <table tabstyle="striped">
+               <table>
                        <title>Return Values</title>
                        <tgroup cols="2">
                                <thead>
                        <title>Return Values</title>
                        <tgroup cols="2">
                                <thead>
                </entry>
        </xsl:template>
 
                </entry>
        </xsl:template>
 
-       <xsl:template match="type">
-               <xsl:apply-templates/>
-       </xsl:template>
-
-       <xsl:template match="para">
+       <xsl:template match="parameterdescription">
                <para>
                        <xsl:apply-templates/>
                </para>
        </xsl:template>
 
                <para>
                        <xsl:apply-templates/>
                </para>
        </xsl:template>
 
+       <xsl:template match="type">
+               <xsl:apply-templates/>
+       </xsl:template>
+
        <xsl:template match="bold">
                <emphasis role="bold">
        <xsl:template match="bold">
                <emphasis role="bold">
-                       <xsl:value-of select="."/>
+                       <xsl:apply-templates/>
                </emphasis>
        </xsl:template>
 
        <xsl:template match="emphasis">
                <emphasis role="italic">
                </emphasis>
        </xsl:template>
 
        <xsl:template match="emphasis">
                <emphasis role="italic">
-                       <xsl:value-of select="."/>
+                       <xsl:apply-templates/>
                </emphasis>
        </xsl:template>
 
                </emphasis>
        </xsl:template>
 
-       <xsl:template match="computeroutput">
-               <computeroutput>
-                       <xsl:value-of select="."/>
-               </computeroutput>
+       <xsl:template match="small">
+               <xsl:apply-templates/>
        </xsl:template>
 
        </xsl:template>
 
-       <xsl:template match="ulink">
-               <ulink url="{@url}">
-                       <xsl:value-of select="."/>
-               </ulink>
+       <xsl:template match="mdash | ndash">
+               <!-- Doxygen bug; double dashed are replaced with single HTML dash
+                    entities, even in verbatim-like <tt> sections -->
+               <xsl:text>--</xsl:text>
        </xsl:template>
 
        </xsl:template>
 
-       <xsl:template match="registered">
-               <xsl:text>&#174;</xsl:text>
+       <xsl:template match="computeroutput | preformatted">
+               <computeroutput>
+                       <xsl:apply-templates/>
+               </computeroutput>
        </xsl:template>
 
        </xsl:template>
 
-       <xsl:template match="copy">
-               <xsl:text>&#169;</xsl:text>
+       <xsl:template match="codeline">
+                       <xsl:apply-templates/>
        </xsl:template>
 
        </xsl:template>
 
-       <xsl:template match="trademark">
-               <xsl:text>&#8482;</xsl:text>
+       <xsl:template match="ulink">
+               <ulink url="{@url}">
+                       <xsl:value-of select="."/>
+               </ulink>
        </xsl:template>
 
        <xsl:template match="superscript">
                <superscript>
        </xsl:template>
 
        <xsl:template match="superscript">
                <superscript>
-                       <xsl:value-of select="."/>
+                       <xsl:apply-templates/>
                </superscript>
        </xsl:template>
 
        <xsl:template match="subscript">
                <subscript>
                </superscript>
        </xsl:template>
 
        <xsl:template match="subscript">
                <subscript>
-                       <xsl:value-of select="."/>
+                       <xsl:apply-templates/>
                </subscript>
        </xsl:template>
 
                </subscript>
        </xsl:template>
 
+       <xsl:template match="para">
+               <para>
+                       <xsl:apply-templates/>
+               </para>
+       </xsl:template>
+
        <xsl:template match="ref">
                <xsl:choose>
                        <!-- Don't show links inside program listings -->
        <xsl:template match="ref">
                <xsl:choose>
                        <!-- Don't show links inside program listings -->
                </xsl:choose>
        </xsl:template>
 
                </xsl:choose>
        </xsl:template>
 
-       <xsl:template match="table">
-               <xsl:choose>
-                       <xsl:when test="caption">
-                               <table tabstyle="striped">
-                                       <title>
-                                               <xsl:value-of select="caption"/>
-                                       </title>
-                                       <xsl:call-template name="write.table.content"/>
-                               </table>
-                       </xsl:when>
+       <xsl:template match="entry">
+               <entry>
+                       <xsl:apply-templates/>
+               </entry>
+       </xsl:template>
 
 
-                       <xsl:otherwise>
-                               <informaltable tabstyle="striped">
-                                       <xsl:call-template name="write.table.content"/>
-                               </informaltable>
-                       </xsl:otherwise>
-               </xsl:choose>
+       <xsl:template match="table[caption]">
+               <table>
+                       <title>
+                               <xsl:value-of select="caption"/>
+                       </title>
+
+                       <tgroup cols="{@cols}">
+                               <thead>
+                                       <xsl:apply-templates select="row[entry/@thead = 'yes']"/>
+                               </thead>
+
+                               <tbody>
+                                       <xsl:apply-templates select="row[entry/@thead != 'yes']"/>
+                               </tbody>
+                       </tgroup>
+               </table>
        </xsl:template>
 
        </xsl:template>
 
-       <xsl:template name="write.table.content">
-               <tgroup cols="{@cols}">
-                       <thead>
-                               <xsl:for-each select="row[1]">
-                                       <row>
-                                               <xsl:for-each select="entry">
-                                                       <entry>
-                                                               <xsl:apply-templates select="."/>
-                                                       </entry>
-                                               </xsl:for-each>
-                                       </row>
-                               </xsl:for-each>
-                       </thead>
-                       <tbody>
-                               <xsl:for-each select="row[position() != 1]">
-                                       <row>
-                                               <xsl:for-each select="entry">
-                                                       <entry>
-                                                               <xsl:apply-templates select="."/>
-                                                       </entry>
-                                               </xsl:for-each>
-                                       </row>
-                               </xsl:for-each>
-                       </tbody>
-               </tgroup>
+       <xsl:template match="table[not(caption)]">
+               <informaltable>
+                       <tgroup cols="{@cols}">
+                               <thead>
+                                       <xsl:apply-templates select="row[entry/@thead = 'yes']"/>
+                               </thead>
+
+                               <tbody>
+                                       <xsl:apply-templates select="row[entry/@thead != 'yes']"/>
+                               </tbody>
+                       </tgroup>
+               </informaltable>
+       </xsl:template>
+
+       <xsl:template match="row">
+               <row>
+                       <xsl:apply-templates/>
+               </row>
        </xsl:template>
 
        <xsl:template match="itemizedlist">
        </xsl:template>
 
        <xsl:template match="itemizedlist">
        </xsl:template>
 
        <xsl:template match="highlight">
        </xsl:template>
 
        <xsl:template match="highlight">
-<!--           <emphasis role="{@class}"> -->
+               <emphasis role="{@class}">
                        <xsl:apply-templates/>
                        <xsl:apply-templates/>
-<!--           </emphasis> -->
+               </emphasis>
+       </xsl:template>
+
+       <xsl:template match="highlight[1]/text()">
+               <xsl:choose>
+                       <xsl:when test="substring(., 1, 1) = '*'">
+                               <xsl:value-of select="substring(., 2)"/>
+                       </xsl:when>
+
+                       <xsl:otherwise>
+                               <xsl:value-of select="."/>
+                       </xsl:otherwise>
+               </xsl:choose>
        </xsl:template>
 
        <xsl:template match="sp[ancestor::codeline]">
        </xsl:template>
 
        <xsl:template match="sp[ancestor::codeline]">
        <xsl:template match="image">
                <mediaobject>
                        <imageobject>
        <xsl:template match="image">
                <mediaobject>
                        <imageobject>
-                               <imagedata>
+                               <imagedata align="center">
                                        <xsl:attribute name="fileref">
                                                <xsl:text>images/</xsl:text>
                                                <xsl:value-of select="@name"/>
                                        <xsl:attribute name="fileref">
                                                <xsl:text>images/</xsl:text>
                                                <xsl:value-of select="@name"/>
 
        <xsl:template match="title"/>
 
 
        <xsl:template match="title"/>
 
+       <xsl:template match="htmlonly"/>
+
+       <xsl:template match="*">
+               <xsl:message>NO XSL TEMPLATE MATCH: <xsl:value-of select="local-name()"/></xsl:message>
+       </xsl:template>
+
 </xsl:stylesheet>
 </xsl:stylesheet>