How do I get the data to return in multiple title elements rather than one title element?
Returns this
<title>
Title 1
Title 2
Title 3
</title>
Want to return this
<title>Title 1</title>
<title>Title 2</title>
<title>Title 3</title>
Code
(: This gets coordinates from $latLon :)
let $result := for $coordinates in $latLon/location
let $lat := $coordinates/lat/text()
let $lon := $coordinates/lon/text()
(: This uses the coordinates to retrieve a title :)
let $data := titleDoc:getTitle($lat, $lon)
let $title := $data//div[@class="title"]/text()
return
<title>{$title}</title>
Difficult to answer without seeing the contents of $data. But something like this should work:
for $title in $data//div[@class="title"]
return <title>{data($title)}</title>