<xsl:template match="programlisting">
<programlisting language="c">
- <xsl:for-each select="codeline[position() > 1 or highlight]">
- <xsl:apply-templates select="."/>
- <xsl:text> </xsl:text>
- </xsl:for-each>
+ <xsl:apply-templates/>
</programlisting>
</xsl:template>
+ <xsl:template match="codeline">
+ <xsl:apply-templates/>
+ <xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="codeline[last()]">
+ <xsl:if test="text() != '*'">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </xsl:template>
+
<xsl:template match="highlight">
<emphasis role="{@class}">
<xsl:apply-templates/>
</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:text> </xsl:text>
</xsl:template>