This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Page number ranges


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]