This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] callouts in TEX
I created a solution by myself. Pherhaps someone faces the same problem so
I will list my solution subsequently.
First of all I write the definition of a counter at the beginning of the
document. This is done by a xsl-file called preamble.xsl:
% ------------------------------------------------------------
% Counter for callouts
% ------------------------------------------------------------
% callout counter
\newcounter{cocnt}
% step the counter, print it and make a label for referencing
\def\co#1{%
\refstepcounter{cocnt}\hfill\label{#1}\thecocnt}
Then I included the following templates in a xsl-file which handles
verbatim elements and overrides the db2latex-stylesheets.
<xsl:template match="screen">
<!-- include 2 linebreaks to force a break in pdf -->
<xsl:text>

</xsl:text>
<xsl:choose>
<xsl:when test="child::co">
<xsl:text></xsl:text>
<xsl:call-template name="transform-lines">
<xsl:with-param name="pcdata">
<xsl:apply-templates mode="make.verbatim.mode"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\setcounter{cocnt}{0}</xsl:text>
</xsl:template>
<xsl:template match="co" mode="make.verbatim.mode">
<xsl:text>þ\co{</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>}</xsl:text>
</xsl:template>
<!-- Hier lese ich jetzt Zeile fuer Zeile ein um calllouts zu erstellen -->
<xsl:template name="transform-lines">
<!-- CDATA von Screen uebergeben -->
<xsl:param name="pcdata"/>
<xsl:choose>
<!-- Lesen bis zum Zeilenende -->
<xsl:when test="contains ($pcdata, '
')">
<!-- Zeile parameter verb zuweisen -->
<xsl:param name="verb" select="substring-before($pcdata,'
')"/>
<!-- Handelt es sich um eine Zeile mit INhalt? -->
<xsl:if test="string-length($verb)>1">
<xsl:text>\verbþ</xsl:text>
<xsl:choose>
<xsl:when test="contains($verb,'þ\co{')">
<xsl:value-of select="$verb"/>
<xsl:text>\\</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$verb"/>
<xsl:text>þ\\</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:call-template name="transform-lines">
<xsl:with-param name="pcdata"
select="substring-after($pcdata,'
')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Kein Zeilenumbruch enthalten -->
<!-- Hier muesste man sich noch etwas einfallen lassen -->
<xsl:value-of select="$pcdata"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="callout">
<xsl:text>\item[\ref{</xsl:text>
<xsl:value-of select="@arearefs"/>
<xsl:text>}]</xsl:text>
<xsl:apply-templates/>
</xsl:template>