You have the example code posted earlier
[contains(@name, 'melee')]
So replacing that with gun
Code:
<set xpath="/items/item[contains(@name, 'gun')]/effect_group[@name='Base Effects']/passive_effect[@name='ModSlots' and @operation='base_set']/@value" >0,10</set>
I am not sure about the windows.xml as Drconfused has that code working in his modlets for power tools, perhaps download his modlet and have a look at the code ?
The best way to work on this is to choose 1 weapon/tool
work with the code on that and check to see if that works then work your way through the rest.