[xsl] Finding the position of node in foreign node list

Subject: [xsl] Finding the position of node in foreign node list
From: "Jan Rademan" <jrademan@xxxxxxxxxxx>
Date: Thu, 3 Mar 2005 22:18:31 +0200

Here is a problem I'm playing around with:

I have two variables containing two sets of nodes.

$A contains 5 elements A,B,C,D,E of element type Service

$B contains a subset of A$ e.g 2 elements B and D

I am using them to create a table which looks like this

    A    B    C    D    E  (Table header, which comes from $A)
          B          D        (First table row, which comes from $B)

$B is reset though a for-each loop, which then loops to fill the table:

A    B    C    D    E
      B          D
A          C    D
and so on.

The for each which runs through the table, builds the table by running
though each element in $A and checking to see if it exists in $B. If so, the
value written.

I need to determine the positional value of the element being written, as it
occurs in the in the variable $B

If I just use the postion function, I get the position value from the
superset variable $A

so I get output like this:

A    B    C    D    E
       2          4
1           3    4

The ouput I am looking for should rather list the position as it occurs in
the subset variable $B:

A    B    C    D    E
       1          2
1           2    3

Any ideas how I can find out what the position of the current node is in a
foreign node set? (As opposed to the position in the current node set)


Jan Rademan

Current Thread