I have an XML document with a section similar to the following:
<release_list>
<release>
<id>100</id>
<file_list>
<file>
<id>20</id>
</file>
<file>
<id>21</id>
</file>
</file_list>
</release>
<release>
<id>101</id>
<file_list>
<file>
<id>22</id>
</file>
<file>
<id>21</id>
</file>
</file_list>
</release>
<release>
<id>102</id>
<file_list>
<file>
<id>22</id>
</file>
<file>
<id>23</id>
</file>
</file_list>
</release>
</release_list>
At some point I have XSL for-each statements looping through each release, and in turn through each list of files. While I'm looping through each file, I want to get information about which other releases DO NOT contain that same file ID. (So for example, when I'm iterating through file 20 in release 100, I want to get pointers to both releases 101 and 102, but when I'm iterating through file 21 in that same package I want only a pointer to release 102.)
Is there a way to do this with XPath? The closest thing I've come up with is:
../../../release[ not( file_list/file/id = ./id ) ]
...which of course fails because within the square brackets the './' refers to the release in front of the brackets, not the file that the XPath statement is being called from.
Anything I'm missing here?