10. Customizing the XSLT style sheets used in the Convert Document submenu

In order to do this, you need to use a custom XSLT style sheet instead of the stock one. Of course, the custom XSLT style sheet includes the stock one, so you can concentrate on your customizations.

Once you have created your custom XSLT style sheet, you have to specify to XXE that it must use it instead on the stock one. This is done by the means of a system property having the proper name and value.

  1. Copy one of the following template files depending on which configuration you want to customize and on which format you want to generate:

    Configuration NameConvert toProcedure

    DITA

    DITA Map

    DITA BookMap

    XHTML multi-page

    Copy xhtml.xsl to custom/.

    XHTML single page

    Copy xhtml.xsl to custom/.

    HTML Help

    Copy htmlhelp.xsl to custom/.

    Java Help

    Copy javahelp.xsl to custom/.

    Eclipse Help

    Copy eclipsehelp.xsl to custom/.

    Web Help

    Copy webhelp.xsl to custom/.

    EPUB

    Copy epub.xsl to custom/.

    RTF, WordprocessingML, OpenDocument, OOXML

    Copy fo.xsl to custom/.

    PDF, PostScript

    Copy fo.xsl to custom/.

    DocBook v5+

    DocBook v5.1+[a]

    DocBook Assembly v5.1+[a]

    HTML multi-page

    Copy chunk.xsl to custom/.

    HTML single page

    Copy html.xsl to custom/.

    HTML Help

    Copy htmlhelp.xsl to custom/.

    Java Help

    Copy javahelp.xsl to custom/.

    Eclipse Help

    Copy eclipse.xsl to custom/.

    Web Help

    Copy webhelp.xsl to custom/.

    EPUB

    Copy epub.xsl to custom/.

    RTF, WordprocessingML, OpenDocument, OOXML

    Copy fo.xsl to custom/.

    PDF, PostScript

    Copy fo.xsl to custom/.

    DocBook

    HTML multi-page

    Copy chunk.xsl to custom/.

    HTML single page

    Copy html.xsl to custom/.

    HTML Help

    Copy htmlhelp.xsl to custom/.

    Java Help

    Copy javahelp.xsl to custom/.

    Eclipse Help

    Copy eclipse.xsl to custom/.

    Web Help

    Copy webhelp.xsl to custom/.

    EPUB

    Copy epub.xsl to custom/.

    RTF, WordprocessingML, OpenDocument, OOXML

    Copy fo.xsl to custom/.

    PDF, PostScript

    Copy fo.xsl to custom/.

    XHTML Strict

    XHTML Transitional

    XHTML 1.1

    XHTML 5

    RTF, WordprocessingML, OpenDocument, OOXML

    Copy fo.xsl to custom/.

    PDF, PostScript

    Copy fo.xsl to custom/.

    [a] DocBook v5+, DocBook v5.1+ and DocBook Assembly v5.1+ documents are converted using the same set of XSL style sheets.

    For example, DocBook v5+ chunk.xsl looks like this:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:d="http://docbook.org/ns/docbook"
                    version="1.0"
                    exclude-result-prefixes="d">
    
      <xsl:import href="docbook5-config:xsl/html/chunk.xsl"/>
    
    </xsl:stylesheet>
  2. Edit this file using an XML or text editor and add one or more XSLT elements after the xsl:import element.

    DocBook html.xsl example: Use the UTF-8 encoding instead of default ISO-8859-1 when converting a DocBook document to single page HTML[6]:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    version="1.0">
    
      <xsl:import href="docbook-config:xsl/html/docbook.xsl"/>
    
      <xsl:output method="html" 
                  encoding="UTF-8"
                  indent="no" 
                  saxon:character-representation="native;decimal"/>
    </xsl:stylesheet>

    DocBook fo.xsl example: add more information to the title page of book:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:fo="http://www.w3.org/1999/XSL/Format"
                    version="1.0">
    
    <xsl:import href="docbook-config:xsl/fo/docbook.xsl"/>
    
    <xsl:template match="bookinfo/author|info/author" mode="titlepage.mode">
      <fo:block>
        <xsl:call-template name="anchor"/>
        <xsl:call-template name="person.name"/>
        <xsl:if test="affiliation/orgname">
          <fo:block>
            <xsl:apply-templates select="affiliation/orgname"
                                 mode="titlepage.mode"/>
          </fo:block>
        </xsl:if>
        <xsl:if test="email|affiliation/address/email">
          <fo:block>
            <xsl:apply-templates select="(email|affiliation/address/email)[1]"/>
          </fo:block>
        </xsl:if>
      </fo:block>
    </xsl:template>
    
    </xsl:stylesheet>
  3. Add one of the following property configuration element to your custom .xxe file:

    Configuration NameConvert toProperty Configuration Element

    DITA

    DITA Map

    DITA BookMap

    XHTML multi-page

    <property name="dita.toXHTML.transform"
      url="true">xhtml.xsl</property>
    XHTML single page
    <property name="dita.toXHTML1.transform" 
      url="true">xhtml.xsl</property>
    HTML Help
    <property name="dita.toHTMLHelp.transform" 
      url="true">htmlhelp.xsl</property>
    Java Help
    <property name="dita.toJavaHelpStep1.transform" 
      url="true">javahelp.xsl</property>
    Eclipse Help
    <property name="dita.toEclipseHelp.transform" 
      url="true">eclipsehelp.xsl</property>
    Web Help
    <property name="dita.toWebHelp.transform" 
      url="true">webhelp.xsl</property>
    EPUB
    <property name="dita.toEPUB.transform" 
      url="true">epub.xsl</property>
    RTF, WordprocessingML, OpenDocument, OOXML
    <property name="dita.toRTF.transform" 
      url="true">fo.xsl</property>
    PDF, PostScript
    <property name="dita.toPS.transform" 
      url="true">fo.xsl</property>

    DocBook Assembly v5.1+

    HTML multi-page

    <property name="asm.toHTML.transform"
      url="true">chunk.xsl</property>
    HTML single page
    <property name="asm.toHTML1.transform" 
      url="true">html.xsl</property>
    HTML Help
    <property name="asm.toHTMLHelp.transform" 
      url="true">htmlhelp.xsl</property>
    Java Help
    <property name="asm.toJavaHelpStep1.transform" 
      url="true">javahelp.xsl</property>
    Eclipse Help
    <property name="asm.toEclipseHelp.transform" 
      url="true">eclipse.xsl</property>
    Web Help
    <property name="asm.toWebHelp.transform" 
      url="true">webhelp.xsl</property>
    EPUB
    <property name="asm.toEpub.transform" 
      url="true">epub.xsl</property>
    RTF, WordprocessingML, OpenDocument, OOXML
    <property name="asm.toRTF.transform" 
      url="true">fo.xsl</property>
    PDF, PostScript
    <property name="asm.toPS.transform" 
      url="true">fo.xsl</property>

    DocBook v5.1+

    HTML multi-page

    <property name="db51.toHTML.transform"
      url="true">chunk.xsl</property>
    HTML single page
    <property name="db51.toHTML1.transform" 
      url="true">html.xsl</property>
    HTML Help
    <property name="db51.toHTMLHelp.transform" 
      url="true">htmlhelp.xsl</property>
    Java Help
    <property name="db51.toJavaHelpStep1.transform" 
      url="true">javahelp.xsl</property>
    Eclipse Help
    <property name="db51.toEclipseHelp.transform" 
      url="true">eclipse.xsl</property>
    Web Help
    <property name="db51.toWebHelp.transform" 
      url="true">webhelp.xsl</property>
    EPUB
    <property name="db51.toEpub.transform" 
      url="true">epub.xsl</property>
    RTF, WordprocessingML, OpenDocument, OOXML
    <property name="db51.toRTF.transform" 
      url="true">fo.xsl</property>
    PDF, PostScript
    <property name="db51.toPS.transform" 
      url="true">fo.xsl</property>

    DocBook v5+

    HTML multi-page

    <property name="db5.toHTML.transform"
      url="true">chunk.xsl</property>
    HTML single page
    <property name="db5.toHTML1.transform" 
      url="true">html.xsl</property>
    HTML Help
    <property name="db5.toHTMLHelp.transform" 
      url="true">htmlhelp.xsl</property>
    Java Help
    <property name="db5.toJavaHelpStep1.transform" 
      url="true">javahelp.xsl</property>
    Eclipse Help
    <property name="db5.toEclipseHelp.transform" 
      url="true">eclipse.xsl</property>
    Web Help
    <property name="db5.toWebHelp.transform" 
      url="true">webhelp.xsl</property>
    EPUB
    <property name="db5.toEpub.transform" 
      url="true">epub.xsl</property>
    RTF, WordprocessingML, OpenDocument, OOXML
    <property name="db5.toRTF.transform" 
      url="true">fo.xsl</property>
    PDF, PostScript
    <property name="db5.toPS.transform" 
      url="true">fo.xsl</property>

    DocBook

    HTML multi-page

    <property name="docb.toHTML.transform" 
      url="true">chunk.xsl</property>
    HTML single page
    <property name="docb.toHTML1.transform" 
      url="true">html.xsl</property>
    HTML Help
    <property name="docb.toHTMLHelp.transform" 
      url="true">htmlhelp.xsl</property>
    Java Help
    <property name="docb.toJavaHelpStep1.transform" 
      url="true">javahelp.xsl</property>
    Eclipse Help
    <property name="docb.toEclipseHelp.transform" 
      url="true">eclipse.xsl</property>
    Web Help
    <property name="docb.toWebHelp.transform" 
      url="true">webhelp.xsl</property>
    EPUB
    <property name="docb.toEpub.transform" 
      url="true">epub.xsl</property>
    RTF, WordprocessingML, OpenDocument, OOXML
    <property name="docb.toRTF.transform" 
      url="true">fo.xsl</property>
    PDF, PostScript
    <property name="docb.toPS.transform" 
      url="true">fo.xsl</property>

    XHTML Strict

    XHTML Transitional

    XHTML 1.1

    XHTML 5

    RTF, WordprocessingML, OpenDocument, OOXML

    <property name="xhtml.toRTF.transform" 
      url="true">fo.xsl</property>
    PDF, PostScript
    <property name="xhtml.toPS.transform" 
      url="true">fo.xsl</property>


[6] XSLT style sheet parameter chunker.output.encoding does not work in this case.