XPath Query to parse all IDREFS in an attribute (containing possibly a lot of IDs)

I need to come up with a query that gives products of types from which no items were sold. Meaning, if the item is of type of clothing and no items of clothing are displayed in the transaction list, I need to display it.

This is my XML file (apologies for the super Canadian):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE store [

<!ELEMENT store (product*, transaction*)> 
<!ATTLIST store name CDATA #REQUIRED > 

<!ELEMENT product EMPTY> 
    <!ATTLIST product 
        name ID #REQUIRED 
        type CDATA #REQUIRED 
        price CDATA #REQUIRED 
    > 

    <!ELEMENT transaction EMPTY> 
    <!ATTLIST transaction 
products IDREFS #REQUIRED 
sumPrice CDATA #REQUIRED 
    >

]>
<store name="Gordons">
<product name="beaverCoat" type="clothing" price="100"/>
<product name="hockeyStick" type="equipment" price="30"/>
<product name="hockeyPuck" type="equipment" price="5"/>
<product name="icePick" type="equipment" price="40"/>
<product name="mooseMeat" type="food" price="350"/>
<product name="salmon" type="food" price="15"/>
<transaction products="hockeyPuck hockeyStick" sumPrice="35"/>
<transaction products="hockeyStick mooseMeat" sumPrice="380"/>
<transaction products="salmon mooseMeat" sumPrice="365"/>
<transaction products="hockeyStick hockeyStick hockeyStick" sumPrice="30"/>
</store>

DESIRED EXIT

<product name="beaverCoat" type="clothing"/> because it is a product from the category (clothing) from which nothing was bought. that is, no transactions include clothing.

MY ATTEMPT I played with some queries, but I just can't get it right. This is the closest I got:

//product[@type != //transactions/@products/@type]

, - , type type transactions, .

, - .

+4
1

id(), node -set , , node -set products transaction:

id(//transaction/@products)

, type , :

id(//transaction/@products)/@type

- , type , :

//product[not(@type = id(//transaction/@products)/@type)] 

, XML beaverCoat node.

+5

All Articles