fabio76 wrote:
I have the following file xml :

<document>
        <pThis is a test</p>
        <table>
                <tr>
                        <td>First TD</td>
                        <td>Second TD</td>
                </tr>
        </table>
        <figure>
                <title>Figure Title</title>
        </figure>
        <p>Continue paragraf etc.etc.</p>
</document>

Is possible to change the layout of the page when is applied the template
<xsl:template match="figure"> ?
I would like to have the page in A3 only for the template 'figure', for the
other template in A4 format

You can start a new page sequence with an A3 page master. The
unfortunate embedding of the 'figure' element will, however, lead
to some not quite trivial XSLT code in order to generate the
page sequences for the not-figure content. Note that this also
means that 'figure' content gets its own page(s). XSL FO does
not have the possibility to do page master change for pages
containing some specific content embedded as usual in the flow.

Try something along the following if you use an XSLT 1.0 processor
(the solution in case of a 2.0 processor might be much simpler):
<xsl:template match="document>
  <fo:root>
    <fo:layout-master-set>
       <fo:simple-page-master master-name="A4" ...
           ...
       </fo:simple-page-master>
       <fo:simple-page-master master-name="A3-landscape" ...
           ...
       </fo:simple-page-master>
    <fo:layout-master-set>
    <fo:root>
      <!-- content before the first figure element, or perhaps
        the only content -->
      <fo:page-sequence master-reference="A4">
        ... define static content ...
        <fo:flow>
          <xsl:apply-templates select="node()[
            not(preceding-sibling::figure)]"/>
        </fo:flow>
      </fo:page-sequence>
      <!-- now on for the figure elemets and groups of non-figure
       content after  each figure element -->
      <xsl:for-each select="figure">
        <!-- the figure element itself -->
        <fo:page-sequence master-reference="A3-landscape">
          ... define static content ...
          <fo:flow>
            <xsl:apply-templates select="."/>
          </fo:flow>
        </fo:page-sequence>
        <xsl:variable name="current-figure-node"
          select="."/>
        <!-- the content after the figure element -->
        <fo:page-sequence master-reference="A4">
          ... define static content ...
          <fo:flow>
            <xsl:apply-templates select="node()[
              generate-id(preceding-sibling::figure[1])=
              generate-id($current-figure-node)]"/>
          </fo:flow>
        </fo:page-sequence>
      </xsl:for-each>
   </fo:root>
</xsl:template>

The code above is untested, non-optimal and may contain syntax errors.
For more help, consult the XSLT FAQ and/or the XSL mailing list:
  http://www.mulberrytech.com/xsl/xsl-list/

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to