Hi there, the problem here is that relying on CSS for selectors means we work with the text content of elements primarily and not their attribute values. So when you tell Feed Creator to target an element with a particular attribute, Feed Creator selects the element and looks for its text content. For example, if we have the two elements below:
<a href="https://example.com/category/">Title 1</a>
<a href="https://example.com/article" title="An interesting article">Title 2</a>
You could select the second link with the following selector:
But when Feed Creator goes to get the title, it will use the text content of the element, which is “Title 2”.
The same applies when you use
So in your example what we need to be able to tell Feed Creator to do is to use the attribute value as the text. That’s not yet possible. It does happen when use
item_url for example, where we assume the ‘href’ attribute contains the URL. But that’s not something you can yet specify in the Feed Creator parameters.
We’ll have to think about how to do this. With XPath it’s possible to be more expessive. For example, you can select all img elements with an alt attribute using the following:
But you can also target the alt attribute itself with:
The CSS selector
img[alt] is essentially the equivalent of the first XPath example. But I’m not aware of an equivalent to the second in CSS (perhaps because it’s used for styling, and it doesn’t really make sense to style the text content of an attribute value).
In Feed Creator we transform the CSS selectors to XPath, so maybe at some point we should allow users to specify XPath to target attribute values, or create an additional parameter where you can specify which attribute should be used for the content.