Hi
I'm trying to access values from XML using the XML::Smart module ( 
http://search.cpan.org/dist/XML-Smart/lib/XML/Smart.pm)

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 %]

However it doesn't display anything, and doesn't throw an error either. I 
suspect that this has something to do with the way in which XML::Smart hides 
the differences between Hashrefs and Arrayrefs (see: 
http://search.cpan.org/dist/XML-Smart/lib/XML/Smart.pm#WHY_AND_HOW_IT_WORKS)

Can anyone think of a way around this? I'm using Template Toolkit 2.14 with 
Catalyst

Thanks for your help,
Rob   
--------------------------------------------------------
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

Reply via email to