[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK-APPS: DocBook XML/XSL - shaded?
If you're only concerned about HTML, use a CSS stylesheet. My preference
is to shade screens, but not programlistings, so I use the following:
pre {
border: 1px solid black;
padding-left: 1em;
padding-right: 1em;
}
pre.screen {
background-color: #dfdfdf;
}
(You would specify the background-color in pre or add a rule that matches
pre.programlisting.)
I link this stylesheet to the generated HTML by adding the following to the
customization layer:
<xsl:variable name="html.stylesheet">docbook-jcw.css</xsl:variable>
At 8/3/01, Dan York wrote:
>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.
--
Jon Willeke, Quality Development 617-577-3677
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC