This
<set xpath="/items/item/effect_group/passive_effect[contains(@name, 'ModSlots')][@value='1,1,2,2,3,4']/@value">2,3,4,5,6,7</set>
should be
<set xpath="//passive_effect[@name='ModSlots' and @value='1,1,2,2,3,4']/@value">2,3,4,5,6,7</set>
This would direct your code only to change the lines that have both ModSlots as a passive effect and ones where the value is 1,1,2,2,3,4. The And is the operation you need to do that