But how can I get which newsitem it is (number 1, 2, 3 or whatever) without looping through all newsitems. First I thought that $currentPage/@sortOrder was right, but if you delete an item (for example:2) than the @sortorder of article 1 stays 1 and the @sortorder of article 3 stays 3, but article 3 is no longer newsitem 3 of y but newsitem 2 of y (because article 2 is deleted)
Show position of
Hi all,
I have the following problem; I have a list with newsitems and when I show a newsitem I want to display "This is newsitem x of y".
Getting the y is simple, because I just count the number of nodes under its parent
But how can I get which newsitem it is (number 1, 2, 3 or whatever) without looping through all newsitems. First I thought that $currentPage/@sortOrder was right, but if you delete an item (for example:2) than the @sortorder of article 1 stays 1 and the @sortorder of article 3 stays 3, but article 3 is no longer newsitem 3 of y but newsitem 2 of y (because article 2 is deleted)
I hope anybody can help
Jeffrey
Hi Jeffrey,
Depending on the context, you should be able to use the position() function - something like:
/Chriztian
Hi Chriztian,
I'm not in a for-each loop but I'm one the page of that newsitem, so I can't use /position()
Hi Jeffrey,
OK - then you should be able to add one to the number of preceding-siblings:
/Chriztian
Great! Thanks a lot!
is working on a reply...