recitation 6
DESCRIPTION
.TRANSCRIPT
1a. Elements for the over 8300 meter mountains
//mountain[@height>8300]
1b. Names of mountains climbed in the winter
//mountain[winter]/@name
1c. Names of mountains in the Himalayan mountain range
//range[@name="Himalayan"]/mountain/@name
1d. Names of mountains at least partially within Nepal
//mountain[country="Nepal"]/@name
2a. Elements for teams with more than 4 members
let $sequence-1 := (
for $x in //mountain
where (count($x/first/member) > 4)
let $x/first
)
let $sequence-2 := (
for $y in //mountain
where (count($y/winter/member) > 4)
let $y/winter
)
for $item in ( ($sequence-1, $sequence-2))
return $item
2b. Names of mountains ordered by height
for $x in //mountain
order by $x/@height
return $x/@name
2c. Names of mountains not yet climbed in winter
for $m in //mountain
where not($m/winter)
return $m/@name
2d. Names of all team members, on all expeditions, ordered alphabetically,
with no duplicates
for $x in distinct-values(//member)
order by $x
return $x
3a. Names and dates of death of those who died on Lhotse.
for $m in //table
where $m/@title = 'Lhotse'
return $m//td[position() = 1 to 2]
3b. (requires a join with monsters.xml above) Names of those who died on
'The Killing Mountain'
let $d := doc('tragedies.xml')
let $m := doc('monsters.xml')
let $mountainName := $m//mountain[nickname = "The Killing
Mountain"]/@name
for $x in $d//table
where $x/@title=$mountainName
return $x/tr/td[2]