[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Section Orientation in Docbook
|
Good afternoon list, I realise that the issue I am about to speak about has had a few posts on the mailing list, some from me in the past, however whereas I managed to get things working in the past I have managed to break it again and I cannot get it working again. I am using the Apache FOP processor which does not support the 'reference-orientation' setting. I have got David Crane's PSMI XSL file and whilst I have tried to modify this so that things like: <sect1 orient='land'> and <?landscape?> should work, it does not. In the first of these examples I get the error: '... flow must be child of page sequence and, not http://www.cranesoftwrights.com/resources/psmi:page-sequence' and in the second nothing seems to happen at all. This is really frustrating and I am at a loss to work out how I did it before. I think I maybe able to get around this by changing the page master so that the width and height for an A4 sheet are transposed, but I am not sure how to set this. I have attached a copy of my customisation layer for people to look at. If anyone has any pointers whatsoever I would be most grateful. Thanks very much, Russell Seymour |
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:psmi="http://www.CraneSoftwrights.com/resources/psmi"
exclude-result-prefixes="psmi"
version="1.0">
<xsl:import href="/usr/share/sgml/docbook/xsl-stylesheets-1.66.1/fo/docbook.xsl" />
<!-- Ensure use of Corporate titlepage XSL -->
<xsl:import href="/usr/local/www/docbook/custom/titlepage.xsl" />
<!-- Page Setup -->
<!-- Paper Size -->
<xsl:param name="paper.type" select="'A4'"/>
<!-- Margins -->
<xsl:param name="page.margin.inner">20mm</xsl:param>
<xsl:param name="page.margin.outer">20mm</xsl:param>
<xsl:param name="title.margin.left">0pc</xsl:param>
<!-- Enable bookmarks -->
<xsl:param name="fop.extensions" select="1"/>
<!-- turn off draft mode -->
<xsl:param name="draft.mode" select="no"/>
<!-- Turn off the header rule -->
<xsl:param name="header.rule" select="0"></xsl:param>
<!-- <?custom-pagebreak?> inserts a page break at this point -->
<xsl:template match="processing-instruction('custom-pagebreak')">
<fo:block break-before='page'/>
</xsl:template>
<!-- <?custom-linebreak?> insert a linebreak at this point -->
<xsl:template match="processing-instruction('custom-linebreak')">
<fo:block></fo:block>
</xsl:template>
<!-- Set the colour of the table header cells -->
<xsl:template match="thead">
<xsl:variable name="tgroup" select="parent::*"/>
<fo:table-header>
<!-- ADD THESE TWO PROPERTIES -->
<xsl:attribute name="background-color">#008080</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="color">white</xsl:attribute>
<xsl:apply-templates select="row[1]">
<xsl:with-param name="spans">
<xsl:call-template name="blank.spans">
<xsl:with-param name="cols" select="../@cols"/>
</xsl:call-template>
</xsl:with-param>
</xsl:apply-templates>
</fo:table-header>
</xsl:template>
<!-- Layout the title page -->
<xsl:template name="article.titlepage.recto">
<fo:block>
<fo:table width='90%'>
<fo:table-column column-width='100%'/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before" text-align="right">
<fo:block>
<fo:external-graphic src="url(/usr/local/www/conf/logo.gif)" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height='35mm'>
<fo:table-cell display-align="center">
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/title"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height='45mm'>
<fo:table-cell display-align="center">
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/address"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height='45mm'>
<fo:table-cell display-align="center" border-bottom='solid black 1pt' border-top='solid black 1pt'>
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/subtitle"/>
</fo:block>
<fo:block />
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/mediaobject"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height='25mm'>
<fo:table-cell display-align="center">
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/date"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height='25mm'>
<fo:table-cell display-align="center" text-align='left'>
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/abstract"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height='25mm'>
<fo:table-cell display-align="after">
<fo:block>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/author"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
<!-- Set up the headers and footers -->
<!-- Header -->
<xsl:template name="header.content">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="position" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<xsl:variable name="candidate">
<xsl:choose>
<xsl:when test="($sequence = 'odd' or $sequence = 'even') and $position = 'right'">
<fo:external-graphic src="url(/usr/local/www/conf/logo.gif)" height="0.3in"/>
</xsl:when>
<xsl:when test="($sequence = 'odd' or $sequence = 'even') and $position = 'left'">
<fo:retrieve-marker retrieve-class-name="section.head.marker"
retrieve-position="first-including-carryover"
retrieve-boundary="page-sequence"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<!-- Output the header -->
<xsl:copy-of select="$candidate"/>
</xsl:template>
<!-- Set the font for the footer -->
<xsl:attribute-set name="footer.content.properties">
<xsl:attribute name="font-family">Arial</xsl:attribute>
<xsl:attribute name="font-size">8pt</xsl:attribute>
</xsl:attribute-set>
<xsl:template name="footer.content">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="position" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<xsl:variable name="candidate_footer">
<xsl:choose>
<xsl:when test="($sequence = 'odd' or $sequence = 'even') and $position = 'left'">
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</xsl:when>
<xsl:when test="($sequence = 'odd' or $sequence = 'even') and $position = 'center'">
</xsl:when>
<xsl:when test="($sequence = 'odd' or $sequence = 'even') and $position = 'right'">
<fo:page-number />
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:copy-of select="$candidate_footer"/>
</xsl:template>
<xsl:template name="head.sep.rule">
<xsl:if test="$header.rule != 0">
<xsl:attribute name="border-bottom-width">3pt</xsl:attribute>
<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
<xsl:attribute name="border-bottom-color">#008000</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="foot.sep.rule">
<xsl:if test="$footer.rule != 0">
<xsl:attribute name="border-top-width">1pt</xsl:attribute>
<xsl:attribute name="border-top-style">solid</xsl:attribute>
<xsl:attribute name="border-top-color">#000080</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- Test what the orientation should be for the section -->
<xsl:template match="*[(@orient='land' or ./processing-instruction('landscape')) and (parent::chapter or parent::article or (parent::appendix and ancestor::book))]" priority="200">
<psmi:page-sequence master-reference="body-landscape">
<fo:flow flow-name="region-body-landscape">
<xsl:apply-imports/>
</fo:flow>
</psmi:page-sequence>
</xsl:template>
<xsl:template match="*[(@orient='land' or ./processing-instruction('landscape'))]">
<xsl:message>
<xsl:text disable-output-escaping="yes">
Note: psmi not supported elements that are not direct descendants of
article, chapter, or appendix. An in this document with orient='land' or
<?landscape?> will not be flagged for landscaping through psmi.
</xsl:text>
</xsl:message>
<xsl:apply-imports/>
</xsl:template>
<xsl:template name="user.pagemasters">
<fo:simple-page-master master-name="body-landscape-odd"
page-width="{$page.height}"
page-height="{$page.width}"
margin-top="{$page.margin.top}"
margin-bottom="{$page.margin.bottom}"
margin-left="{$page.margin.inner}"
margin-right="{$page.margin.outer}">
<fo:region-body
region-name="region-body-landscape"
margin-bottom="1in"
reference-orientation="90deg"
margin-top="1in"
column-count="{$column.count.body}">
</fo:region-body>
<fo:region-before region-name="xsl-region-before-odd"
extent="{$region.before.extent}"
display-align="before"/>
<fo:region-after region-name="xsl-region-after-odd"
extent="{$region.after.extent}"
display-align="after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="body-landscape-even"
page-width="{$page.height}"
page-height="{$page.width}"
margin-top="{$page.margin.top}"
margin-bottom="{$page.margin.bottom}"
margin-left="{$page.margin.inner}"
margin-right="{$page.margin.outer}">
<fo:region-body
region-name="region-body-landscape"
margin-bottom="1in"
reference-orientation="90deg"
margin-top="1in"
column-count="{$column.count.body}">
</fo:region-body>
<fo:region-before region-name="xsl-region-before-even"
extent="{$region.before.extent}"
display-align="before"/>
<fo:region-after region-name="xsl-region-after-even"
extent="{$region.after.extent}"
display-align="after"/>
</fo:simple-page-master>
<!-- setup for body pages -->
<fo:page-sequence-master master-name="body-landscape">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="body-landscape-odd"
odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="body-landscape-even"
odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</xsl:template>
<!-- Ensure that the first section starts on a new page after the contents -->
<xsl:attribute-set name="section.level1.properties">
<xsl:attribute name="break-before">page</xsl:attribute>
</xsl:attribute-set>
<!-- Set the figure labels to be after the object they represent -->
<xsl:param name="formal.title.placement">
figure after
example before
equation after
table after
procedure before
</xsl:param>
<!-- Set the Font for the document -->
<xsl:param name="body.font.family">Arial</xsl:param>
</xsl:stylesheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]