[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Question about Page-Masters


Subject: Re: [xsl] Question about Page-Masters
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Thu, 28 Aug 2003 22:04:15 +0200

Lehming, Thea wrote:
Again, thank you for your reply, but this doesn't seem to quite answer the
query I had (perhaps it was not stated properly - I am a newbie to this and
am still working on communicating exactly what it is I need to have happen).
We know the idea of using an additional page-master, though *how do you get
that to happen in a repeatable fashion*?  Please see below:

I'm not sure what your problem has to do with repeating. I'd think the goal is to create a FO document roughly like <fo:root ... > <fo:layout-master-set> <fo:simple-page-master name="one-column"> ... </fo:simple-page-master> <fo:simple-page-master name="two-column"> ... </fo:simple-page-master> <fo:layout-master-set> <fo:page-sequence master-reference="two-column"> <fo:flow ...> <fo:block>Chapter 1<fo:block> <fo:block>Section 1<fo:block> ... <fo:flow> <fo:page-sequence> <fo:page-sequence master-reference="two-column"> <fo:flow ...> <fo:block>Section 2<fo:block> ... <fo:flow> <fo:page-sequence> ... <fo:page-sequence master-reference="one-column"> <fo:flow ...> <fo:block>Section 5<fo:block> ... <fo:flow> <fo:page-sequence>

There is no need to map whatever hierarchi in your source document
into a block hierarchy in FO. It all ends up as text in some blocks.

Getting the above as a result from an XSLT may be a bit unintuitive
but it is certainly possible, for example if your source is
 <chapter>
   <title>Chapter 1</title>
   <section>
     <title>Section 1</title>
     ...
   </section>
   ...
then something like the following could be used:
  <xsl:template match="chapter">
    <xsl:apply-templates select="section[1]">
      <xsl:with-param name="additional-stuff"
          select="title"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="section[position() &gt; 1]">
  </xsl:template>

  <xsl:template match="section">
    <xsl:param name="additional-stuff"/>
    <fo:page-sequence>
       <xsl:choose>
         <xsl:when test="position()=last()">
           <xsl:attribute name="master-reference">
              <xsl:text>one-column<xsl:text>
           </xsl:attribute>
         </xsl:when>
         <xsl:otherwise>
           <xsl:attribute name="master-reference">
              <xsl:text>two-column<xsl:text>
           </xsl:attribute>
         </xsl:otherwise>
       </xsl:choose>
      <fo:flow>
        <xsl:apply-templates select="$additional-stuff"/>
        <xsl:apply-templates/>
      </fo:flow>
    </fo:page-sequence>
  </xsl:template>

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread
Keywords