Be sure to look at the Taconite framework, too! With it you barely have to write any JavaScript and can write new or updated XHTML as XHTML, rather than using JavaScript commands like document.createElement and document.appendChild.
Taconite is an Apache 2 licensed project available here:
http://taconite.sf.net. Ryan Asleson
Co-Author, "Foundations of Ajax"
Taconite Lead Developer (taconite.sf.net)
Ryan Asleson<br />Co-Author, <a href="http://www.amazon.com/Foundations-Ajax-Foundation-Ryan-Asleson/dp/1590595823/sr=1-1/qid=1158926537/ref=pd_bbs_1/002-7412154-2924860?ie=UTF8&s=books" target="_blank" rel="nofollow">Foundations of Ajax</a> and <a href="http://www.amazon.com/Pro-Ajax-Java-Frameworks/dp/1590596773/ref=sr_11_1/002-7412154-2924860?ie=UTF8" target="_blank" rel="nofollow">Pro Ajax and Java Frameworks</a><br /><a href="http://taconite.sf.net" target="_blank" rel="nofollow">Taconite</a> Lead Developer