So I'm using FeedMe to get RSS atom feeds and this is working O.K. But there's this field that has an attribute I want to extract. And I cannot get this to work.
In the FeedMe documentation it says:
For example, the XML <field my_attribute="Some Value">Another Value</field>,
you can use {{ xml.field.attributes.my_attribute }}.
My field is called 'enclosure'
and has an attribute called 'url'
that I want to extract. According to the documentation, one would assume that this should work:
{% set feed = craft.feedme.feed(myfeed_rss) %}
{% for node in feed %}
{
'title': {{ node.title | raw }},
'description': {{ node.description | raw }},
'url': {{ node.link | raw }},
'date': {{ node.pubdate | raw }},
'image': {{ node.enclosure.attributes.url | raw }}
}
{% endfor %}
Namely {{ node.enclosure.attributes.url }}
should work? All the other fields are collected correctly. So it's just this one.
Edit: Btw, the feed I'm using is this one. http://www.adressa.no/?widgetName=polarisFeeds&widgetId=3185248&getXmlFeed=true
Edit2: Managed to get it to work, with help from crafw. Some of the nodes weren't empty, fixed it by changing the line to:
{{ node.enclosure.attributes.url|default('empty') }}