Why not just write some code? That would be way easier. Write a function that returns true of false for each row and add xdExtension to a display condition rule to control hide/show. Let us know if you need more pointers. I do believe it's doable in XPath, but it might be very complex and hard to figure out.
Patrick Halstead [InfoPath MVP]
InfoPathDev
Patrick Halstead
Project Manager at Qdabra