Loading ...
Sorry, an error occurred while loading the content.

Conditional page break

Expand Messages
  • pmdgexinc <peter.drivas@gexinc.com>
    Hi, I have the following xml: This is some intro text. This is some more intro text.
    Message 1 of 4 , Jan 7, 2003
    • 0 Attachment
      Hi,

      I have the following xml:

      <intro-section>
      <intro-text>This is some intro text.</intro-text>
      <intro-text>This is some more intro text.</intro-text>
      </intro-section>

      <head-1>
      <title>This is the first heading</title>
      <para>This is some text.</para>
      <para>This is some more text.</para>
      </head-1>

      I transform this xml into xsl:fo and currently have a forced page
      break (using <fo:block break-after="page" />) af the end of the intro-
      section. This causes a page break after the end of the intro-section,
      no matter what. Now there is a new requirement that the page break
      occur only if the <intro-section> is contained on the first page. If
      it overflows to the second page, no page break should occur.

      I've looked at a number of examples and thought I might be able to do
      something with a conditional-page-master-reference, but I haven't
      been able to come up with anything that works. Does anyone know of
      anything that might work or if this is even possible?

      TIA,
      Peter
    • W. Eliot Kimber
      ... There is no complete solution because XSL 1.0 does not provide any layout aware formatting controls that would allow you to put page-aware conditional
      Message 2 of 4 , Jan 7, 2003
      • 0 Attachment
        pmdgexinc wrote:

        > Now there is a new requirement that the page break
        > occur only if the <intro-section> is contained on the first page. If
        > it overflows to the second page, no page break should occur.

        There is no complete solution because XSL 1.0 does not provide any
        "layout aware" formatting controls that would allow you to put
        page-aware conditional processing in the XSL-FO instance.

        However, you can get a lot of mileage from the keep-together and
        keep-with-* properties. It would require some experimentation, but if
        you set the keep-together.on-page value to "always" or a very high
        number for the block that *follows* the introduction, that should force
        it to start on a new page as long as it can't fit on the first page with
        the intro. This may require tuning based on the typical content of your
        documents.

        Another workaround is to provide authors with an attribute to indicate
        whether or not there should be a break after the intro. This type of
        author-provided format tuning can solve a lot of problems that XSL 1.0
        is simply not set up to solve.

        Cheers,

        Eliot
        --
        W. Eliot Kimber, eliot@...
        Consultant, ISOGEN International

        1016 La Posada Dr., Suite 240
        Austin, TX 78752 Phone: 512.656.4139
      • G. Ken Holman
        ... I started thinking in that direction, Eliot, but there is a problem with using always . If the tuning isn t just right, and more than a page worth of
        Message 3 of 4 , Jan 7, 2003
        • 0 Attachment
          At 2003-01-07 09:42 -0600, W. Eliot Kimber wrote:
          >pmdgexinc wrote:
          >
          > > Now there is a new requirement that the page break
          > > occur only if the <intro-section> is contained on the first page. If
          > > it overflows to the second page, no page break should occur.
          >
          >There is no complete solution because XSL 1.0 does not provide any
          >"layout aware" formatting controls that would allow you to put
          >page-aware conditional processing in the XSL-FO instance.
          >
          >However, you can get a lot of mileage from the keep-together and
          >keep-with-* properties. It would require some experimentation, but if
          >you set the keep-together.on-page value to "always" or a very high
          >number for the block that *follows* the introduction, that should force
          >it to start on a new page as long as it can't fit on the first page with
          >the intro. This may require tuning based on the typical content of your
          >documents.

          I started thinking in that direction, Eliot, but there is a problem with
          using "always". If the tuning isn't just right, and more than a page worth
          of content will trigger an overflow condition. Less than a page worth
          might still fit on the first page if the intro is short enough. Using more
          than a page worth with a numeric value will flow as if no keep was specified.

          I think your suggestion regarding adding some authoring controls for this
          condition is best in the absence of XSL-FO 1.0 page status awareness.

          ................... Ken


          --
          Upcoming hands-on in-depth North America: February 3- 7,2003
          XSLT/XPath and XSL-FO Europe: February 17-21,2003

          G. Ken Holman mailto:gkholman@...
          Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
          Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
          ISBN 0-13-065196-6 Definitive XSLT and XPath
          ISBN 0-13-140374-5 Definitive XSL-FO
          ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
          ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
          Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
        • pmdgexinc <peter.drivas@gexinc.com>
          Thanks Eliot, I had a feeling that there wasn t a consistent way to do this. I ll probably go with the attribute the author can set, since it s probably the
          Message 4 of 4 , Jan 7, 2003
          • 0 Attachment
            Thanks Eliot, I had a feeling that there wasn't a consistent way to
            do this. I'll probably go with the attribute the author can set,
            since it's probably the most reliable solution.

            Peter

            --- In XSL-FO@yahoogroups.com, "W. Eliot Kimber" <eliot@i...> wrote:
            > pmdgexinc wrote:
            >
            > > Now there is a new requirement that the page break
            > > occur only if the <intro-section> is contained on the first page.
            If
            > > it overflows to the second page, no page break should occur.
            >
            > There is no complete solution because XSL 1.0 does not provide any
            > "layout aware" formatting controls that would allow you to put
            > page-aware conditional processing in the XSL-FO instance.
            >
            > However, you can get a lot of mileage from the keep-together and
            > keep-with-* properties. It would require some experimentation, but
            if
            > you set the keep-together.on-page value to "always" or a very high
            > number for the block that *follows* the introduction, that should
            force
            > it to start on a new page as long as it can't fit on the first page
            with
            > the intro. This may require tuning based on the typical content of
            your
            > documents.
            >
            > Another workaround is to provide authors with an attribute to
            indicate
            > whether or not there should be a break after the intro. This type
            of
            > author-provided format tuning can solve a lot of problems that XSL
            1.0
            > is simply not set up to solve.
            >
            > Cheers,
            >
            > Eliot
            > --
            > W. Eliot Kimber, eliot@i...
            > Consultant, ISOGEN International
            >
            > 1016 La Posada Dr., Suite 240
            > Austin, TX 78752 Phone: 512.656.4139
          Your message has been successfully submitted and would be delivered to recipients shortly.