This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Selectively displaying numbers
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Selectively displaying numbers
- From: Mickey Bradshaw <Mickey dot Bradshaw at AwardMax dot com>
- Date: Tue, 29 Aug 2000 09:12:11 -0500
- Reply-To: xsl-list at mulberrytech dot com
Hi Mick,
It looks like to me that the mod function could be a solution to your
problem.
Something like this:
<xsl:choose>
<xsl:when test="@lineID mod 5 = 0">
<td>
<xsl:value-of select="@lineID"/>
</td>
</xsl:when>
<xsl:otherwise>
<td></td>
</xsl:otherwise>
<xsl:choose>
Give that a shot and let me know if it works out for you.
Mickey Bradshaw
-----Original Message-----
From: Mick [mailto:mick@telekabel.nl]
Sent: Tuesday, August 29, 2000 4:27 AM
To: XSL-List@mulberrytech.com
Subject: Selectively displaying numbers
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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list