I notice that there are transformers like a JSONExtractor transformer that can extract attributes from JSON using a JSON Query, and an HTMLExtractor transformer that can extract attributes from HTML using CSS selectors. Why not an XMLExtractor transformer that can extract attributes from XML using Xpath?
I know that creating attributes for specific XML elements is already possible using Xpath using the XMLXqueryExtractor, but just seeing anything that even looks the slightest like code can already be a bit scary to some users (and also for some XML that uses explicit namespaces in the XML element names you would need to declare those in the XML, etc. So that also looks a bit scary to users (although probably in a transformer you might need to have the same option to make it work?)
So my Idea would be that if you have some XML like this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<student>
<id>01</id>
<name>Tom</name>
<lastname>Price</lastname>
<hobbys>football</hobbys>
<hobbys>hockey</hobbys>
</student>
<student>
<id>02</id>
<name>Nick</name>
<lastname>Thameson</lastname>
<hobbys>reading</hobbys>
<hobbys>gardening</hobbys>
<hobbys>painting</hobbys>
</student>
</root>
Currently you would be able to create (specific) XML attributes using the XMLXQueryExtractor, like e.g. a list for only the name and the lastname of both students:
fme:set-list-attribute("student{}.name", data(//student/name)),
fme:set-list-attribute("student{}.lastname", data(//student/lastname))
I guess the implementation might look very similar to the HTMLExtractor. Actually, it even seems that in some (or all?) situations you might even be able to change your xPath to CSS selectors, and use the HTMLExtractor for the same job.
Target Attribute, CSS Selector, Tag Part/HTML Attribute
student_name, student > name, Value
student_lastname, student > lastname, Value
Return Format: List Attribute