I am using Google Sheet to read XML data. Unfortunately I am struggling to extract the XML correctly. https://www.w3schools.com/xml/xpath_syntax.asp, SO and other Googled sources didn't help.
While processing the simplified data below
<item>
<profile_url>www.profile1.com</profile_url>
<answers>
<answers_item>
<answer>answer text 1.1</answer>
</answers_item>
<answers_item>
<answer>answer text 1.2</answer>
</answers_item>
</answers>
<item>
<item>
<profile_url>www.profile2.com</profile_url>
<answers>
<answers_item>
<answer>answer text 2.1</answer>
</answers_item>
<answers_item>
<answer>answer text 2.2</answer>
</answers_item>
</answers>
<item>
The output needs to be in the following format so additional formatting isn't required in a spreadsheet
www.profile1.com answer text 1.1 answer text 1.2
www.profile2.com answer text 2.1 answer text 2.2
Variants tried and failed to give the correct output are
"//profile_url //answers/answers_item/answer"
"//profile_url | //answers/answers_item/answer"
Thanks in advance Rob
Tried fixes from suggested duplicate
1) Using string-join
string-join(//item/(concat(profile_url/text(), '.', answers/answers_item/answer//text())), " ")
Gave the follow error (maybe because XPath used is not 2.0)
Imported Xml content can not be parsed.
2) Using
concat(//profile_url/text(), " ", //answers/answers_item/answer/text())
Gave the first entry only.