Hi I have an XML which looks like
<Movies>
<Movie>
<Title>$#*! My Dad Says</Title>
<Year>2010</Year>
<OtherTitles>
<OtherTitleName>Beep My Dad Says</OtherTitleName>
<Year>2010</Year>
<Country>USA</Country>
<TitleType>alternative title</TitleType>
<OtherTitleName>Shit My Dad Says</OtherTitleName>
<Year>2010</Year>
<Country>USA</Country>
<TitleType>uncensored intended title</TitleType>
<OtherTitleName>Shit! My Dad Says</OtherTitleName>
<Year>2013</Year>
<Country>Germany</Country>
<TitleType>imdb display title</TitleType>
</OtherTitles>
</Movie>
</Movies>
I am trying to get its OtherTitleName and year for each of the movie to display it like this -
Beep My Dad Says, 2010
Shit! My Dad says, 2010
I have tried to use concatenation but I get the error item expected, sequence found.
How can I get each item's title and year while looping through it?
EDIT: I have tried the Xquery like this.
for $n in Movies//Movie//OtherTitles
let $d := ($n/OtherTitleName/text(),$n/Year/text())
return $d
// let $d := concat($n/OtherTitleName/text(),$n/Year/text()) Gives me error