Subject: Re: [xsl] test for even or odd From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 21 Jan 2005 18:17:34 -0500 |
test="$count mod 2 = 1" returns true for odd counts (when count is divided by 2, the remainder is 1)
test="$count mod 2 = 0" returns true for even counts (when it's divided by 2 the remainder is 0)
test="$count mod 2" it will test true for odd counts, false for even counts.
Enjoy, Wendell
So I have come down to this, I am going to get a count of how many elements there are of a certain tag. How can I test if the number is even or odd? Stateing the obvious here but if it came back with 3 of the tag I would want a "this number is odd" returned (or 1 and 0 for even).
I already have my rows alternating in color, but there are two sets, I need to first check for directories and place them and then I check for files and place them. When I check for files I then check to see if there was a even or odd number of files telling me what color to start on!
Thanks!
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] test for even or odd, Michael Kay | Thread | RE: [xsl] test for even or odd, Ross, Douglas |
RE: [xsl] test for even or odd, Ross, Douglas | Date | Re: [xsl] case-sensitivity in xml, Wendell Piez |
Month |