Reputation: 97348
I have a docBook 4.4 XML file which is a user guide. I can use the (Maven) tools to convert that to HTML, PDF no problem. The problem i have is to insert an small HTML code snippet into the resulting HTML file.
I would like to add the following HTML snippet:
<xsl:template name="xxxxxxx">
<img src="images/pdfdoc.gif">PDF</img>
</xsl:template>
The resulting HTML code looks like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="./hilfeKMV.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.0">
<meta name="date" content="10/12/2011">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div lang="de" class="book"
title="Title">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="d0e1"></a>title
</h1>
</div>
</div>
<hr>
</div>
<div class="toc">
<p>
<b>TOC</b>
</p>
I would like to insert the HTML snippet before the <div class="toc">
...So the question is how to solve this? I'm using docbook 1.76.0
I think there must be something like the following to solve that but i don't know how to set call-template etc. ?
<xsl:template name="xxxxxxx">
<xsl:variable name="top-anchor">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="/*[1]"/>
</xsl:call-template>
</xsl:variable>
<img src="images/pdfdoc.gif">PDF</img>
</xsl:template>
Upvotes: 1
Views: 458
Reputation: 97348
I have found the correct location to insert the code i need. In the titlepage.templates.xsl file i found the correct solution. I just taken the snippet from the titlepage.templates.xsl and enhanced it like the following:
<xsl:template name="book.titlepage.separator">
<div class="subsubtile">
<div class="pdflink">
<a href="./xxxx.pdf" title="Hilfeseite als PDF-Dokument">
<img src="images/pdfdoc.gif" border="0" alt="Hilfeseite als PDF-Dokument" />
<br />
PDF
</a>
</div>
</div>
<hr/>
</xsl:template>
Upvotes: 1
Reputation: 50947
The <div class="toc">
element is generated by the template named "make.toc", which is called by "division.toc" (in autotoc.xsl). In order to output something immediately before this <div>
, you can override the "division.toc" template in your customization layer. Just copy the original template and add your code, like this:
<xsl:template name="division.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<img src="images/pdfdoc.gif" alt="PDF"/> <!-- Your stuff here -->
<xsl:call-template name="make.toc">
...
...
</xsl:call-template>
</xsl:template>
Upvotes: 1