This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: DocBook XML/XSL - shaded?
- To: "Ship, Howard" <hship at primix dot com>
- Subject: Re: DOCBOOK-APPS: DocBook XML/XSL - shaded?
- From: Dan York <dyork at e-smith dot com>
- Date: Fri, 03 Aug 2001 12:07:29 -0400
- Cc: "'docbook-apps at lists dot oasis-open dot org'" <docbook-apps at lists dot oasis-open dot org>
- Organization: e-smith, Inc.
- References: <433B57A6AF35D511873200508B634CDC05CE74@mail02.primix.com>
Howard,
> I've got most things working OK except I can't find a parameter like
> %shaded-verbatim% to make my program listings display with the nice grey
> background.
There is as yet no parameter in Norm's standard XSL distribution that does
this.
> Is there an easy way to do this? Does someone have a modified XSL template
> that shows how to accomplish this?
I have done this in the customization layers I have built for both our
organization and also for the Linux Documentation Project. You can see my
e-smith stylesheet at:
http://www.e-smith.org/docs/e-smith.xsl
and the document describing it at:
http://www.e-smith.org/docs/docprocess.html
The LDP XSLT stylesheets are viewable through the LDP's CVS at:
http://cvsview.linuxdoc.org/index.cgi/builder/xsl/
The relevant file there to look at is 'ldp-html-common.xsl'.
Basically, you want to modify the XSLT template for the elements to
be shaded. The code looks like:
<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>
The key is that you notice I added a <table border=... bgcolor=...>
tag that wraps the contents of the <programlisting>, <screen> or
<synopsis> inside of an HTML table that is shaded.
Enjoy,
Dan
--
Dan York, Director of Training dyork@e-smith.com
Ph: +1-613-751-4401 Mobile: +1-613-263-4312 Fax: +1-613-564-7739
Mitel Network Corporation Network Server Solutions Group
150 Metcalfe St., Suite 1500, Ottawa,ON K2P 1P1 Canada
http://www.e-smith.com/ open source, open mind
------------------------------------------------------------------
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: docbook-apps-request@lists.oasis-open.org