Need a counting variable in XSL ?

Joined
Jan 16, 2008
Messages
1
Reaction score
0
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 !
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top