Just to complete by previous message, this is working in both HTML and XHTML page.<br><br>&lt;?xml version=&quot;1.0&quot;?&gt;     <br>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>&quot;&gt;<br>
&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&quot;&gt;     <br>&lt;body&gt;<br>&lt;h1&gt;Just a Rectangle&lt;/h1&gt;  <br>&lt;div id=&quot;test&quot;&gt;<br>&lt;/div&gt;<br>
  &lt;script type=&quot;text/javascript&quot;&gt;<br>  var svg = document.createElementNS(&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot;, &quot;svg&quot;);<br>  svg.setAttribute(&quot;width&quot;,&quot;150&quot;);<br>
  svg.setAttribute(&quot;height&quot;,&quot;150&quot;);<br>  var rect = document.createElementNS(&quot;<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>&quot;, &quot;rect&quot;);<br>  rect.setAttribute(&quot;width&quot;,&quot;90&quot;);<br>
  rect.setAttribute(&quot;height&quot;,&quot;90&quot;);<br>  rect.setAttribute(&quot;x&quot;,&quot;30&quot;);<br>  rect.setAttribute(&quot;y&quot;,&quot;30&quot;);<br>  rect.setAttribute(&quot;style&quot;,&quot;fill:#0000ff;fill-opacity:0.75;stroke:#000000;stroke-width:1px&quot;);<br>
  svg.appendChild(rect);<br>  div = document.getElementById(&quot;test&quot;);<br>  div.appendChild(svg);<br>  &lt;/script&gt;   <br>  &lt;/body&gt;<br>&lt;/html&gt;<br><br><div class="gmail_quote">2010/7/27 Thomas PAPIN <span dir="ltr">&lt;<a href="mailto:thomas.papin@gmail.com">thomas.papin@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Chris,<div class="im"><br><br><i>&gt; Then I recommend doing more research into how browsers work. :)</i><br>
<br></div>I am quite sure my question is stupid ! But look to this simple code:<br><br>&lt;?xml version=&quot;1.0&quot;?&gt;     <br>
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>&quot;&gt;<br>&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&quot;&gt;     <br>

&lt;body&gt;<br>&lt;h1&gt;Just a Rectangle&lt;/h1&gt;  <br>&lt;svg<br>   xmlns:svg=&quot;<a href="http://www.w3.org/2000/svg" target="_blank">http://www.w3.org/2000/svg</a>&quot; xmlns=&quot;<a href="http://www.w3.org/2000/svg" target="_blank">http://www.w3.org/2000/svg</a>&quot; version=&quot;1.0&quot; width=&quot;150&quot; height=&quot;150&quot; id=&quot;svg1341&quot;&gt;<br>

  &lt;rect width=&quot;90&quot; height=&quot;90&quot; x=&quot;30&quot; y=&quot;30&quot; style=&quot;fill:#0000ff;fill-opacity:0.75;stroke:#000000;stroke-width:1px&quot; id=&quot;rect1353&quot; /&gt;<br>&lt;/svg&gt;     <br>

  &lt;/body&gt;<br>&lt;/html&gt;<br><br> if this code is in a file with filename<br>- test.xhtml it&#39;s working<br>- test.html nothing displayed.<br><br>My current understanding is that if you want to add SVG to a HTML page, you need to use createElementNS and NS = &quot;<a href="http://www.w3.org/2000/svg" target="_blank">http://www.w3.org/2000/svg</a>&quot;<br>

in this case it will works even if the page  is declared a HTML and not XHTML.<br>You cannot insert SVG in a HTML page except in the SVG is added via javascript <br><br>Is that correct ?<div class="im"><br><i><br><br>&gt;I&#39;m not sure I understand what you&#39;re doing. Can you share<br>


&gt; the OpenLayers JavaScript you are attempting to use?</i><br><br></div>I finally manage to realize what I wanted. Maybe there is a better way.<br><br>My Use case:<br>In a KML file, I have two polygons. One is a mask, the second is the polygon I want to clip<br>

<br>How I did:<br>To realize that I want to use the &quot;clipPath&quot; of SVG<br>First I need to add &lt;defs&gt;&lt;clipPath&gt;mypolygonmask&lt;/clipPath&gt;&lt;defs&gt; to the SVG renderer<br>Then I need to add clip-path attribut to my second polygon.<br>

<br>          GMLlayer.events.register(&quot;loadend&quot;, GMLlayer, function() { <br>                        id = <a href="http://this.id" target="_blank">this.id</a>;<br>                        id = id.replace(/\./g, &#39;\\.&#39;);<br>

                        <br>                        //Add &lt;defs&gt; to SVG Renderer when the layer is loaded<br>                        var defs = document.createElementNS(&quot;<a href="http://www.w3.org/2000/svg" target="_blank">http://www.w3.org/2000/svg</a>&quot;, &quot;defs&quot;);<br>

                        var clipPath = document.createElementNS(&quot;<a href="http://www.w3.org/2000/svg" target="_blank">http://www.w3.org/2000/svg</a>&quot;, &quot;clipPath&quot;);<br>                        clipPath.setAttribute(&quot;id&quot;,&quot;decoupe&quot;);<br>

                        var path = document.createElementNS(&quot;<a href="http://www.w3.org/2000/svg" target="_blank">http://www.w3.org/2000/svg</a>&quot;, &quot;path&quot;);<br>                        path.setAttribute(&quot;id&quot;,&quot;decoupepath&quot;);<br>

                        <br>                        features = this.features;<br>                        //Mask polygon is identified in the KML by name = Mask<br>                        for(i=0;i&lt;features.length;i++) {<br>

                            if (features[i].<a href="http://attributes.name" target="_blank">attributes.name</a> == &quot;Mask&quot;) {<br>                                maskid = features[i].<a href="http://geometry.id" target="_blank">geometry.id</a>;<br>

                                maskid = maskid.replace(/\./g, &#39;\\.&#39;);<br>                                pathO = $(&quot;#&quot;+maskid).get(0);<br><br>                                #Path0 can be NULL, if the polygon mask is not in the current viewbox<br>

                                if (pathO)<br>                                    path.setAttribute(&quot;d&quot;,pathO.getAttribute(&#39;d&#39;));<br>                                continue;<br>                            }<br>

                        }<br>                        <br>                        clipPath.appendChild(path);<br>                        defs.appendChild(clipPath);<br>                        <br>                        root = $(&quot;#&quot;+id+&quot;_svgRoot&quot;).get(0);<br>

                        root.appendChild(defs);<br>                        <br>                        # Add clippath attributes<br>                        $(&quot;#&quot;+id+&quot;_root&quot;).attr(&#39;clip-path&#39;,&quot;url(#decoupe)&quot;);<br>

                    });    <br><br><br>          //Any time the zoom is changed, the polygon is the SVG are regenerated by openlayers, so the mask should be updated too<br>          map.events.register(&quot;zoomend&quot;, GMLlayer, function(e) { <br>

                        id = <a href="http://this.id" target="_blank">this.id</a>;<br>                        id = id.replace(/\./g, &#39;\\.&#39;);<br>                        <br>                        features = this.features;<br>
                        for(i=0;i&lt;features.length;i++) {<br>
                            if (features[i].<a href="http://attributes.name" target="_blank">attributes.name</a> == &quot;Mask&quot;) {<br>                                maskid = features[i].<a href="http://geometry.id" target="_blank">geometry.id</a>;<br>

                                maskid = maskid.replace(/\./g, &#39;\\.&#39;);<br>                                pathO = $(&quot;#&quot;+maskid).get(0);<br>                                //alert(maskid);<br>                                //alert($(&quot;#&quot;+id+&quot;_vroot path:first&quot;).attr(&#39;id&#39;));<br>

                                pathClip = $(&quot;#decoupepath&quot;).get(0);<br>                                if ((pathClip)&amp;&amp;(pathO))<br>                                    pathClip.setAttribute(&quot;d&quot;,pathO.getAttribute(&#39;d&#39;));<br>

                                continue;<br>                            }<br>                        }<br>                    });<br><br><br><div class="gmail_quote">2010/7/22  <span dir="ltr">&lt;<a href="mailto:christopher.schmidt@nokia.com" target="_blank">christopher.schmidt@nokia.com</a>&gt;</span><div>
<div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><br>
On Jul 22, 2010, at 3:59 AM, ext Thomas PAPIN wrote:<br>
<br>
&gt; Hello,<br>
&gt;<br>
&gt; I am trying to understand how the SVG renderer works.<br>
&gt; What I am not understanding is that there is SVG inline even if my webpage is declared has HTML and not XHTML.<br>
&gt; I am not able to understand how this is possible.<br>
<br>
</div>Then I recommend doing more research into how browsers work. :)<br>
<div><br>
&gt; I am looking to that, because in the same time I try to use a clipPath between two polygons in the SVG render of a layer.<br>
&gt; Even if I add a valid SVG, nothing is displayed.<br>
<br>
</div>I&#39;m not sure I understand what you&#39;re doing. Can you share<br>
the OpenLayers JavaScript you are attempting to use?<br>
<br>
-- Chris</blockquote></div></div></div><br>
</blockquote></div><br>