Thanks for your reply Mark, I have used XML::Simple, though I have found it frustrating when dealing with more complex XML. I was investigating XML::Smart as a potential replacement, however it's apparent non-compatibility with TT is a bit of a show stopper.
Thanks Rob -----Original Message----- From: Thomas, Mark - BLS CTR [mailto:[EMAIL PROTECTED] Sent: 29 June 2006 17:39 To: Robert Clarke; [email protected] Subject: [SPAM] - RE: [Templates] Using XML::Smart with template toolkit - Email found in subject > Assuming that I have some XML like this > > <person> > <name>mr jones</name> > <contact> > <telephone>01234 5678910</telephone> > </contact> > </person> > > I can create an XML::Smart object using this XML and access > the values in perl as follows: > > $telephoneno = $myxml->{person}->{contact}->{telephone}; > > If I pass the XML::Smart object into a TT template I would > expect this to display the telephone number > > [% myxml.person.contact.telephone %] It would seem that TT is getting hung up on Object::Multitype, which is used by XML::Smart. Have you checked out XML::Simple? It creates a regular hash, so if you do: my $person = XMLin($xml); Then you can have the (normal) perl hash: my $telephoneno = $person->{contact}->{telephone}; And you should be able use it in your template: [% person.contact.telephone %] -- Mark Thomas -------------------------------------------------------- GMG Regional Digital is part of the Guardian Media Group plc. CONFIDENTIALITY NOTICE. The information contained in this e-mail is intended only for [EMAIL PROTECTED] It may contain privileged and confidential information that is exempt from disclosure by law and if you are not an intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this e-mail in error, you may notify us by telephone on 44 (0)161 832 7200. E-mail transmission cannot be guaranteed to be secure or error-free. The sender ([EMAIL PROTECTED]) therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
