1 declare namespace svg ="http://www.w3.org/2000/svg";
3 (: TODO: svg2rects.xqe doesn't support labels :)
5 let $rects := //svg:svg/svg:rect
6 let $player := for $rect in $rects where $rect/@id = "player"
10 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
12 let $platforms := for $rect in $rects where matches($rect/@id, "^rect.*")
18 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
20 let $boxes := for $rect in $rects where matches($rect/@id, "^box.*")
26 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
28 let $regions := for $rect in $rects where matches($rect/@id, "region.*") return $rect
29 let $goals := for $rect in $rects where matches($rect/@id, "goal.*") return (
30 let $goal_id := replace($rect/@id, "goal(.*)", "$1")
31 let $goal_region := for $region in $regions where $region/@id = concat("region", $goal_id) return $region
35 $goal_region[1]/@x, " ",
36 $goal_region[1]/@y, " ",
37 $goal_region[1]/@width, " ",
38 $goal_region[1]/@height, " ",
39 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
42 let $lavas := for $rect in $rects where matches($rect/@id, "lava.*")
48 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
50 let $background := for $rect in $rects where $rect/@id = "background"
51 return replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
52 let $backplatforms := for $rect in $rects where matches($rect/@id, "^backrect.*")
58 replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
69 count($backplatforms),