XSL Counter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarkoKlacar
    Recognized Expert Contributor
    • Aug 2007
    • 296

    #1

    XSL Counter

    Hi people,

    does anybody know a simple way to implement a counter in XSL?

    (Silly example)
    Say if I want to color every thrid field blue how can I keep track of whan number I'm at?

    Cheers
  • anistala
    New Member
    • Nov 2007
    • 1

    #2
    Originally posted by MarkoKlacar
    Hi people,

    does anybody know a simple way to implement a counter in XSL?

    (Silly example)
    Say if I want to color every thrid field blue how can I keep track of whan number I'm at?

    Cheers
    I am not sure how you are implementing it, but adding scripting language to the table may simplify it further

    Comment

    • jkmyoung
      Recognized Expert Top Contributor
      • Mar 2006
      • 2057

      #3
      This is most commonly done using position() or <xsl:number>: http://www.w3schools.com/xsl/el_number.asp. Example:
      [code=xml]
      <xsl:number count="field"/>
      OR
      <xsl:if test="position( ) mod 3 = 0">
      Color me blue.
      </xsl:if>
      [/code]

      Comment

      • MarkoKlacar
        Recognized Expert Contributor
        • Aug 2007
        • 296

        #4
        Hi guys,

        thanks for your help, that's a nice link.

        thanks you both.

        Comment

        Working...