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

Page number ranges

Subject: Page number ranges
From: "Gustaf Liljegren" <gustaf.liljegren@xxxxxx>
Date: Tue, 22 Jan 2002 17:11:39 +0100
word xml page number
I'm working with an index in XSL FO. The source document looks like this:

<index>
  <word page="12">cat</word>
  <word page="58">dog</word>
  <word page="23">giraffe</word>
  ...
</index>

The words are already sorted, and there are no duplicates (entries with both
the same attribute and element value). The code for printing page numbers
looks like this:

<xsl:for-each select="//word[.=current()]">
  <xsl:sort select="@page" data-type="number"/>
  <xsl:value-of select="@page"/>
  <xsl:if test="not(position()=last())">
    <xsl:text>, </xsl:text>
  </xsl:if>
</xsl:for-each>

This works fine, but I want to add a feature so that pages 12, 13, 14 is
written 12-14. How is that achieved?

Gustaf



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.