-
Notifications
You must be signed in to change notification settings - Fork 41
/
Solid-XML-to-HTML.xq
36 lines (34 loc) · 1.35 KB
/
Solid-XML-to-HTML.xq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
declare option exist:serialize "method=xhtml media-type=text/html";
let $solids := doc("/db/apps/3d/grouped-solids.xml")/solids
let $models := xmldb:get-child-resources("/db/apps/3d/models")
return
<html>
<head>
<title>Polyhedra in OpenSCAD</title>
</head>
<body>
<h1>Polyhedra in OpenSCAD</h1>
<div>Based on this <a href="http://dmccooey.com/polyhedra/">Polyhedra site </a> by David McCooey from where the coordinates are obtained to generate OpenSCAD scripts. Some polyhedra have accompanying 3-D models using generated STL.</div>
<hr/>
<div>
{for $group in $solids/group
return
<div>
<h2>{$group/name/string()}</h2>
{for $solid in $group/solid
return
<div>
<a name="{$solid/id}">{$solid/name/string()}</a> 
<a href="http://dmccooey.com/polyhedra/{$solid/id}.html">Java Applet</a> 
<a href="solid.xq?id={$solid/id}">OpenSCAD</a> 
{ if ($models = concat($solid/id,".stl"))
then <a href="view_model.xq?model={$solid/id}&title={$solid/name}">3-D</a>
else ()
}
</div>
}
</div>
}
</div>
</body>
</html>