Subject: Re: [xsl] collapsing number ranges From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx> Date: Tue, 31 Aug 2004 05:54:35 -0400 |
I was just reminded that page numbers aren't always integers. Example:
pp. iii-vi.
I guess that settles it then; better to use substrings in this case.
On the contrary, to handle those you are going to first have to convert to numbers otherwise you are just "substring" isn't really going to be the right relation for roman numerals. Having converted to numbers you could use either approach to truncate the upper range limit before converting back to roman numerals. (You'll probbaly need a different truncation algorithm, in this case, if you want to trucate at all).
<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 castable as xs:integer and $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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] collapsing number ranges, David Carlisle | Thread | Re: [xsl] collapsing number ranges, David Carlisle |
RE: [xsl] Multiple matches against , Andrew Welch | Date | Re: [xsl] variable question, Bruce D'Arcus |
Month |