Previously I had copy/pasted XML fragments three times, ugly.  Now factored out.