More Resources
Table of Contents
More Resources
Editing the Cover Page Template

Edit the custom-xsl.xsl to add an image to the cover page.
You want to add a header template to the custom-xsl.xsl file (located in cfg/fo/xsl/).
  1. To change the appearance of the cover page, you need to modify the createFrontMatter_1.0 template:

    Step Information
    < xsl:template name="createFrontMatter_1.0"> 
      < fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count"> 
        < xsl:call-template name="insertFrontMatterStaticContents"/> 
        < fo:flow flow-name="xsl-region-body"> 
          < fo:block xsl:use-attribute-sets="__frontmatter"> 
            < !-- set the title --> 
            < fo:block xsl:use-attribute-sets="__frontmatter__title"> 
              < xsl:choose> 
                < xsl:when test="$map/*[contains(@class,' topic/title ')][1]"> 
                  < xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"> 
                  < xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="//*[contains(@class, ' map/map ')]/@title"> 
                  < xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/> 
                < /xsl:when> 
                < xsl:otherwise> 
                  < xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/> 
                < /xsl:otherwise> 
              < /xsl:choose> 
            < /fo:block> 
    
            < !-- set the subtitle --> 
            < xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/> 
    
            < fo:block xsl:use-attribute-sets="__frontmatter__owner"> 
              < xsl:apply-templates select="$map//*[contains(@class,' bookmap/bookmeta ')]"/> 
            < /fo:block> 
          < /fo:block> 		
        < /fo:flow> 
      < /fo:page-sequence> 
      < xsl:if test="not($retain-bookmap-order)"> 
        < xsl:call-template name="createNotices"/> 
      < /xsl:if> 
    < /xsl:template> 

  2. Build the fo:block-container that contains the image that you want:

    Step Information
    < fo:block-container xsl:use-attribute-sets="__coverImage"> 
      < fo:block> 
        < fo:external-graphic src="url(Customization/OpenTopic/common/artwork/[image.name])"/> 
      < /fo:block> 
    < /fo:block-container> 
    Note:This code assume that your image file (named [image.name]) is located in the cfg/common/artwork folder.

  3. Add the fo:block-container above the title:

    Expected Result
    < xsl:template name="createFrontMatter_1.0"> 
      < fo:page-sequence master-reference="front-matter" xsl:use-attribute-sets="__force__page__count"> 
        < xsl:call-template name="insertFrontMatterStaticContents"/> 
        < fo:flow flow-name="xsl-region-body"> 
          < fo:block xsl:use-attribute-sets="__frontmatter"> 
    
            < !-- cover image --> 
            < fo:block-container xsl:use-attribute-sets="__coverImage"> 
              < fo:block> 
               < fo:external-graphic src="url(Customization/OpenTopic/common/artwork/[image.name])"/> 
              < /fo:block> 
            < /fo:block-container> 
    
            < !-- set the title --> 
            < fo:block xsl:use-attribute-sets="__frontmatter__title"> 
              < xsl:choose> 
                < xsl:when test="$map/*[contains(@class,' topic/title ')][1]"> 
                  < xsl:apply-templates select="$map/*[contains(@class,' topic/title ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"> 
                  < xsl:apply-templates select="$map//*[contains(@class,' bookmap/mainbooktitle ')][1]"/> 
                < /xsl:when> 
                < xsl:when test="//*[contains(@class, ' map/map ')]/@title"> 
                  < xsl:value-of select="//*[contains(@class, ' map/map ')]/@title"/> 
                < /xsl:when> 
                < xsl:otherwise> 
                  < xsl:value-of select="/descendant::*[contains(@class, ' topic/topic ')][1]/*[contains(@class, ' topic/title ')]"/> 
                < /xsl:otherwise> 
              < /xsl:choose> 
            < /fo:block> 
    
            < !-- set the subtitle --> 
            < xsl:apply-templates select="$map//*[contains(@class,' bookmap/booktitlealt ')]"/> 
    
            < fo:block xsl:use-attribute-sets="__frontmatter__owner"> 
              < xsl:apply-templates select="$map//*[contains(@class,' bookmap/bookmeta ')]"/> 
            < /fo:block> 
          < /fo:block> 		
        < /fo:flow> 
      < /fo:page-sequence> 
      < xsl:if test="not($retain-bookmap-order)"> 
        < xsl:call-template name="createNotices"/> 
      < /xsl:if> 
    < /xsl:template> 

You edited the cover page template in the custom-xsl.xsl file located in cfg/fo/xsl/.
Your cover page template contains a new attribute-set, which you need to define using the procedure in Adding Cover Page Attributes.