The value for the nodeName for the whole document is $DOCUMENT.
However, the macro that does this in XMetaL Author uses a different strategy. That macro is in the xmetal.mcr in the Macros folder in XMetaL Author Essential and Enterprise.
Here's a copy (note that the first comment is outdated and incorrect, though it does not apply to XMAX anyway):
<MACRO name="On_Update_UI" hide="true" lang="JScript">
<![CDATA[
// this will only work if no On_Update_UI macro is defined for the DTD
if (Selection.IsInsertionPoint && ActiveDocument.ViewType == 1) {
// this should only apply to the tags-on view, and allow selection of the top-level element
if (Selection.ContainerNode == null) {
Selection.MoveRight();
}
if (Selection.ContainerNode == null) {
Selection.MoveLeft();
}
}
]]>
</MACRO>
As written, it allows an author to select, edit and remove things that are outside the root (comments and PIs for example).