improved choice handling in the XML encoder

This was necessary to support the new everest feature of passing
collections containing links.