嗨,我有一个看起来像的 XML
<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>
我正在尝试为每部电影获取其 OtherTitleName 和年份,以便像这样显示它-
Beep My Dad Says, 2010
Shit! My Dad says, 2010
我尝试使用连接,但我得到了预期的错误项,找到了序列。
如何在循环中获取每个项目的标题和年份?
编辑:我已经尝试过这样的 Xquery。
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