-
Notifications
You must be signed in to change notification settings - Fork 9
Bookmap Copyright Info
Template containing XSLT extensions that can transfer meta information specified in the DITA map to the WebHelp Responsive footer.
Suppose you want to customize the WebHelp Responsive pages by adding information about the legal rights associated with the book in the footer (for example, copyright dates and owner).
For this template to achieve its purpose, the following information needs to be specified in the bookmap:
<bookrights>
<copyrfirst>
<year>2002</year>
</copyrfirst>
<copyrlast>
<year>2017</year>
</copyrlast>
<bookowner>
<organization>SyncRO Soft SRL</organization>
</bookowner>
</bookrights>
In order to modify the content of the footer section, first we need to identify the XSLT template that generates this compoent.
We will use the XSLT stylesheet that generates the main page as a starting point. It is located in: DITA-OT-DIR\plugins\com.oxygenxml.webhelp.responsive\xsl\mainFiles\createMainPage.xsl
. This XSLT stylesheet declares the copy_template
mode that processes the main page template to expand its components.
The main page template declares a component for the footer section that looks like this:
<div class=" footer-container text-center ">
<whc:include_html href="${webhelp.fragment.footer}"/>
</div>
The extension stylesheet will add a template that matches this component. It applies the default processing and adds the copyright information at the end.
<xsl:template match="*:div[contains(@class, 'footer-container')]" mode="copy_template">
<!-- Apply the default processing -->
<xsl:next-match/>
<!-- Add a div containing the copyright information -->
<div class="copyright_info">
<xsl:choose>
<!-- Adds the start-end years if they are defined -->
<xsl:when
test="
exists($toc/*:topicmeta/*:bookrights/*:copyrfirst) and
exists($toc/*:topicmeta/*:bookrights/*:copyrlast)">
<span class="copyright_years"> ©<xsl:value-of
select="$toc/*:topicmeta/*:bookrights/*:copyrfirst"/> -<xsl:value-of
select="$toc/*:topicmeta/*:bookrights/*:copyrlast"/>
</span>
</xsl:when>
<!-- Adds only the first year if last is not defined. -->
<xsl:when test="exists($toc/*:topicmeta/*:bookrights/*:copyrfirst)">
<span class="copyright_years"> ©<xsl:value-of
select="$toc/*:topicmeta/*:bookrights/*:copyrfirst"/>
</span>
</xsl:when>
</xsl:choose>
<xsl:if test="exists($toc/*:topicmeta/*:bookrights/*:bookowner/*:organization)">
<span class="organization">
<xsl:text> </xsl:text>
<xsl:value-of select="$toc/*:topicmeta/*:bookrights/*:bookowner/*:organization"/>
<xsl:text>. All rights reserved.</xsl:text>
</span>
</xsl:if>
</div>
</xsl:template>
The Publishing Template descriptor file contributes the extension stylesheet on the available XSLT extension points.
<publishing-template>
<name>Bookmap Copyright Info</name>
<!-- .... -->
<webhelp>
<!-- .... -->
<xslt>
<extension file="xslt/copyright-info.xsl" id="com.oxygenxml.webhelp.xsl.createMainPage"/>
<extension file="xslt/copyright-info.xsl" id="com.oxygenxml.webhelp.xsl.dita2webhelp"/>
<extension file="xslt/copyright-info.xsl" id="com.oxygenxml.webhelp.xsl.createSearchPage"/>
<extension file="xslt/copyright-info.xsl" id="com.oxygenxml.webhelp.xsl.createIndexTermsPage"/>
</xslt>
<!-- .... -->
</webhelp>
</publishing-template>
- dita/it-book/ - Contains the DITA map sample that can be published using this template
-
templates/bookmap-copyright-info/ - The Bookmap Copyright Info Publishing Template package (read more about the package contents)
- resources/images - Contains the background images used in this template.
- resources/xslt - Contains the XSLT extension files.
- oxygen.css - The base CSS that defines the styles of the WebHelp output
- oxygen-tiles.png - Preview image.
- bookmap-copyright.opt - The Publishing Template descriptor file
- Open the
dita/it-book/taskbook.ditamap
DITA map in the DITA Maps Manager view - Open the Configure Transformation Scenario(s) dialog
- Duplicate the DITA Map WebHelp Responsive built-in transformation scenario
- Select the Bookmap Copyright Info template
- Click OK to save the scenario
- Apply the transformation scenario to publish the DITA map to WebHelp Responsive format.