1 declare namespace svg ="http://www.w3.org/2000/svg";
3 (: TODO(#255): svg2rects.xqe doesn't support labels :)
5 let $rects := //svg:rect
6 let $texts := //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.*")
35 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
37 let $regions := for $rect in $rects where matches($rect/@id, "region.*") return $rect
38 let $goals := for $rect in $rects where matches($rect/@id, "goal.*") return (
39 let $goal_id := replace($rect/@id, "goal(.*)", "$1")
40 let $goal_region := for $region in $regions where $region/@id = concat("region", $goal_id) return $region
44 $goal_region[1]/@x, " ",
45 $goal_region[1]/@y, " ",
46 $goal_region[1]/@width, " ",
47 $goal_region[1]/@height, " ",
48 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
51 let $lavas := for $rect in $rects where matches($rect/@id, "lava.*")
57 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
59 let $background := for $rect in $rects where $rect/@id = "background"
60 return replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
61 let $backplatforms := for $rect in $rects where matches($rect/@id, "^backrect.*")
67 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
78 count($backplatforms),