[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Selectively displaying numbers

Subject: RE: Selectively displaying numbers
From: Mickey Bradshaw <Mickey.Bradshaw@xxxxxxxxxxxx>
Date: Tue, 29 Aug 2000 09:12:11 -0500
mickey bradshaw
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.