"$xhtml Replace & by & for xml compilance." -- did you meant "$xhtml Replace & by & for xml compilance." ?