php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19641 test "position()mod 2" not being processed correctly
Submitted: 2002-09-27 16:23 UTC Modified: 2002-09-27 17:20 UTC
From: tony at marston-home dot demon dot co dot uk Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 4.2.3 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tony at marston-home dot demon dot co dot uk
New email:
PHP Version: OS:

 

 [2002-09-27 16:23 UTC] tony at marston-home dot demon dot co dot uk
I have the following code in my XSL file:

<tr><xsl:attribute name="class">
  <xsl:choose>
    <xsl:when test="position()mod 2">odd</xsl:when>
    <xsl:otherwise>even</xsl:otherwise>
  </xsl:choose>
</xsl:attribute>

It's purpose is to set the class of the <tr> element depending on whether the row is odd-numbered or even-numbered so that the background colour can be set accordingly. This works perfectly with the MSXML parser, but with PHP the first row comes out as "odd" (correct), but all subsequent rows come out as "even".

The only way I can get it to work is to modify the test to "position()mod 2-1", but this should not be necessary.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-27 17:20 UTC] derick@php.net
If this is a bug at all, it's a bug in the libraries that PHP uses, which is libsablot (www.gingerall.com). Not a PHP problem -> bogus.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC