Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Here is my XML:
<rows>
<row>
<title>Title 1</title>
<descriptions>
<description lang="EN">Lorem ipsum</description>
<description lang="FR">Lorem ipsum</description>
</descriptions>
</row>
<row>
<title>Title 2</title>
<descriptions>
<description lang="EN">Lorem ipsum</description>
<description lang="FR">Lorem ipsum</description>
</descriptions>
</row>
</rows>
What I need is to export @lang and the description as a string. (ex. "EN :: Lorem ipsum") So I used the concat function for the xpath:
description = concat(.//description,' :: ',.//@lang)
This works well for the first description but ignores the second.
Can anyone tell what I did wrong, please?
Comments
Comment #1
manicato CreditAttribution: manicato commentedComment #2
twistor CreditAttribution: twistor commentedThis is a deficiency in XPath
http://stackoverflow.com/questions/21996965/concatenate-multiple-node-va...
Comment #3
manicato CreditAttribution: manicato commentedstring-join is only available with xpath 2.0 which is not supported by Feeds XPath Parser
Comment #4
manicato CreditAttribution: manicato commentedComment #5
twistor CreditAttribution: twistor commentedWhy did you re-open this?
Comment #6
manicato CreditAttribution: manicato commentedBecause the solution you suggested doesn't work. The function string-join is only available for Xpath 2.0, which is not supported by Feeds XPath Parser.
Comment #7
twistor CreditAttribution: twistor commentedThat was an explanation, not a solution. There's nothing we can do about it. libxml doesn't support XPath 2.0. You can try using Feeds Tamper to do this.
Comment #8
manicato CreditAttribution: manicato commentedSo, don't mark it as fixed.
Comment #9
kenorb CreditAttribution: kenorb commentedThis worked for me:
concat(title, ".", description)