[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Page number ranges

Subject: Re: Page number ranges
From: "Gustaf Liljegren" <gustaf.liljegren@xxxxxx>
Date: Wed, 23 Jan 2002 12:55:33 +0100
xsl if page number
Thank you for your help Jeni. It gave some ideas on the logics involved, but
as I embed this code into my stylesheet there are no page numbers at all in
the output. Perhaps there is something in what I have written that conflicts
with the code you suggested, so I post the whole template here to see if you
or someone else can spot the problem.

  <xsl:template match="word">
    <!-- I put your variable here in the top. -->
    <xsl:variable name="entries" select="word[. = current()]" />
    <!-- This line is used because I don't want duplicate lines in the
         index for each match on the same word. -->
    <xsl:if test="not(.=preceding-sibling::word[1])">
      <fo:block xsl:use-attribute-sets="serif-10 hyphenation"
        <!-- The word itself. -->
        <xsl:value-of select="."/>
        <!-- A space here, so that the line breaks before the leader
             if the numbers don't fit in the same line as the word. -->
        <xsl:text> </xsl:text>
        <fo:inline keep-together.within-line="always">
          <fo:leader leader-pattern="dots"/>
          <xsl:for-each select="$entries">
            <xsl:sort select="@page" data-type="number" />
              <xsl:when test="$entries/@page = @page - 1">
                <xsl:if test="not($entries/@page = @page + 1)">
                  <xsl:value-of select="concat('-', @page)" />
                <xsl:if test="position() != 1">, </xsl:if>
                <xsl:value-of select="@page" />

"12-13" is good, but I wonder what happens if there are matches on page 12,
13, 14 and 15? Will they be written "12-14, 15" or "12-15"?


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.