On 11/23/2009 04:03 PM, Paul Morgan wrote:
On Mon, Nov 23, 2009 at 03:52:12PM -0500, Josh Kayse wrote:
I'm attempting to switch our documentation to publican at my workplace
and was wondering if publican supports custom headers/footers on each
page for PDF output or top and bottom of HTML output.  Could I use the
override.css for the HTML output?  We want to include something like "Our
Company" at the top and bottom of each page.
Here's a stylesheet I hacked together that has running footers and
headers. The stylesheet belongs in a "brand" directory, such as
/usr/share/publican/xsl/mybrand/pdf.xsl

hth,
-paul


<snip>

Thanks! That works great. The only problem I'm running in to now is I cannot seem to get the header/footer to show up on the first page. Here's my current version of the pdf.xsl

Thanks!
-josh

<?xml version='1.0'?>

<!--
        Copyright 2009 Red Hat, Inc.
        License: GPL
        Author: Jeff Fearn <[email protected]>
        Author: Tammy Fox <[email protected]>
        Author: Andy Fitzsimon <[email protected]>
        Author: Paul Morgan <[email protected]>
-->

<!DOCTYPE xsl:stylesheet [
<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
 ]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version='1.0'
                xmlns="http://www.w3.org/TR/xhtml1/transitional";
                xmlns:fo="http://www.w3.org/1999/XSL/Format";
                exclude-result-prefixes="#default">

<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/graphics.xsl"/> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/titlepage.templates.xsl"/>
<xsl:import href="../../../xsl/defaults.xsl"/>
<xsl:import href="../../../xsl/pdf.xsl"/>

<xsl:variable name="classification">
<xsl:choose>
<xsl:when test="//book[1]/@security">
<xsl:value-of select="//book[1]/@security"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>NOT CLASSIFIED</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<!-- running header -->
<xsl:param name="header.rule" select="0"/>
<xsl:template name="header.content">
<xsl:param name="position" select="''"/>
<xsl:param name="pageclass" select="''"/>
<xsl:choose>
<xsl:when test="$position='center'">
<fo:block-container
      absolute-position="absolute"
>
<fo:block keep-together.within-line="always" font-weight="bold" color="black" font-size="14pt" text-align="center">
<xsl:value-of select="$classification"/>
</fo:block>
</fo:block-container>
</xsl:when>
</xsl:choose>
</xsl:template>

<!-- running footer -->
<xsl:template name="footer.content">
<xsl:param name="position" select="''"/>
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:choose>
<xsl:when test="$position='center'">
<fo:block-container
      absolute-position="absolute"
      top="0pt"
>
<fo:block text-align="center">Page <fo:page-number/></fo:block>
<fo:block keep-together.within-line="always" font-weight="bold" color="black" font-size="14pt" text-align="center">
<xsl:value-of select="$classification"/>
</fo:block>
</fo:block-container>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

<!-- running footer -->
<xsl:template name="footer.content">
<xsl:param name="position" select="''"/>
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:choose>
<xsl:when test="$position='center'">
<fo:block-container
      absolute-position="absolute"
      top="0pt"
>
<fo:block text-align="center">Page <fo:page-number/></fo:block>
<fo:block keep-together.within-line="always" font-weight="bold" color="black" font-size="14pt" text-align="center">
<xsl:value-of select="$classification"/>
</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="$pageclass = 'titlepage' and $position = 'center'">
<fo:block-container
      absolute-position="absolute"
>
<fo:block keep-together.within-line="always" font-weight="bold" color="black" font-size="14pt" text-align="center">
<xsl:value-of select="$classification"/>
</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="$sequence = 'first' and $position = 'center'">
<fo:block-container
      absolute-position="absolute"
>
<fo:block keep-together.within-line="always" font-weight="bold" color="black" font-size="14pt" text-align="center">
<xsl:value-of select="$classification"/>
</fo:block>
</fo:block-container>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


--
A: No.
Q: Should I include quotations after my reply?

Don't top post: see http://www.caliburn.nl/topposting.html for more.


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
publican-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/publican-list
Wiki: https://fedorahosted.org/publican

Reply via email to