This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [docbook-apps] Fop, Landscape Chapters, & psmi


One thing I'd like to clarify (since the xsl:message I put in the customization I posted at <http://www.thingbag.net/docbook/tabletest/docbook-psmi.xsl> is nonsensical), the customization I posted landscapes any direct child of a chapter, appendix, or article that has the <?landscape?> pi or orient="land" (for tables). So you could put your table directly in an appendix, and then use orient="land" to landscape the table. The table would begin a new page, of course, but you would not need to create any sections in the appendix. Still, it wasn't a general enough solution, so I gave up on it.

It isn't too hard to customize the docbook xsls for use with psmi to make a landscaped chapter or appendix. The following stylesheet should prepare any chapter or appendix where role="land" to be landscaped by the psmi xsls. It overrides two templates from component.xsl (see <!-- psmi stuff -->) and adds a new pagemaster and page-sequence-master. 

Hope that helps,
David

<?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="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>

<xsl:param name="double.sided" select="'1'"/>
  
  <xsl:template name="user.pagemasters">
    <fo:simple-page-master master-name="body-landscape-odd"
                           page-width="{$page.width}"
                           page-height="{$page.height}"
                           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.width}"
                           page-height="{$page.height}"
                           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>


<xsl:template match="chapter[@role = 'land']">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <xsl:variable name="master-reference">
    <xsl:call-template name="select.pagemaster"/>
  </xsl:variable>

  <fo:page-sequence id="{$id}"
                    hyphenate="{$hyphenate}"
                    master-reference="{$master-reference}">
    <xsl:attribute name="language">
      <xsl:call-template name="l10n.language"/>
    </xsl:attribute>
    <xsl:attribute name="format">
      <xsl:call-template name="page.number.format"/>
    </xsl:attribute>
    <xsl:choose>
      <xsl:when test="not(preceding::chapter
                          or preceding::appendix
                          or preceding::article
                          or preceding::dedication
                          or parent::part
                          or parent::reference)">
        <!-- if there is a preceding component or we're in a part, the -->
        <!-- page numbering will already be adjusted -->
        <xsl:attribute name="initial-page-number">1</xsl:attribute>
      </xsl:when>
      <xsl:when test="$double.sided != 0">
        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
      </xsl:when>
    </xsl:choose>

    <xsl:apply-templates select="." mode="running.head.mode">
      <xsl:with-param name="master-reference" select="$master-reference"/>
    </xsl:apply-templates>

    <xsl:apply-templates select="." mode="running.foot.mode">
      <xsl:with-param name="master-reference" select="$master-reference"/>
    </xsl:apply-templates>

    <fo:flow flow-name="xsl-region-body">
<!-- psmi stuff -->
		<psmi:page-sequence master-reference="body-landscape">
		  <fo:flow flow-name="region-body-landscape">
<!-- psmi stuff -->
      <xsl:call-template name="chapter.titlepage"/>

      <xsl:variable name="toc.params">
        <xsl:call-template name="find.path.params">
          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:if test="contains($toc.params, 'toc')">
        <xsl:call-template name="component.toc"/>
        <xsl:call-template name="component.toc.separator"/>
      </xsl:if>
      <xsl:apply-templates/>
<!-- psmi stuff -->
		  </fo:flow>
		</psmi:page-sequence>
<!-- psmi stuff -->
    </fo:flow>
  </fo:page-sequence>
</xsl:template>


<xsl:template match="appendix[@role = 'land']">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <xsl:variable name="master-reference">
    <xsl:call-template name="select.pagemaster"/>
  </xsl:variable>

  <fo:page-sequence id="{$id}"
                    hyphenate="{$hyphenate}"
                    master-reference="{$master-reference}">
    <xsl:attribute name="language">
      <xsl:call-template name="l10n.language"/>
    </xsl:attribute>
    <xsl:attribute name="format">
      <xsl:call-template name="page.number.format"/>
    </xsl:attribute>
    <xsl:choose>
      <xsl:when test="not(preceding::chapter
                          or preceding::appendix
                          or preceding::article
                          or preceding::dedication
                          or parent::part
                          or parent::reference)">
        <!-- if there is a preceding component or we're in a part, the -->
        <!-- page numbering will already be adjusted -->
        <xsl:attribute name="initial-page-number">1</xsl:attribute>
      </xsl:when>
      <xsl:when test="$double.sided != 0">
        <xsl:attribute name="initial-page-number">auto-odd</xsl:attribute>
      </xsl:when>
    </xsl:choose>

    <xsl:apply-templates select="." mode="running.head.mode">
      <xsl:with-param name="master-reference" select="$master-reference"/>
    </xsl:apply-templates>

    <xsl:apply-templates select="." mode="running.foot.mode">
      <xsl:with-param name="master-reference" select="$master-reference"/>
    </xsl:apply-templates>

    <fo:flow flow-name="xsl-region-body">
<!-- psmi stuff -->
		<psmi:page-sequence master-reference="body-landscape">
		  <fo:flow flow-name="region-body-landscape">
<!-- psmi stuff -->
      <xsl:call-template name="appendix.titlepage"/>

      <xsl:variable name="toc.params">
        <xsl:call-template name="find.path.params">
          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
        </xsl:call-template>
      </xsl:variable>

      <xsl:if test="contains($toc.params, 'toc')">
        <xsl:call-template name="component.toc"/>
        <xsl:call-template name="component.toc.separator"/>
      </xsl:if>
      <xsl:apply-templates/>
<!-- psmi stuff -->
		  </fo:flow>
		</psmi:page-sequence>
<!-- psmi stuff -->
    </fo:flow>
  </fo:page-sequence>
</xsl:template>


</xsl:stylesheet>

> -----Original Message-----
> From: Janeene Webb [mailto:webdesign@dawnmist.net]
> Sent: Monday, December 08, 2003 8:31 PM
> To: docbook-apps@lists.oasis-open.org
> Subject: [docbook-apps] Fop, Landscape Chapters, & psmi
> 
> 
> Hi,
> 
> Have got a few *large* tables that need to be processed in 
> landscape format, 
> but in using FOP the reference-orientation attribute is not 
> supported. It can 
> produce separate page sequences in order to create landscape 
> pages if you 
> swap the page height and page width attributes, which I've 
> done and which 
> works nicely.
> 
> After searching, I found the psmi information for producing 
> separate page 
> sequences, but it is limited to being able to produce things 
> in sections 
> under chapters - not whole chapters (or appendices) 
> themselves. While I can 
> put the tables in a section, I then end up with a page that 
> has the chapter 
> title (still in portrait layout), followed by a new page in 
> landscape with 
> the content. And I don't really want to have to introduce a 
> section into a 
> chapter when the sole purpose of that chapter (or appendix) 
> is to contain 
> that table.
> 
> Secondly, I'm not able to call the change in the layout 
> through orient="land" 
> on the tables themselves, as the table rendering dies in fop 
> and displays 
> just a single blank page (in landscape, at least) if the 
> table is more than 
> one page long. This forces me to shove it in a section (where 
> the swapped 
> page height and width attributes cause no problems with the 
> table layout 
> rendering), with the same result as above.
> 
> So - can anyone suggest how to modify the psmi 
> transformations to allow a 
> <chapter> or <appendix> to be rotated *in total*?
> 
> Cheers,
> Janeene.
> 
> (References:
> http://lists.oasis-open.org/archives/docbook-apps/200301/msg00169.html
> http://www.cranesoftwrights.com/resources/psmi/index.htm)
> 
> To unsubscribe from this list, send a post to 
> docbook-apps-unsubscribe@lists.oasis-open.org, or visit 
http://www.oasis-open.org/mlmanage/.


To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]