This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Selectively displaying numbers
- To: <XSL-List at mulberrytech dot com>
- Subject: Selectively displaying numbers
- From: Mick <mick at telekabel dot nl>
- Date: Tue, 29 Aug 2000 11:27:29 +0200
- Reply-To: xsl-list at mulberrytech dot com
I have the following problem. In an xml file I have marked up lines, using
an attribute for line numbers, e.g.:
<line lineID="1">this is the first line</line>
<line lineID="2">this is the second line</line>
<line lineID="3">and so on, and so forth</line>
I'm using the following xsl to display the lines and their line numbers:
<td><xsl:value-of select="@lineID"/></td> <td><xsl:value-of
select="."/></td>
With this, each line is numbered. What I would like is to number ever 5th
line, so I only get line numbers for 5, 10, 15, 20 etc.
I've worked out what the xsl should be, but my knowledge of xsl-maths is
failing me. In simple prose, I would like the following. If the result of
"@lineID divided by 5" is a round number (i.e. no decimals, fractions) then
display the line number; else do not display.
In other words:
If (@lineID/5)=round number -> <td><xsl:value-of select="@lineID"/>
Else -> <td></td>
Can anyone help me and tell me what the xsl should be? Much appreciated.
Mick
mick@telekabel.nl
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list