Where as we always seem to get right
var template = '<p id="'+base_id+'-a">This is the template. ' +
'<b id="'+base_id+'-b">And this is the tempalate, too.</b></p>';
This is the template. <b id="xxx-b">And this is the tempalate, too.</b>
Unfortunately, there is no deep clone for DOM elements. And even if there was one I suspect it would not handle ID attributes as I wanted. So I wrote my own clone_dom and clone_dom_element functions.