OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Specify FO output font size in xml element?


Hi Eric,
The attribute-set approach can still be used, because an attribute-set is computed each time it is used. And a processing-instruction would be appropriate here to indicate font-size, since this is a formatting issue for FO output only. Here is a customization that uses that.

You can set a default programlisting font size with a new parameter:

<xsl:param name="programlisting.fontsize">10pt</xsl:param>

and customize the attribute set this way:

<xsl:attribute-set name="monospace.verbatim.properties">
 <xsl:attribute name="font-size">
   <xsl:call-template name="programlisting.fontsize"/>
 </xsl:attribute>
</xsl:attribute-set>

It sets the attribute value with a template call each time it is used.  Then
add this template to your customization to compute the font size in each instance:

<xsl:template name="programlisting.fontsize">
 <xsl:variable name="font.size">
   <xsl:call-template name="dbfo-attribute">
     <xsl:with-param name="pis" select="processing-instruction('dbfo')"/>
     <xsl:with-param name="attribute">font-size</xsl:with-param>
   </xsl:call-template>
 </xsl:variable>

 <xsl:choose>
   <xsl:when test="$font.size != ''">
     <xsl:value-of select="$font.size"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="$programlisting.fontsize"/>
   </xsl:otherwise>
 </xsl:choose>

</xsl:template>


Then you can do something like this in your files to set a font-size for a given programlisting:

<programlisting><?dbfo font-size="8pt" ?>...

The processing instruction can be anywhere in the programlisting.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

--------------------------------------------------
From: "Eric Nordlund" <nordlund@cray.com>
Sent: Friday, April 05, 2013 5:57 PM
To: "Richard Hamilton" <hamilton@xmlpress.net>
Cc: <docbook-apps@lists.oasis-open.org>
Subject: RE: [docbook-apps] Specify FO output font size in xml element?

Thanks Richard. I have used the attribute sets for the entire document, but some of my examples are too long to fit on the page and I want to shrink the font size for only that instance so I can fit it without compromising the rest of the verbatim blocks.

In other words, I only want to apply these fine-grained customizations on demand for individual instances, and not the entire document. The reason I want to use the role="7pt" and width="0" is because our entire document set uses these attributes for that purpose with our FOSI publishing system. I'm trying to "port" our current system to XSL-FO to make it more future-proof.

Eric

-----Original Message-----
From: Richard Hamilton [mailto:hamilton@xmlpress.net]
Sent: Friday, April 05, 2013 5:52 PM
To: Eric Nordlund
Cc: docbook-apps@lists.oasis-open.org
Subject: Re: [docbook-apps] Specify FO output font size in xml element?

Hi Eric,

Take a look at the monospace.verbatim.properties attribute set. I know you can set the font there. You may also be able to adjust the margins (I haven't tried that in this context).

Generally, I always look for attribute sets first when doing a customization, because if you can get what you need done with the attribute set, it will save you having to customize templates.

Best Regards,
Dick Hamilton
-------
XML Press
XML for Technical Communicators
http://xmlpress.net
hamilton@xmlpress.net



On Apr 5, 2013, at 5:35 PM, Eric Nordlund wrote:

Hi gang, I've had so much luck with this list this week. Thanks!

I have some verbatim sections that I need to shrink the font size so the whole line fits on the page. I've modified the <xsl:template match="programlisting|screen|synopsis"> template in verbatim.xsl so that I can pass a width='1' attribute which sets the resulting fo:block to have 0pts indent left and right, which effectively opens my margins up. Another thing I need to do is pass a role="8pt" or role="7pt" attribute that will shrink the font size down on those elements for the really long ones. Is that something anyone has done before that could share a sample with me?

Am I even on the right track, or am I making things harder than they need to be?

Thanks in advance!

Eric Nordlund
Customer Documentation and Training
Cray Inc.
901 5th Ave
Seattle, WA 98164
(206)701-2232



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]