It appears that this does not work with numbered entities, only named entities.
$nbspace = $dom->createEntityReference('nbsp');
works
$nbspace = $dom->createEntityReference('#160');
does not. This makes this function rather useless when generating an XSL unless you modify the XSL doctype to include the named entity for the character you want.