Hi David,
Some of these can be done easily.
For dbhtml list-presentation='table', you could set the stylesheet param
'variablelist.as.table' to 1.
For term-presentation in bold, you could use a CSS stylesheet with a selector matching
on the <span class="term"> element that wraps the term text.
For the others, I would suggest customizing the templates that are called to handle
the processing instructions. For example, in the template that starts with
<xsl:template match="variablelist">
in html/lists.xsl, you will see this bit:
<xsl:variable name="term-width">
<xsl:call-template name="pi.dbhtml_term-width"/>
</xsl:variable>
The stylesheet calls the template named 'pi.dbhtml_term-width' regardless of whether
such a PI exists in the document. So you could customize that template to generate a
standard term width. Those pi templates are in html/pi.xsl. One customization might
look like this:
<xsl:template name="pi.dbhtml_term-width">
<xsl:param name="node" select="."/>
<xsl:choose>
<xsl:when test="local-name($node) = 'variablelist' ">
<xsl:text>20%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="dbhtml-attribute">
<xsl:with-param name="pis"
select="$node/processing-instruction('dbhtml')"/>
<xsl:with-param name="attribute" select="'term-width'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
If the current context node is a variablelist, then set it to 20%, otherwise just let
it handle any an PIs. If you want to be able to override the 20% with a PI, then
process any PI into a variable first, and if the result is not blank, use that value
first in your xsl:choose.
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "David Goss" <[email protected]>
To: <[email protected]>
Sent: Wednesday, March 21, 2012 6:45 AM
Subject: [docbook-apps] Applying a processing instruction by default in a
stylesheet
Per the instructions in Bob Stayton's excellent XSL Guide for
<variablelist> [http://www.sagehill.net/docbookxsl/Variablelists.html],
I've found that I want to use a number of processing instructions in
every variablelist in a set of documents. Something along the lines of:
<?dbhtml list-presentation='table'?>
<?dbhtml term-presentation='bold'?>
<?dbhtml term-width='20%' list-width='80%'?>
<?dbhtml table-summary='Field Description'?>
<?dbfo term-width="0.75in"?>
Rather than copying/pasting these into every <variablelist>, it would
make sense to make this the default behavior for each instance. Is there
a way to activate the applicable instructions in my customization layers
for print and html for all variablelists? I've searched through the
stylesheets, but with my limited understanding of XSL, I'm not sure how
exactly the instruction is set during processing and how I can set it
manually in the stylesheet instead of the document.
DAVID GOSS | Technical Writer
P 1.800.876.9218 x 345 | F 1.800.588.9866
[email protected]
http://www.MuellerReports.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]