xsl-list
[Top] [All Lists]

number collapsing

2004-12-14 05:39:09
Awhile back I got help from the list working on a function to collapse page numbers (e.g. 455-456 becomes 455-56).*

I now have a related issue, which I'm now sure how to tackle:

In numeric style citations, the in-text markers look like [1]. If one has multiple references, then, you'd get [1, 2, 3].

So how can I get [1-3] or (in some cases)  [1-3, 5]?

Bruce

* here it is:

  <xsl:function name="bib:number-condense">
    <xsl:param name="begin"/>
    <xsl:param name="end"/>
    <xsl:choose>
      <xsl:when test="$begin castable as xs:integer">
        <xsl:variable name="begin" select="$begin" as="xs:integer"/>
        <xsl:choose>
<xsl:when test="$begin gt 100 and $begin mod 100 and $begin idiv 100 eq $end idiv 100">
            <xsl:value-of select="$end mod 100"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$end"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$end"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:function>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>