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

RE: [XSL-FO] chapter numbering

Expand Messages
  • Norma Yeazell
    Thanks Ken that makes sense. ... From: G. Ken Holman [mailto:gkholman@cranesoftwrights.com] Sent: Friday, August 20, 2004 11:18 PM To: XSL-FO@yahoogroups.com
    Message 1 of 6 , Aug 23, 2004
    • 0 Attachment
      Thanks Ken that makes sense.

      -----Original Message-----
      From: G. Ken Holman [mailto:gkholman@...]
      Sent: Friday, August 20, 2004 11:18 PM
      To: XSL-FO@yahoogroups.com
      Subject: Re: [XSL-FO] chapter numbering

      At 2004-08-20 10:28 -0400, Norma Yeazell wrote:
      >I've looked at several examples and searched the archives but I'm just
      >not getting it through my head how to do page sequencing for chapters.
      >
      >Maybe I'm going about this all wrong, any suggestions would be
      >appreciated.
      >
      >My xml would look like:
      >
      ><pm>
      ><chapter>
      ><dmodule> content A</dmodule>
      ><dmodule> content A</dmodule>
      ><dmodule> content A</dmodule>
      ></chapter>
      ><chapter>
      ><dmodule> content B</dmodule>
      ><dmodule> content B</dmodule>
      ><dmodule> content B</dmodule>
      ></chapter>
      ></pm>
      >
      >
      >So the numbering would be Chap 1-1, Chap 1-2, Chap 1-3 depending on the
      >number dmodules within chapter.
      >
      >Here is what I've tried but my result is all chapters numbered 1-1 and
      >then all chapters numbered 2-1 within same file.
      >...
      ><fo:static-content flow-name="first" region-name="first">
      >...
      > <xsl:text>Chap 1-</xsl:text><xsl:number/>

      When you use <xsl:number/> in the static content, the value is evaluated
      at
      the definition of the static content ... static content is *not* a
      placeholder that gets evaluated every time it is used.

      If you are doing a running header, have your static content do a
      <retrieve-marker/> and put <xsl:number/> into the marker that gets
      retrieved into the static content for each new page.

      As your flow defines new markers with updated dmodule numbers along the
      flow, the retrieval will pick up the "running value" and reflect it in
      the
      header.

      And I'm not sure why you are creating explicit static content "1-" and
      "2-"
      for each chapter when you can just have one static content definition
      and do:

      <xsl:number count="dmodule|chapter" format="1-1"/>

      which will give you "1-1", "1-2", "1-3", "2-1", "2-2", etc.

      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





      Yahoo! Groups Links









      Confidentiality Notice
      The information contained in this e-mail is confidential and intended for use only by the person(s) or organization listed in the address. If you have received this communication in error, please contact the sender at O'Neil & Associates, Inc., immediately. Any copying, dissemination, or distribution of this communication, other than by the intended recipient, is strictly prohibited.
    • Norma Yeazell
      This is a follow-up to my earlier question. I have the chapters numbering correctly now, but would like the page numbers to restart with each dmodule within
      Message 2 of 6 , Aug 24, 2004
      • 0 Attachment
        This is a follow-up to my earlier question. I have the chapters
        numbering correctly now, but would like the page numbers to restart with
        each dmodule within the chapter. I assume I need a new page sequence to
        accomplish this but I do not understand how to make this work. If I
        repeat the sequence I get the entire document again.

        When I started this we were just printing one dmodule at a time and
        everything worked fine but we have added the wrapper tags pm and chapter
        to put the book together.

        My xml would look like:

        <pm>
        <chapter>
        <dmodule> content A</dmodule>
        <dmodule> content A</dmodule>
        <dmodule> content A</dmodule>
        </chapter>
        <chapter>
        <dmodule> content B</dmodule>
        <dmodule> content B</dmodule>
        <dmodule> content B</dmodule>
        </chapter>
        </pm>

        <xsl:template match="/">
        <fo:root>
        <fo:layout-master-set>
        <fo:simple-page-master master-name="firstpage" page-height="297mm"
        page-width="210mm" margin-top="11mm" margin-bottom="12mm"
        margin-left="25mm" margin-right="15mm">
        <fo:region-body margin-top="21mm" margin-bottom="22mm"/>
        <fo:region-before extent="28mm" display-align="before"/>
        <fo:region-after region-name="first" extent="29mm"
        display-align="after"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="restpage" page-height="297mm"
        page-width="210mm" margin-top="11mm" margin-bottom="12mm"
        margin-left="25mm" margin-right="15mm">
        <fo:region-body margin-top="21mm" margin-bottom="22mm"/>
        <fo:region-before extent="28mm" display-align="before"/>
        <fo:region-after region-name="rest" extent="29mm"
        display-align="after"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="lastpage" page-height="297mm"
        page-width="210mm" margin-top="11mm" margin-bottom="12mm"
        margin-left="25mm" margin-right="15mm">
        <fo:region-body margin-top="21mm" margin-bottom="22mm"/>
        <fo:region-before extent="28mm" display-align="before"/>
        <fo:region-after region-name="last" extent="29mm"
        display-align="after"/>
        </fo:simple-page-master>

        <fo:page-sequence-master master-name="chapter">
        <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference page-position="last"
        master-reference="lastpage"/>
        <fo:conditional-page-master-reference page-position="rest"
        master-reference="restpage"/>
        <fo:conditional-page-master-reference page-position="first"
        master-reference="firstpage"/>
        </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>

        </fo:layout-master-set>

        <fo:page-sequence master-reference="chapter" language="en"
        line-height="1.15em" font-family="sans-serif" font-size="10pt"
        hyphenate="true">
        <fo:static-content flow-name="xsl-region-before">
        <fo:block font-weight="bold"
        text-align-last="justify"><fo:external-graphic content-width="1cm"
        src="Logo.tif"/><fo:leader leader-pattern="space"/>
        <xsl:text>Publication Number</xsl:text>
        </fo:block>
        <fo:block border-after-style="solid" border-after-width="0.5pt"
        space-before="1mm"/>
        <fo:block-container display-align="after"
        block-progression-dimension="15%">
        <fo:block font-size="10pt">
        <fo:retrieve-marker retrieve-class-name="issue-table-header"
        retrieve-position="first-starting-within-page"/>
        </fo:block>
        </fo:block-container>
        </fo:static-content>

        <fo:static-content flow-name="first" region-name="first">
        <fo:block border-before-style="solid" border-before-width="0.5pt"
        space-after="2mm"/>
        <fo:block text-align-last="justify">Effectivity: ALL<fo:leader
        leader-pattern="space"/><fo:wrapper font-weight="bold"><xsl:value-of
        select="dmno"/></fo:wrapper></fo:block>
        <fo:block text-align="right" font-weight="bold">
        <fo:retrieve-marker retrieve-class-name="issue-chap-number"
        retrieve-position="last-starting-within-page"/>
        </fo:block>
        <fo:block text-align="right" font-weight="bold">DRAFT
        COPY<fo:leader leader-pattern="space" leader-length="20%"/> Page
        <fo:page-number/></fo:block> </fo:static-content>

        <fo:static-content flow-name="last" region-name="last">
        <fo:block border-before-style="solid" border-before-width="0.5pt"
        space-after="2mm"/>
        <fo:block text-align-last="justify">Effectivity: ALL<fo:leader
        leader-pattern="space"/><fo:wrapper font-weight="bold"><xsl:value-of
        select="dmno"/></fo:wrapper></fo:block>
        <fo:block text-align="right" font-weight="bold">End of
        data<fo:leader leader-pattern="space" leader-length="30%"/>
        <fo:retrieve-marker retrieve-class-name="issue-chap-number"
        retrieve-position="last-starting-within-page"/>
        </fo:block>

        </fo:block>
        <fo:block text-align="right" font-weight="bold">DRAFT COPY Page
        <fo:page-number/></fo:block> </fo:static-content>

        <fo:static-content flow-name="rest" region-name="rest">
        <fo:block border-before-style="solid" border-before-width="0.5pt"
        space-after="2mm"/>
        <fo:block text-align-last="justify">Effectivity: ALL<fo:leader
        leader-pattern="space"/><fo:wrapper font-weight="bold"><xsl:value-of
        select="dmno"/></fo:wrapper></fo:block>
        <fo:block text-align="right" font-weight="bold">
        <fo:retrieve-marker retrieve-class-name="issue-chap-number"
        retrieve-position="last-starting-within-page"/>
        </fo:block>
        <fo:block text-align="right" font-weight="bold">DRAFT COPY Page
        <fo:page-number/></fo:block> </fo:static-content>

        <fo:flow flow-name="xsl-region-body"> <fo:marker
        marker-class-name="issue-table-header"/>
        <xsl:apply-templates/>
        </fo:flow>

        </fo:page-sequence>

        </fo:root>
        </xsl:template>



        Confidentiality Notice
        The information contained in this e-mail is confidential and intended for use only by the person(s) or organization listed in the address. If you have received this communication in error, please contact the sender at O'Neil & Associates, Inc., immediately. Any copying, dissemination, or distribution of this communication, other than by the intended recipient, is strictly prohibited.
      • G. Ken Holman
        ... Your stylesheet would be better structured like: ...
        Message 3 of 6 , Aug 24, 2004
        • 0 Attachment
          At 2004-08-24 09:34 -0400, Norma Yeazell wrote:
          >This is a follow-up to my earlier question. I have the chapters
          >numbering correctly now, but would like the page numbers to restart with
          >each dmodule within the chapter. I assume I need a new page sequence to
          >accomplish this but I do not understand how to make this work. If I
          >repeat the sequence I get the entire document again.
          >
          >When I started this we were just printing one dmodule at a time and
          >everything worked fine but we have added the wrapper tags pm and chapter
          >to put the book together.
          >
          >My xml would look like:
          >
          ><pm>
          ><chapter>
          ><dmodule> content A</dmodule>
          ><dmodule> content A</dmodule>
          ><dmodule> content A</dmodule>
          ></chapter>
          ><chapter>
          ><dmodule> content B</dmodule>
          ><dmodule> content B</dmodule>
          ><dmodule> content B</dmodule>
          ></chapter>
          ></pm>

          Your stylesheet would be better structured like:

          <xsl:template match="pm">
          <!--do root stuff-->
          <fo:root>
          <fo:layout-master-set>
          ...
          </fo:layout-master-set>
          <xsl:apply-templates select="chapter"/>
          </fo:root>
          </xsl:template>

          <xsl:template match="chapter">
          <!--do chapter stuff-->
          <xsl:apply-templates select="dmodule"/>
          </xsl:template>

          <xsl:template match="dmodule">
          <!--do module stuff-->
          <fo:page-sequence initial-page-number="1" ...>
          <!--do module content-->
          </fo:page-sequence>
          </xsl:template>

          ><xsl:template match="/">

          Your code appears to be trying to do *everything* inside of the processing
          of the root node ... my gut feel is that a modular approach will solve your
          problems.

          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
        • Norma Yeazell
          Thanks again Ken that did the trick ... From: G. Ken Holman [mailto:gkholman@cranesoftwrights.com] Sent: Tuesday, August 24, 2004 9:53 AM To:
          Message 4 of 6 , Aug 24, 2004
          • 0 Attachment
            Thanks again Ken that did the trick

            -----Original Message-----
            From: G. Ken Holman [mailto:gkholman@...]
            Sent: Tuesday, August 24, 2004 9:53 AM
            To: XSL-FO@yahoogroups.com
            Subject: RE: [XSL-FO] chapter numbering

            At 2004-08-24 09:34 -0400, Norma Yeazell wrote:
            >This is a follow-up to my earlier question. I have the chapters
            >numbering correctly now, but would like the page numbers to restart
            with
            >each dmodule within the chapter. I assume I need a new page sequence to
            >accomplish this but I do not understand how to make this work. If I
            >repeat the sequence I get the entire document again.
            >
            >When I started this we were just printing one dmodule at a time and
            >everything worked fine but we have added the wrapper tags pm and
            chapter
            >to put the book together.
            >
            >My xml would look like:
            >
            ><pm>
            ><chapter>
            ><dmodule> content A</dmodule>
            ><dmodule> content A</dmodule>
            ><dmodule> content A</dmodule>
            ></chapter>
            ><chapter>
            ><dmodule> content B</dmodule>
            ><dmodule> content B</dmodule>
            ><dmodule> content B</dmodule>
            ></chapter>
            ></pm>

            Your stylesheet would be better structured like:

            <xsl:template match="pm">
            <!--do root stuff-->
            <fo:root>
            <fo:layout-master-set>
            ...
            </fo:layout-master-set>
            <xsl:apply-templates select="chapter"/>
            </fo:root>
            </xsl:template>

            <xsl:template match="chapter">
            <!--do chapter stuff-->
            <xsl:apply-templates select="dmodule"/>
            </xsl:template>

            <xsl:template match="dmodule">
            <!--do module stuff-->
            <fo:page-sequence initial-page-number="1" ...>
            <!--do module content-->
            </fo:page-sequence>
            </xsl:template>

            ><xsl:template match="/">

            Your code appears to be trying to do *everything* inside of the
            processing
            of the root node ... my gut feel is that a modular approach will solve
            your
            problems.

            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





            Yahoo! Groups Links









            Confidentiality Notice
            The information contained in this e-mail is confidential and intended for use only by the person(s) or organization listed in the address. If you have received this communication in error, please contact the sender at O'Neil & Associates, Inc., immediately. Any copying, dissemination, or distribution of this communication, other than by the intended recipient, is strictly prohibited.
          Your message has been successfully submitted and would be delivered to recipients shortly.