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] section titles inline


This is similar to a formalpara but with a big difference.  A formalpara has
a strict structure that permits only a single para after the title.  A sect3
permits anything after the title.  So the complication is when you say
"usually a para".  If it is not a para, then it should probably not be a
run-in.

Here is a customization that accomplishes this.  The select statements are
complicated because it only applies when the first element after the sect3
title is a para.


<xsl:template name="sect3.titlepage">
  <fo:block xsl:use-attribute-sets="normal.para.spacing">
    <!-- select and process the title in a new mode here -->
    <xsl:apply-templates select="title" mode="inline.title"/>
    <xsl:text>: </xsl:text>
    <!-- select and process the following para in a new mode here -->
    <xsl:apply-templates select="para[preceding-sibling::*[1][self::title]]"
                         mode="inline.para"/>
  </fo:block>
</xsl:template>

<!-- Define whatever inline formatting properties you want here -->
<xsl:attribute-set name="inline.sect3.title.properties">
  <xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>

<!-- Process the following para by processing all of its children, which
prevents it
       from forming its own fo:block as a normal para does -->
<xsl:template match="sect3/para[preceding-sibling::*[1][self::title]]"
              mode="inline.para">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="sect3/para[preceding-sibling::*[1][self::title]]">
  <!-- Turn off normal processing of this para so it doesn't repeat when the
          sect3 template does apply-templates -->
</xsl:template>

<!-- Format the inline title in this mode -->
<xsl:template match="sect3/title" mode="inline.title">
    <fo:inline xsl:use-attribute-sets="inline.sect3.title.properties">
      <xsl:apply-templates/>
    </fo:inline>
</xsl:template>

The select="para[preceding-sibling::*[1][self::title]]" attribute translates
to "take a para element, look at its preceding-sibling elements, take the
first one, and use the para only if that first preceding-sibling is a title
element".


Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Bill Lawrence" <lawrence@mayaviz.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, June 01, 2005 7:03 AM
Subject: [docbook-apps] section titles inline


> I'm trying to implement FO customizations to output in MIL-STD-38784
> style, and I'm struggling with making third level section titles, and
> lower, have the titles inline with the following element (usually a
> para) .  Any help would be greatly appreciated.
>
> Thanks,
>
> Bill Lawrence
>
> ---------------------------------------------------------------------
> 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]