Yes, you can do this.
The XMetaL Developer Programmer's Guide has information on all the DOM APIs XMetaL Author and XMAX support. I would probably start my reading with the topic "DOMDocumentFragment" in your case which has an example similar to what you are asking for. Read this topic as well: "DOM interfaces".
You can view that topic here as well if you don't have XMetaL Developer:
http://na.justsystems.com/webhelp/en/xmetaldeveloper/pg/6.0/pg.html#DOMDocumentFragment