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

Curtis Maloney curtis@umd.com.au
Wed, 2 Aug 2000 10:22:18 +1000


On Tue, 01 Aug 2000, Jean Jordaan wrote:
> Hi Curtis & all
>
> > yuck....
>
> indeed.
>
> Just thinking aloud ..
>
> I got as far as:
>
> <dtml-in "teams[0].getElementsByTagName('team')">
>     <dtml-in "objectValues('member')">
> !! but now I can't see 'team' anymore :(

Erm... I was banking on it still being in the namespace, since all the 
dtml-in does is push another object onto the namespace.

>         <dtml-let membername="text_content">
>         <dtml-var membername> is member of
>         <dtml-in "objectValues('team')">
> !! this whole -in never contains anything .. because
> !! I'm already -in member (Have I got this right?)
>             <dtml-var "text_content('name')">
>             <dtml-in "objectValues('member')">
>                 <dtml-if "text_content == membername">
>                     <dtml-var name>,
> !! AFAICT 'name' won't be visible -in 'member' ..
>                 </dtml-if>
>             </dtml-in>
>         </dtml-in>
>         </dtml-let>
> <br>
>     </dtml-in>
> </dtml-in>
>
> I think I need a lot more Python than I know ..

I've got this far with almost 0 python knowledge. (o8

But yes, learning some Python can be a very helpful thing.
> 1. objectValues returns a list -- this needs to get sorted
>    & duplicates dropped.
sorting is easy with dtml-in.... removing duplicats is another story...

> 2. when -in team and -in member, the name of the team
>    needs to be accessible.

As I said earlier, AIUI name should still be in the namespace.

Have a better one,
	Curtis