Work around xmlhtml bug #10

Also add a test case for empty node replacement.