[Zope] How do I control iteration over XML elements?

Curtis Maloney curtis@umd.com.au
Tue, 1 Aug 2000 10:03:19 +1000


On Tue, 01 Aug 2000, Jean Jordaan wrote:
> Hi all
>
> If I have (in an XML Document):
>
> <teams>
>  <team>
>   <name>Name of team</name>
>   <desc>White papers, brochures, case studies.</desc>
>   <member class="leader">Tracey</member>
>   <member>Eduan</member>
>   <member>Jacqui</member>
>  </team>
> </teams>
>
> Then:
>
> <dtml-in "teams[0].getElementsByTagName('team')">
>  <dtml-var "text_content('member')"> <br>
> </dtml-in>
>
> gives me this:
>
> TraceyEduanJacqui <br>
>
> I'd like to format the output, putting <br>'s between
> all the names, for example. How do I do that?
>
Simple enough.  You just need another dtml-in inside....

replace:
	<dtml-var "text_content('member')"><br>
with:
	<dtml-in "objectValues('member')">
	  <dtml-var text_content><br>
	</dtml-in>

Works for me. (o8

> Cheers,

Have a better one,
	Curtis.