1 declare namespace svg ="http://www.w3.org/2000/svg";
3 (: TODO(#255): svg2rects.xqe doesn't support labels :)
5 let $rects := //svg:svg/svg:rect
6 let $texts := //svg:svg/svg:text
7 let $labels := for $text in $texts where matches($text/@id , "^label.*")
11 replace($text/@style, ".*fill:#([0-9a-z]{6}).*", "$1"), " ",
12 $text/svg:tspan/text()
14 let $player := for $rect in $rects where $rect/@id = "player"
18 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
20 let $platforms := for $rect in $rects where matches($rect/@id, "^rect.*")
26 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
28 let $boxes := for $rect in $rects where matches($rect/@id, "^box.*")
34 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
36 let $regions := for $rect in $rects where matches($rect/@id, "region.*") return $rect
37 let $goals := for $rect in $rects where matches($rect/@id, "goal.*") return (
38 let $goal_id := replace($rect/@id, "goal(.*)", "$1")
39 let $goal_region := for $region in $regions where $region/@id = concat("region", $goal_id) return $region
43 $goal_region[1]/@x, " ",
44 $goal_region[1]/@y, " ",
45 $goal_region[1]/@width, " ",
46 $goal_region[1]/@height, " ",
47 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
50 let $lavas := for $rect in $rects where matches($rect/@id, "lava.*")
56 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
58 let $background := for $rect in $rects where $rect/@id = "background"
59 return replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
60 let $backplatforms := for $rect in $rects where matches($rect/@id, "^backrect.*")
66 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
77 count($backplatforms),