Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2006, 11:01 AM
Registered User
 
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with XSLFO - even/odd pages

Hi all - sorry if this is in the wrong spot, but I couldn't find anything specifically on XSLFO - if anyone knows of a forum or list for XSLFO please let me know.

I've been tinkering with the "dita2fo-shell.xsl" stylesheet that comes with the DITA open toolkit in order to produce a PDF from DITA XML source. I am pasting some of the stylesheet code below - you will see that the book's title and page numbers are printed on the headers and footers for each page, aligned left. Basically, I am trying to get even page numbers to stay aligned left, while odd page numbers should align right. In other words, I need the stylesheet to recognize if it is processing an even or odd page and then call the appropriate template.

<xsl:template name="define-page-masters-dita"> <fo:layout-master-set>
      <fo:page-sequence-master master-name="chapter-master">
        <fo:repeatable-page-master-alternatives>

<fo:conditional-page-master-reference page-position="first" odd-or-even="odd" master-reference="common-page"></fo:conditional-page-master-reference>

<fo:conditional-page-master-reference page-position="first" odd-or-even="even" master-reference="common-page"></fo:conditional-page-master-reference>

<fo:conditional-page-master-reference page-position="rest" odd-or-even="odd" master-reference="common-page"></fo:conditional-page-master-reference>

<fo:conditional-page-master-reference page-position="rest" odd-or-even="even" master-reference="common-page"></fo:conditional-page-master-reference>

        </fo:repeatable-page-master-alternatives>
      </fo:page-sequence-master>

      <fo:simple-page-master master-name="common-page" xsl:use-attribute-sets="common-grid">

        <fo:region-body margin-bottom="36pt" margin-top="12pt"></fo:region-body>

        <fo:region-before extent="12pt"></fo:region-before>

        <fo:region-after extent="24pt"></fo:region-after>

      </fo:simple-page-master>

    </fo:layout-master-set>

  </xsl:template>

  <xsl:template name="generated-frontmatter">

    <fo:page-sequence master-reference="common-page" format="i" initial-page-number="0">

      <fo:static-content flow-name="xsl-region-before">

        <fo:block font-size="8pt" line-height="8pt">

          <xsl:value-of select="$booktitle"></xsl:value-of>

        </fo:block>

      </fo:static-content>

      <fo:static-content flow-name="xsl-region-after">

        <fo:block text-align="left" font-size="10pt" font-weight="bold" font-family="Helvetica">

          <fo:page-number></fo:page-number>

        </fo:block>

      </fo:static-content>

      <fo:flow flow-name="xsl-region-body">

        <fo:block line-height="12pt" font-size="10pt" font-family="Helvetica" id="page1-1">

          <fo:block text-align="left" font-family="Helvetica">

            <fo:block font-size="16pt" font-weight="bold" font-family="Helvetica" line-height="140%">

              Table of Contents

       </fo:block>

            <xsl:call-template name="gen-toc"></xsl:call-template>

          </fo:block>
        </fo:block>

      </fo:flow>

    </fo:page-sequence>

  </xsl:template>

  <xsl:template name="main-doc3">

    <fo:page-sequence master-reference="chapter-master" format="1" initial-page-number="0">

      <fo:static-content flow-name="xsl-region-before">

        <fo:block font-size="8pt" line-height="8pt">

<xsl:value-of select="$booktitle"></xsl:value-of>

        </fo:block>

      </fo:static-content>

      <fo:static-content flow-name="xsl-region-after">

        <fo:block text-align="left" font-size="10pt" font-weight="bold" font-family="Times">
          <fo:page-number></fo:page-number>
        </fo:block>

      </fo:static-content>

      <fo:flow flow-name="xsl-region-body">

        <fo:block text-align="left" font-size="12pt" font-family="Times">
          <xsl:apply-templates></xsl:apply-templates>
        </fo:block>

      </fo:flow>

    </fo:page-sequence>

  </xsl:template>






Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statements with even or odd numbers sanderson Beginning VB 6 1 July 15th, 2008 02:19 PM
Odd InputBox error Archdeacon VBScript 3 June 15th, 2008 10:50 PM
Odd form behaviour jeremy1048 Access 0 April 25th, 2008 08:13 AM
Rather odd web-project oldmainframehack Javascript How-To 0 August 8th, 2007 09:03 AM
Page numbering: count odd pages only zolex82 XSLT 0 December 5th, 2005 11:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.