Hi. I'm working with XML and REXML and I could use some help in two particular issues: First, I want to display a REXML::Document object. I'm creating the object from a string that contains a valid xml, something like: <company> <name>Gecamin</name> <address>Paseo Bulnes 197</address> <employees> <employee> <first-name>Fernando</first-name> <last-name>Poblete</last-name> </employee> <employee> ..... </employee> </employees> </company> And I want to produce HTML as follows: <div class='company'> <p>Name: Gecamin</p> <p>Address: Paseo Bulnes 197</p> <div class='employees'> Employees <div class='employee'> <p>First Name: Fernando</p> <p>Last Name: Poblete</p> .... ... The second thing is that I'm working with two versions of a same record, each one in a different REXML::Document object. So I have @old_record_xml and @new_record_xml and want to compare them in order to indicate which fields has changed from old version to new version. So if an employee's first name has been changedn I want to produce HTML like <p class='updated'>First Name: Fer</p> I know XPath is the best answer but I haven't been able to figure it out. Could anyone give me some tips? Thanks.
on 2007-05-04 20:41
on 2007-05-05 08:45
For your first problem, it sounds like you should be using XSLT: http://greg.rubyfr.net/pub/packages/ruby-xslt/file... For your second, I've never heard of XPath being used for this, but I could be wrong. It sounds like you'll just have to write your own compare function that will emit nodes that have changed. On May 5, 12:41 am, Fernando P. <rails-mailing-l...@andreas-
on 2007-05-05 19:13