Quick background for this; Anyone who hasn't seen this poor example of
code have a quick look at:

  http://london.pm.org/~mark/ttxpath/

This is basically my attempts at getting XML pulled out from a file
using XPath and then rendered out recursively with a view. The basic
problem is that I need to map tag names to view names...and the view
doesn't provide a easy way to do this. I'd describe what I've done now
as a kludge.

As you can see it does this by having a re-delegation block for each of
the objects that the view has which then looks up the tag's name and
calls that block. However, it's all rather icky and has all the code in
Template Toolkit code. Is there any way I can get this logic out of the
presentation layer?

I was thinking for something like:

  [% VIEW(map_function => foo ) %]

Where foo has been loaded into the stash and is an anonymous subroutine or
some such that does the calculation mapping the thing between it's being
asked to present to a block name.  Alternatively (though admittedly I've
only skimmed the code) the map function could call the stash entry so that
we can load map with a hash, sub or whatever...

Though...if anyone has a better suggestion (or even something I've missed)

Later.

Mark.

-- 
s''  Mark Fowler                Technology Developer         Profero Ltd
     http://www.profero.com/      [EMAIL PROTECTED]         020 7700 9960
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}



Reply via email to