Results 1 to 5 of 5

Thread: increment count

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    107

    increment count

    Hi

    I've got a stylesheet with a for loop

    <xsl:for-each select="a:multistatus/a:response">

    I've got an element in it:

    <a>
    <xsl:attribute name="href">Clipping.aspx?sTitle=<xsl:value-of select="(aropstat/arop/a:href)"/>
    </xsl:attribute>
    </a>

    How can I add an incremented ID value for each element in the loop,so the link looks like this:

    Clipping.aspx?ID=i&sTitle=<xsl:value-of select="(aropstat/arop/a:href)"/

    Thanks

    Kati
    Last edited by katib; Jan 31st, 2006 at 09:31 AM.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: increment count

    Look at the xsl:number element. It's rather complex, so you may have to play a bit with it until you get it right.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    107

    Re: increment count

    have you got an example? how do i increment it? and how do I attach it to the a href?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: increment count

    I believe this should approximately work, but it depends on your input structure.
    Code:
    <xsl:for-each select="a:multistatus/a:response">
      <a>
        <xsl:attribute name="href">
          <xsl:text>Clipping.aspx?ID=</xsl:text>
          <xsl:number level="any" count="a:multistatus/a:response"/>
          <xsl:text>sTitle=</xsl:text>
          <xsl:value-of select="(aropstat/arop/a:href)"/>
        </xsl:attribute>
      </a>
    </xsl:for-each>
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    107

    Re: increment count

    thanks a lot


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width