""But nokogiri has another problem, which unwrap CDATA."" You can't preserve CDATA or !ENTITY using XSLT. The XML parser will expand them, and there is absolutly no way to prevent it. (It causes many headaches for me.) You would have to do it strictly with regular expressions, treating the XML as text. -- Posted via http://www.ruby-forum.com/.