not sure what your issue is, but looking at your <A> tag, wouldn't you want to have quotes around the href param?
sorta like : (in red - not easy to see)
document.write("<a href='" + y +x.getNamedItem("id").nodeValue + "'>" + x.getNamedItem("title").nodeValue + "</a>
");