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

7312Re: [XSL-FO] Problem with Dictionary Style Running Heads

Expand Messages
  • Jeff Sese
    Feb 1, 2007
    • 0 Attachment
      Ken, I haven't tried your code yet but i think if i have a page like this:

      page 1: page 2: page 3:
      ------------- ------------- ------------
      title0 some text some text
      some text some text some text
      some text some text some text
      title1 some text some text
      some text some text some text
      some text some text title2
      some text some text some text
      ------------- ------------- ------------

      It will still output the following headers:

      page 1: title0-title1
      page 2: title1-title1
      page 3: title1-title2

      But what i want is an output of:

      page 1: title0-title1
      page 2: title1
      page 3: title1-title2

      I tried this and i got the desired output, but i can seem to understand
      how it happened.

      <xsl:variable name="first" as="xs:string">
      <fo:retrieve-marker retrieve-class-name="header"
      retrieve-boundary="page" retrieve-position="first-including-carryover"/>
      </xsl:variable>
      <xsl:variable name="last" as="xs:string">
      <fo:retrieve-marker retrieve-class-name="header"
      retrieve-boundary="page" retrieve-position="last-starting-within-page"/>
      </xsl:variable>
      <fo:block>
      <xsl:choose>
      <xsl:when test="$first eq $last">
      <fo:retrieve-marker retrieve-class-name="header"
      retrieve-boundary="page" retrieve-position="first-including-carryover"/>
      </xsl:when>
      <xsl:otherwise>
      <fo:retrieve-marker retrieve-class-name="header"
      retrieve-boundary="page" retrieve-position="first-including-carryover"/>
      — <fo:retrieve-marker retrieve-class-name="header"
      retrieve-boundary="page" retrieve-position="last-starting-within-page"/>
      </xsl:otherwise>
      </xsl:choose>
      </fo:block>

      I tried outputting the content of the variable using xsl:message but i
      get no output for their value:
      <xsl:message>
      <xsl:copy-of select="$first"/>
      <xsl:copy-of select="$last"/>
      </xsl:message>

      Is my xslt above correct? It does give me the desired output though...
      --
      *Jeff Sese*

      G. Ken Holman wrote:
      >
      > At 2007-02-01 15:33 +0800, Jeff Sese wrote:
      > >I'm have a dictionary style running heads that displays the title of the
      > >active article in the page and the last article in the page using this
      > >fo instruction:
      > >
      > ><fo:retrieve-marker retrieve-class-name="header"
      > >retrieve-boundary="page" retrieve-position="first-including-carryover"/>
      > >— <fo:retrieve-marker retrieve-class-name="header"
      > >retrieve-boundary="page" retrieve-position="last-starting-within-page"/>
      > >
      > >When my page only contains a single article, my header will return the
      > >title of the article twice separated by the em dash, which is normal by
      > >following the instructions above. What I want, however, is to output
      > >only the article title once without the em dash if the page contains
      > >only one article and when there are two or more articles present in the
      > >page, i want them displayed as first article em dash second article.
      >
      > There is no way to conditionally retrieve content ... you get what
      > you get by the class name, boundary and position, but you can't
      > arbitrate what you get when there are multiple markers, nor can you
      > test the absence of a marker.
      >
      > You can get closer to what you want if you retrieve two separate
      > parts of the header, the bit at the start and then the bit at the
      > end, with the dash in the bit at the end. But make the end marker
      > empty for the first entry.
      >
      > The problem is on the last page when you get the last title twice ...
      > but I think you are closer to what you want.
      >
      > I hope the example below helps.
      >
      > . . . . . . . . . . . Ken
      >
      > <?xml version="1.0" encoding="utf-8"?><!--marker6.fo-->
      > <root xmlns="http://www.w3.org/1999/XSL/Format
      > <http://www.w3.org/1999/XSL/Format>"
      > font-family="Times" font-size="20pt">
      >
      > <layout-master-set>
      > <simple-page-master master-name="frame"
      > page-height="297mm" page-width="210mm"
      > margin-top="15mm" margin-bottom="15mm"
      > margin-left="15mm" margin-right="15mm">
      > <region-body region-name="frame-body"
      > margin-bottom=".5cm" margin-top=".5cm"/>
      > <region-before region-name="frame-before" extent=".5cm"/>
      > <region-after region-name="frame-after" extent=".5cm"/>
      > </simple-page-master>
      > </layout-master-set>
      >
      > <page-sequence master-reference="frame"
      > xmlns="http://www.w3.org/1999/XSL/Format
      > <http://www.w3.org/1999/XSL/Format>">
      > <static-content flow-name="frame-before">
      > <block>
      > <retrieve-marker retrieve-class-name="header-start"
      > retrieve-boundary="page" retrieve-position="first-including-carryover"/>
      > <retrieve-marker retrieve-class-name="header-end"
      > retrieve-boundary="page" retrieve-position="last-starting-within-page"/>
      > </block>
      > </static-content>
      >
      > <flow flow-name="frame-body">
      > <block space-after="3in" break-after="page">
      > <marker marker-class-name="header-start">
      > first
      > </marker>
      > <marker marker-class-name="header-end">
      >
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > second
      > </marker>
      > <marker marker-class-name="header-end">
      > — second
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > third
      > </marker>
      > <marker marker-class-name="header-end">
      > — third
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > fourth
      > </marker>
      > <marker marker-class-name="header-end">
      > — fourth
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > fifth
      > </marker>
      > <marker marker-class-name="header-end">
      > — fifth
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > sixth
      > </marker>
      > <marker marker-class-name="header-end">
      > — sixth
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > seventh
      > </marker>
      > <marker marker-class-name="header-end">
      > — sevent
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > eighth
      > </marker>
      > <marker marker-class-name="header-end">
      > — eighth
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > ninth
      > </marker>
      > <marker marker-class-name="header-end">
      > — ninth
      > </marker>
      > Test
      > </block>
      > <block space-after="3in">
      > <marker marker-class-name="header-start">
      > tenth
      > </marker>
      > <marker marker-class-name="header-end">
      > — tenth
      > </marker>
      > Test
      > </block>
      >
      > </flow></page-sequence>
      >
      > </root>
      >
      > --
      > World-wide corporate, govt. & user group XML, XSL and UBL training
      > RSS feeds: publicly-available developer resources and training
      > G. Ken Holman mailto:gkholman@...
      > <mailto:gkholman%40CraneSoftwrights.com>
      > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      > <http://www.CraneSoftwrights.com/f/>
      > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
      > Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/f/bc
      > <http://www.CraneSoftwrights.com/f/bc>
      > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
      > <http://www.CraneSoftwrights.com/legal>
      >
      >
      > ------------------------------------------------------------------------
      >
      > No virus found in this incoming message.
      > Checked by AVG Free Edition.
      > Version: 7.5.432 / Virus Database: 268.17.18/662 - Release Date: 1/31/2007 3:16 PM
      >
    • Show all 7 messages in this topic