This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: creating "boxed" programlistings
- From: Dennis Grace <dgrace at us dot ibm dot com>
- To: Lisa Carey <lisa dot carey at havok dot com>
- Cc: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 11 Sep 2002 09:04:35 -0500
- Subject: Re: DOCBOOK-APPS: creating "boxed" programlistings
Hi Lisa,
I use the following customization (I originally lifted this from Dan York's
customization). It creates a grey background box for programlistings in
HTML docs. If this isn't what you need, I thought it might provide a
starting framework.
<!-- Custom 'programlisting' template that will generate a gray
background to the item. -->
<xsl:template match="programlisting|screen|synopsis">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
<xsl:variable name="id"><xsl:call-template
name="object.id"/></xsl:variable>
<xsl:if test="@id">
<a href="{$id}"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<xsl:variable name="rtf">
<xsl:apply-templates/>
</xsl:variable>
<table border="0" bgcolor="#E0E0E0" width="90%">
<tr><td>
<pre class="{name(.)}">
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</pre>
</td></tr></table>
</xsl:when>
<xsl:otherwise>
<table border="0" bgcolor="#E0E0E0" width="90%">
<tr><td>
<pre class="{name(.)}">
<xsl:apply-templates/>
</pre>
</td></tr></table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Dennis Grace
Information Developer
IBM Linux Technology Center
(512) 838-3937 T/L 678-3937 cell: (512)-296-7830
dgrace@us.ibm.com
There are only 10 kinds of people in the world: those who understand binary
and those who don't.
Lisa Carey
<lisa.carey@havok To: docbook-apps@lists.oasis-open.org
.com> cc:
Subject: DOCBOOK-APPS: creating "boxed" programlistings
09/11/2002 08:44
AM
Hi folks,
I'm currently using the docbook 1.50 stylesheets (had problems with later
versions, which I hope will be fixed in 1.54.1 - downloading it now!) and
the latest version of FOP. I'm hoping to get the code samples in my
programlistings to each display in a text box, and thought that I could
probably get the effect I want by putting them each in a single-cell table.
Has anyone else tried this successfully, and is there a more
straightforward
way of doing it?
cheers,
Lisa