You need to fix XPath manually for tags /svg and after it (i.e. /path, /g) as follows:

.../svg  => .../*[name()='svg']
.../path => .../*[name()='path']

If an element contains an index, then index should go right after replaced tag, i.e.:

.../svg[3] => .../*[name()='svg'][3]

If an element contains a selector, then selector should be merged using 'and':

.../path[@d="M150 0 L75 200 L225 200 Z"]  =>  .../*[name()='path' and @d="M150 0 L75 200 L225 200 Z"]

For example, here: we have an XPath learned automatically that ends like that:


The fix for it to work properly is following: