To get test data against which to check my XSLT implementation, I ran this against the database to get back instances of buyers and sellers sharing surnames (some because they were identical, some not):
Searching for family transactions: SELECT titles.ttl_title_id, titles.ttl_title_code, sellers.own_owner_id AS seller_id, buyers.own_owner_id AS buyer_id FROM titles LEFT JOIN owners_to_titles on titles.ttl_title_id = owners_to_titles.ott_title_id_fk LEFT JOIN owners AS buyers on owners_to_titles.ott_owner_id_fk = buyers.own_owner_id LEFT JOIN sellers_to_titles on titles.ttl_title_id = sellers_to_titles.stt_title_id_fk LEFT JOIN owners AS sellers on sellers_to_titles.stt_owner_id_fk = sellers.own_owner_id WHERE buyers.own_surname = sellers.own_surname AND buyers.own_owner_id IS NOT NULL AND sellers.own_owner_id IS NOT NULL LIMIT 0, 500
Then I wrote the XSLT to generate those two fields. It's a bit tricky to disambiguate the two fields -- all instances of Buyer_is_seller do have the same surname, of course, so you have to exclude them -- but I think I have it working OK.
In the process, I discovered a lot more candidate owner duplicates, so my process last week was obviously too cautious. I've re-run it and generated a new list, which JS-R will look at, then I'll de-dupe those.