Need a counting variable in XSL ?

Discussion in 'XML' started by theAlex, Jan 16, 2008.

  1. theAlex

    theAlex

    Joined:
    Jan 16, 2008
    Messages:
    1
    Hello all,
    I have a question for you guys and thank you by advance, this forum is great!

    I have a sequence of blocks (defined through an <xsl:sequence> tag). This sequence is named blocks and contains many block element as follows :
    Code:
    <block id="xx">
    ....
    </block>
    <block id="yy">
    ....
    </block> ... 

    In a for-each loop (in which a inspect each block one by one), I want to access the value of an attribute of a preceding block. It's impossible to use preceding-sibling in XPATH since there is no common node to all these blocks. I just wanted to know how to define a counting variable so that I can access (for example) the 5th block element of this sequence using $blocks[5].


    Do you know how can I do this ??
    Many thanks by advance !
    theAlex, Jan 16, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karsten Weinert
    Replies:
    3
    Views:
    989
    Karsten Weinert
    Jul 5, 2004
  2. MC
    Replies:
    1
    Views:
    7,235
    David Carlisle
    Mar 24, 2005
  3. schaf@2wire.ch
    Replies:
    1
    Views:
    3,587
    A. Bolmarcich
    May 27, 2005
  4. jobooker@gmail.com

    xsl:sort using an xsl:variable as the sort key

    jobooker@gmail.com, Sep 5, 2006, in forum: XML
    Replies:
    2
    Views:
    9,244
    Martin Honnen
    Sep 5, 2006
  5. edwardfredriks

    counting up instead of counting down

    edwardfredriks, Sep 6, 2005, in forum: Javascript
    Replies:
    6
    Views:
    188
    Dr John Stockton
    Sep 7, 2005
Loading...

Share This Page