получилось
function f() {
var t = document.getElementById("layer2")
alert( document)
var content = document.createElement('g')
//alert(content)
content = new DOMParser().parseFromString( "<svg version='1.1' xmlns='http://www.w3.org/2000/svg'>" +
"<g>" +
"<rect width='1053.5891' height='291.32797' x='-178.22313' y='0.98392' id='rect3638' style='opacity:1;fill:url(#radialGradient3880);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.1880002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1' />" +
"</g>" +
"</svg>", "application/xhtml+xml" ).documentElement.firstElementChild;
// alert(content)
// alert( t )
t.appendChild(content)
}