Table of Contents
More Resources
Adding Header Attributes

Define attribute-sets so that your header appears as expected.
prereq
Before you can add new attribute-sets, you must add a header template using the procedure in Editing a Header Template.  
context

While editing a header template, you added new attribute-sets. You need to define these attribute sets in the custom-attrs.xsl file (located in cfg/fo/attrs/) for your header to display correctly. Below we have sample attribute sets for the examples that we outlined in Editing a Header Template, however if you have used other ones, be sure to specify them as well. 

  1. The first attribute set that you need to add is “odd__header”. Below is a sample of some attributes that you may like, however feel free to add or remove any in order to change the styling of the header.

    Step Information
    < xsl:attribute-set name="odd__header"> 
      < xsl:attribute name="font-family"> sans-serif< /xsl:attribute> 
      < xsl:attribute name="font-size"> 10pt< /xsl:attribute> 
      < xsl:attribute name="font-weight"> normal< /xsl:attribute> 
      < xsl:attribute name="color"> black< /xsl:attribute> 
      < xsl:attribute name="margin-left"> 
        < xsl:value-of select="$page-margins"/> 
      < /xsl:attribute> 
      < xsl:attribute name="margin-right"> 
        < xsl:value-of select="$page-margins"/> 
      < /xsl:attribute> 
      < xsl:attribute name="padding-top"> 0px< /xsl:attribute> 
    < /xsl:attribute-set> 
    You may notice that in the custom-xsl.xsl file, we used the “__body__odd__header” attribute set, not the “odd__header” attribute set. However, because the “__body__odd__header” attribute set inherits all the attributes from “odd__header”, and “odd__header” is used more generally, it is more useful to edit this attribute set.
  2. If you’re using a header image, you need to create the “__header__image” attribute set. Below are some attribute settings that you can use to place the image in the top left hand corner of the header.

    Step Information
    < xsl:attribute-set name="__header__image"> 
      < xsl:attribute name="top"> 20pt< /xsl:attribute> 
      < xsl:attribute name="position"> absolute< /xsl:attribute> 
      < xsl:attribute name="left"> 
        < xsl:value-of select="$page-margins"/> 
      < /xsl:attribute> 
      < xsl:attribute name="text-align"> start< /xsl:attribute> 
    < /xsl:attribute-set> 
  3. Add the attribute sets for any of the other blocks or block-containers that you added in the Editing a Header Template guide. For example, if you added multiple lines of text in the header.

    Step Information
    Important:You must create an < xsl:attribute-set/> element for each attribute set referenced in your custom-xsl.xsl file or else the DITA-OT will display an error. So even if some of them are empty, make sure you have created them all.
    Here is a list of potentially useful attributes that you can use to format your header:

    • Text:
      • font-family
        • Supports serif, sans-serif, Helvetica, Times, Courier, Symbol, ZapfDingbats
      • font-size
      • font-weight
      • text-align
        • Supports left, right, center, justify
    • Borders:
      • border-before-style
        • Supports none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset
      • border-before-width
        • Specify a width for the top border in any units
      • border-before-color
      • Along with the same three options for border-after-, border-start-, border-end-
    • Spacing
      • padding-top, padding-bottom, padding-right, padding-left
      • margin-top, margin-bottom, margin-right, margin-left
result
You’re ready to publish with your new header. Here are some examples of various outputs:
Using the header image with attributes set in Step 2 and the document title with the text-align attribute set to “center”:
Using the multiple lines of text option explained in Step 5 in Editing a Header Template, changing the font-family to serif, adjusting the font-size and the spacing, and adding border-after attributes to the second line: