equal
deleted
inserted
replaced
1 <?xml version="1.0"?> |
1 <?xml version="1.0"?> |
2 <xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg" xmlns:str="http://exslt.org/strings" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0" exclude-result-prefixes="ns str regexp exsl func dyn"> |
2 <xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg" xmlns:str="http://exslt.org/strings" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0" exclude-result-prefixes="ns str regexp exsl func dyn"> |
3 <xsl:output method="xml" cdata-section-elements="xhtml:script"/> |
3 <xsl:output method="xml" cdata-section-elements="xhtml:script"/> |
4 <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/> |
|
5 <xsl:variable name="hmitree" select="ns:GetHMITree()"/> |
|
6 <xsl:variable name="svg_root_id" select="/svg:svg/@id"/> |
4 <xsl:variable name="svg_root_id" select="/svg:svg/@id"/> |
7 <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
5 <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
8 <xsl:variable name="hmi_geometry" select="$geometry[@Id = $hmi_elements/@id]"/> |
|
9 <xsl:variable name="hmi_pages" select="$hmi_elements[func:parselabel(@inkscape:label)/widget/@type = 'Page']"/> |
6 <xsl:variable name="hmi_pages" select="$hmi_elements[func:parselabel(@inkscape:label)/widget/@type = 'Page']"/> |
10 <xsl:variable name="default_page"> |
7 <xsl:variable name="default_page"> |
11 <xsl:choose> |
8 <xsl:choose> |
12 <xsl:when test="count($hmi_pages) > 1"> |
9 <xsl:when test="count($hmi_pages) > 1"> |
13 <xsl:variable name="Home_page" select="$hmi_pages[func:parselabel(@inkscape:label)/widget/arg[1]/@value = 'Home']"/> |
10 <xsl:variable name="Home_page" select="$hmi_pages[func:parselabel(@inkscape:label)/widget/arg[1]/@value = 'Home']"/> |
52 <xsl:otherwise> |
49 <xsl:otherwise> |
53 <func:result select="$descend"/> |
50 <func:result select="$descend"/> |
54 </xsl:otherwise> |
51 </xsl:otherwise> |
55 </xsl:choose> |
52 </xsl:choose> |
56 </func:function> |
53 </func:function> |
|
54 <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/> |
|
55 <xsl:template name="debug_geometry"> |
|
56 <xsl:text>GEOMETRY : ID, x, y, w, h |
|
57 </xsl:text> |
|
58 <xsl:for-each select="$geometry[@Id = $hmi_elements/@id]"> |
|
59 <xsl:text> </xsl:text> |
|
60 <xsl:value-of select="@Id"/> |
|
61 <xsl:text> </xsl:text> |
|
62 <xsl:value-of select="@x"/> |
|
63 <xsl:text> </xsl:text> |
|
64 <xsl:value-of select="@y"/> |
|
65 <xsl:text> </xsl:text> |
|
66 <xsl:value-of select="@w"/> |
|
67 <xsl:text> </xsl:text> |
|
68 <xsl:value-of select="@h"/> |
|
69 <xsl:text> |
|
70 </xsl:text> |
|
71 </xsl:for-each> |
|
72 </xsl:template> |
57 <func:function name="func:intersect_1d"> |
73 <func:function name="func:intersect_1d"> |
58 <xsl:param name="a0"/> |
74 <xsl:param name="a0"/> |
59 <xsl:param name="a1"/> |
75 <xsl:param name="a1"/> |
60 <xsl:param name="b0"/> |
76 <xsl:param name="b0"/> |
61 <xsl:param name="b1"/> |
77 <xsl:param name="b1"/> |
96 <func:function name="func:overlapping_geometry"> |
112 <func:function name="func:overlapping_geometry"> |
97 <xsl:param name="elt"/> |
113 <xsl:param name="elt"/> |
98 <xsl:variable name="groups" select="/svg:svg | //svg:g"/> |
114 <xsl:variable name="groups" select="/svg:svg | //svg:g"/> |
99 <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/> |
115 <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/> |
100 <xsl:variable name="candidates" select="$geometry[@Id != $elt/@id]"/> |
116 <xsl:variable name="candidates" select="$geometry[@Id != $elt/@id]"/> |
101 <func:result select="$candidates[(@Id = $groups/@id and (func:intersect($g, .) = 9)) or (not(@Id = $groups/@id) and (func:intersect($g, .) > 0 ))]"/> |
117 <func:result select="$candidates[(@Id = $groups/@id and (func:intersect($g, .) = 9)) or (not(@Id = $groups/@id) and (func:intersect($g, .) > 0 ))]"/> |
102 </func:function> |
118 </func:function> |
103 <func:function name="func:all_related_elements"> |
119 <func:function name="func:all_related_elements"> |
104 <xsl:param name="page"/> |
120 <xsl:param name="page"/> |
105 <xsl:variable name="page_overlapping_geometry" select="func:overlapping_geometry($page)"/> |
121 <xsl:variable name="page_overlapping_geometry" select="func:overlapping_geometry($page)"/> |
106 <xsl:variable name="page_overlapping_elements" select="//svg:*[@id = $page_overlapping_geometry/@Id]"/> |
122 <xsl:variable name="page_overlapping_elements" select="//svg:*[@id = $page_overlapping_geometry/@Id]"/> |
138 </xsl:otherwise> |
154 </xsl:otherwise> |
139 </xsl:choose> |
155 </xsl:choose> |
140 </func:function> |
156 </func:function> |
141 <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages)"/> |
157 <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages)"/> |
142 <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/> |
158 <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/> |
|
159 <xsl:variable name="hmitree" select="ns:GetHMITree()"/> |
143 <xsl:variable name="_indexed_hmitree"> |
160 <xsl:variable name="_indexed_hmitree"> |
144 <xsl:apply-templates mode="index" select="$hmitree"/> |
161 <xsl:apply-templates mode="index" select="$hmitree"/> |
145 </xsl:variable> |
162 </xsl:variable> |
146 <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
163 <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
147 <xsl:template mode="index" match="*"> |
164 <xsl:template mode="index" match="*"> |
317 <xsl:template match="/"> |
334 <xsl:template match="/"> |
318 <xsl:comment> |
335 <xsl:comment> |
319 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
336 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
320 </xsl:comment> |
337 </xsl:comment> |
321 <xsl:comment> |
338 <xsl:comment> |
322 <xsl:apply-templates mode="testgeo" select="$hmi_geometry"/> |
339 <xsl:text> |
|
340 </xsl:text> |
|
341 <xsl:text>debug_geometry: |
|
342 </xsl:text> |
|
343 <xsl:call-template name="debug_geometry"/> |
|
344 <xsl:text> |
|
345 </xsl:text> |
323 </xsl:comment> |
346 </xsl:comment> |
324 <xsl:comment> |
347 <xsl:comment> |
325 <xsl:apply-templates mode="testtree" select="$hmitree"/> |
348 <xsl:apply-templates mode="testtree" select="$hmitree"/> |
326 </xsl:comment> |
349 </xsl:comment> |
327 <xsl:comment> |
350 <xsl:comment> |
1443 <xsl:text>}; |
1466 <xsl:text>}; |
1444 </xsl:text> |
1467 </xsl:text> |
1445 <xsl:text>//})(); |
1468 <xsl:text>//})(); |
1446 </xsl:text> |
1469 </xsl:text> |
1447 </xsl:template> |
1470 </xsl:template> |
1448 <xsl:template mode="testgeo" match="bbox"> |
|
1449 <xsl:text>ID: </xsl:text> |
|
1450 <xsl:value-of select="@Id"/> |
|
1451 <xsl:text> x: </xsl:text> |
|
1452 <xsl:value-of select="@x"/> |
|
1453 <xsl:text> y: </xsl:text> |
|
1454 <xsl:value-of select="@y"/> |
|
1455 <xsl:text> w: </xsl:text> |
|
1456 <xsl:value-of select="@w"/> |
|
1457 <xsl:text> h: </xsl:text> |
|
1458 <xsl:value-of select="@h"/> |
|
1459 <xsl:text> |
|
1460 </xsl:text> |
|
1461 </xsl:template> |
|
1462 <xsl:template mode="testtree" match="*"> |
1471 <xsl:template mode="testtree" match="*"> |
1463 <xsl:param name="indent" select="''"/> |
1472 <xsl:param name="indent" select="''"/> |
1464 <xsl:value-of select="$indent"/> |
1473 <xsl:value-of select="$indent"/> |
1465 <xsl:text> </xsl:text> |
1474 <xsl:text> </xsl:text> |
1466 <xsl:value-of select="local-name()"/> |
1475 <xsl:value-of select="local-name()"/> |