xsl-list
[Top] [All Lists]

[xsl] how to trigger a new page sequence, depending on specific input conditions

2011-10-01 19:45:12
Hi there,
I am after a proper sort of method how to trigger a new page sequence,
depending on specific input conditions.
For example, as input, below is a content model XML with xtrf
attribute featuring an unique identifier, such as GUID-1234,
<concept>
 <title xtrf="GUID-1234">
  Explore and get support
 </title>
 <conbody/>
</concept>
The intention is that the above XML content model shall be placed on
the last page of a PDF document with the following rendering effect

  <xsl:if test="$outputformat = 'UG_Booklet_Print'">
        <xsl:choose>
          <xsl:when test="position() = last()">
            <xsl:attribute name="axf:background-color"><xsl:value-of
select="$background_colour"/></xsl:attribute>
            <xsl:attribute
name="color">rgb-icc(#CMYK,0%,0%,0%,0%)</xsl:attribute>
          </xsl:when>
          <xsl:when test="position() mod 2 = 1">
            <xsl:attribute
name="axf:background-color">rgb-icc(#CMYK,0%,0%,0%,10%)</xsl:attribute>
            <xsl:attribute
name="color">rgb-icc(#CMYK,0%,0%,0%,80%)</xsl:attribute>
          </xsl:when>
          <xsl:otherwise>
            <xsl:attribute
name="color">rgb-icc(#CMYK,0%,0%,0%,80%)</xsl:attribute>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>

when it comes to FO implementation, the following line of code plays a part:

  <xsl:template name="page.setup">
    <xsl:variable name="current-language"><xsl:call-template
name="get.current.language"/></xsl:variable>
    <fo:layout-master-set>
      <!-- Master set for chapter pages, first page is the title page -->
<fo:page-sequence-master master-name="chapter-master">
        <fo:repeatable-page-master-alternatives>
          <fo:conditional-page-master-reference page-position="rest"
odd-or-even="odd"  master-reference="common-page-odd"/>
          <fo:conditional-page-master-reference page-position="rest"
odd-or-even="even" master-reference="common-page-even"/>
          <fo:conditional-page-master-reference page-position="last"
odd-or-even="even" master-reference="common-page-last-even"/>
          <fo:conditional-page-master-reference page-position="last"
odd-or-even="odd"  master-reference="common-page-last-odd"/>
        </fo:repeatable-page-master-alternatives>
      </fo:page-sequence-master>


   <fo:simple-page-master master-name="common-page-odd">
        <xsl:call-template name="common-dimensions"/>
        <xsl:if test="$insert.printer-marks='yes'">
          <xsl:call-template name="printer-marks"/>
        </xsl:if>
        <fo:region-body region-name="region.body">
          <xsl:call-template name="common-odd-margins">
            <xsl:with-param name="language" select="$current-language"/>
          </xsl:call-template>
          <xsl:if test="$column.count > 1">
            <xsl:attribute name="column-count"><xsl:value-of
select="$column.count"/></xsl:attribute>
            <xsl:attribute name="column-gap"><xsl:value-of
select="$column.gap"/>mm</xsl:attribute>
          </xsl:if>
          <xsl:if test="$outputformat = 'Leaflet_Voucher_A7_Print'">
            <xsl:attribute name="border-style">solid</xsl:attribute>
            <xsl:attribute name="border-width">8mm</xsl:attribute>
            <xsl:attribute name="border-color"><xsl:value-of
select="$border-color"/></xsl:attribute>
          </xsl:if>
        </fo:region-body>
        <fo:region-before region-name="region.before">
          <xsl:call-template name="region-before-attributes"/>
        </fo:region-before>
        <fo:region-after region-name="region.after.odd">
          <xsl:call-template name="region-after-attributes"/>
        </fo:region-after>
        <fo:region-start region-name="region.start" extent="3mm"
display-align="center"/>
        <xsl:if test="($outputformat = 'UG_A7_Print') and
($multilingual = 'yes')">
          <fo:region-end region-name="region.end">
            <xsl:variable name="temp">
              <xsl:call-template name="adjust-margins">
                <xsl:with-param name="language" select="$current-language"/>
              </xsl:call-template>
            </xsl:variable>
            <xsl:variable name="margin">
              <xsl:choose>
                <xsl:when test="string($temp) &gt; 0">
                  <xsl:value-of select="$temp"/>
                </xsl:when>
                <xsl:otherwise>5mm</xsl:otherwise>
              </xsl:choose>
            </xsl:variable>
            <xsl:attribute name="extent">
              <xsl:value-of select="substring-before($margin, 'mm') -
1"/><xsl:text>mm</xsl:text>
            </xsl:attribute>
          </fo:region-end>
        </xsl:if>
      </fo:simple-page-master>
<!-- common page last odd-->
  <fo:simple-page-master master-name="common-page-last-odd">
        <xsl:call-template name="common-dimensions"/>
        <xsl:if test="$insert.printer-marks='yes'">
          <xsl:call-template name="printer-marks"/>
        </xsl:if>
        <fo:region-body region-name="region.body">
          <xsl:call-template name="common-odd-margins">
            <xsl:with-param name="language" select="$current-language"/>
          </xsl:call-template>
          <xsl:if test="$column.count > 1">
            <xsl:attribute name="column-count"><xsl:value-of
select="$column.count"/></xsl:attribute>
            <xsl:attribute name="column-gap"><xsl:value-of
select="$column.gap"/>mm</xsl:attribute>
          </xsl:if>
          <xsl:if test="$outputformat = 'Leaflet_Voucher_A7_Print'">
            <xsl:attribute name="border-style">solid</xsl:attribute>
            <xsl:attribute name="border-width">8mm</xsl:attribute>
            <xsl:attribute name="border-color"><xsl:value-of
select="$border-color"/></xsl:attribute>
          </xsl:if>
        </fo:region-body>
        <fo:region-before region-name="region.before">
          <xsl:call-template name="region-before-attributes"/>
        </fo:region-before>
        <fo:region-after region-name="region.after.odd">
          <xsl:call-template name="region-after-attributes"/>
        </fo:region-after>
        <fo:region-end region-name="region.end" extent="3mm"
display-align="after"/>
        <fo:region-start region-name="region.start.last" extent="30mm"
display-align="after"/>
      </fo:simple-page-master>
<!-- common page last even and the remainder skipped -->

In closing, can anyone out there help me out in achieving the last
page rendering effect by either creating a new page sequence or other
methods?
Thanks

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--