List Info

Thread: How do I center text?




How do I center <bridgehead> text?
user name
2007-09-10 13:15:48
[I'm redirecting this to the docbook-apps mailing list where
such questions 
are usually handled]

The bridgehead template calls the same
"section.heading" template that is 
used by other section titles.  You can customize it for
centering 
bridgeheads as follows:

<xsl:template name="section.heading">
  <xsl:param name="level"
select="1"/>
  <xsl:param name="marker"
select="1"/>
  <xsl:param name="title"/>
  <xsl:param name="marker.title"/>

  <fo:block
xsl:use-attribute-sets="section.title.properties"&
gt;
    <xsl:if test="$marker != 0">
      <fo:marker
marker-class-name="section.head.marker">
        <xsl:copy-of
select="$marker.title"/>
      </fo:marker>
    </xsl:if>

    <xsl:choose>
      <xsl:when test="$level=1">
        <fo:block
xsl:use-attribute-sets="section.title.level1.properties
">
          <xsl:if test="self::bridgehead">
            <xsl:attribute
name="text-align">center</xsl:attribute>
          </xsl:if>
          <xsl:copy-of select="$title"/>
        </fo:block>
      </xsl:when>
      <xsl:when test="$level=2">
        <fo:block
xsl:use-attribute-sets="section.title.level2.properties
">
          <xsl:if test="self::bridgehead">
            <xsl:attribute
name="text-align">center</xsl:attribute>
          </xsl:if>
          <xsl:copy-of select="$title"/>
        </fo:block>
      </xsl:when>
      <xsl:when test="$level=3">
        <fo:block
xsl:use-attribute-sets="section.title.level3.properties
">
          <xsl:if test="self::bridgehead">
            <xsl:attribute
name="text-align">center</xsl:attribute>
          </xsl:if>
          <xsl:copy-of select="$title"/>
        </fo:block>
      </xsl:when>
      <xsl:when test="$level=4">
        <fo:block
xsl:use-attribute-sets="section.title.level4.properties
">
          <xsl:if test="self::bridgehead">
            <xsl:attribute
name="text-align">center</xsl:attribute>
          </xsl:if>
          <xsl:copy-of select="$title"/>
        </fo:block>
      </xsl:when>
      <xsl:when test="$level=5">
        <fo:block
xsl:use-attribute-sets="section.title.level5.properties
">
          <xsl:if test="self::bridgehead">
            <xsl:attribute
name="text-align">center</xsl:attribute>
          </xsl:if>
          <xsl:copy-of select="$title"/>
        </fo:block>
      </xsl:when>
      <xsl:otherwise>
        <fo:block
xsl:use-attribute-sets="section.title.level6.properties
">
          <xsl:if test="self::bridgehead">
            <xsl:attribute
name="text-align">center</xsl:attribute>
          </xsl:if>
          <xsl:copy-of select="$title"/>
        </fo:block>
      </xsl:otherwise>
    </xsl:choose>
  </fo:block>
</xsl:template>
</xsl:stylesheet>

For each section level, after starting an fo:block with the
section level 
properties, it tests to see if the current context element
is a bridgehead, 
and if so, adds a text-align="center" property.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


  ----- Original Message ----- 
  From: Sheldon Plankton
  To: docbooklists.oasis-open.org
  Sent: Monday, September 10, 2007 9:07 AM
  Subject: [docbook] How do I center <bridgehead>
text?


  I am using docbook to generate PDFs.  I was wondering if
anyone could 
help customize a style sheet that would center the text of
my bridgehead 
templates?  Do I need to make and modifiy a copy of the
bridgehead template 
or should I modify the title template or a <sectN>
template and use my the 
renderas attribute with my bridgehead template?  Thanks!

  BTW.  I hope this is not a cross post as I thought I had
sent this email 
yesterday but I only got a OOO response from someone at
Transitive ???



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )