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

Re: [XSL-FO] page-sequence

Expand Messages
  • G. Ken Holman
    ... Sounds acceptable. ... The above could be said more briefly with:
    Message 1 of 2 , May 21, 2005
    • 0 Attachment
      At 2005-05-21 14:35 +0000, geethanandh wrote:
      >My dtd for the section looks like this
      >
      ><!ELEMENT Section (SecMeta?, (content | Section)+)>
      >
      >Sections are placed within sections and each section can have their
      >initial page number
      >based on the SecMeta. So my understanding is everytime you get a section
      >create a new
      >page sequence.

      Sounds acceptable.

      >So i designed something like this
      >
      ><xsl:template match="Section">
      > <fo:page-sequence master-reference="{$master}">
      > <xsl:attribute name="initial-page-number">
      > <xsl:value-of select="SecMeta/@page_no" />
      > </xsl:attribute>

      The above could be said more briefly with:

      <fo:page-sequence master-reference="{$master}"
      initial-page-number="{SecMeta/@page_no}">

      > <xsl:flow flow-name="xsl-region-body">
      > <xsl:apply-templates />
      > </xsl:flow>
      ></xsl:page-sequence>
      ></xsl:template>
      >
      >When i hit a section at the root level it is fine, i create a page
      >sequence for it. So now i see
      >another section within that root section when <xsl:apply-templates /> is
      >called. so that
      >template match creates a new page-sequence again, which is like nesting
      >the page-
      >sequence, isn't that wrong as my understanding is page-sequence should be
      >placed
      >within the fo-root.

      Yes, you are right, it is wrong to nest page sequences. So in your
      transformation, just don't nest your page sequences.

      >Help me with this

      With what? An understanding of the problem, or the writing of the solution?

      The problem is that you haven't written the template rule to "flatten" the
      nested sections into sibling page sequences.

      If you want a template written for you, you haven't given enough to write a
      complete solution. A solution will probably be based on something along
      the lines of:

      <xsl:template match="Section">
      <fo:page-sequence master-reference="{$master}"
      initial-page-number="{SecMeta/@page_no}">
      <xsl:flow flow-name="xsl-region-body">
      <!--process this section without going deeper into child Sections-->
      <xsl:apply-templates select="*[not(self::Section)]"/>
      </xsl:flow>
      </fo:page-sequence>
      <!--process child sections as sibling page sequences-->
      <xsl:apply-templates select="Section"/>
      </xsl:template>

      Using the above, Section elements won't trigger nested page sequences. But
      I have no idea if it meets all your requirements for how you want nested
      sections to be flattened.

      I hope this helps.

      . . . . . . Ken


      --
      World-wide on-site corporate, govt. & user group XML/XSL training.
      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)
      Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
      Legal business disclaimers: http://www.CraneSoftwrights.com/legal
    Your message has been successfully submitted and would be delivered to recipients shortly.