Subject: RE: Selectively displaying numbers From: Mickey Bradshaw <Mickey.Bradshaw@xxxxxxxxxxxx> Date: Tue, 29 Aug 2000 09:12:11 -0500 |
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@xxxxxxxxxxxx] Sent: Tuesday, August 29, 2000 4:27 AM To: XSL-List@xxxxxxxxxxxxxxxx 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@xxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Selectively displaying numbers, Heather Lindsay | Thread | RE: Selectively displaying numbers, mnaughto |
RE: Conditional selection of Templa, Pawson, David | Date | Requirements for XSLT 1.1 (rtf/node, David Carlisle |
Month |