Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 0.67 KB | None | 0 0
  1. let $islandsInLake := //island[@lake != ""]
  2. for $cont in //continent
  3. return <continent name="{data($cont/name)}">
  4. <total_lake_area>{
  5.     let $countrysum := (
  6.         for $country in //country
  7.         where data($country/encompassed/@continent) = data($cont/@id)
  8.         let $countryPercentage := data(($country/encompassed[@continent = $cont/@id]/@percentage) * 0.01)
  9.         let $lakesWithIslandArea := (
  10.             for $lake in //lake[@id = $islandsInLake[@country = $country/@car_code]/@lake]
  11.             return (data($lake/area)) * $countryPercentage
  12.         )
  13.         return $lakesWithIslandArea
  14.     )
  15.     return sum($countrysum)
  16. }</total_lake_area>
  17. </continent>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement