in reply to Re: Re: Template Toolkit and XML
in thread Template Toolkit and XML

Since you can use in-line Perl if you really want to, there is nothing you can do in Perl that you can't do in TT. However, the point of a templating system is to separate your code from your presentation. You want to do processing stuff in perl, where it is most easily expressed, and presentation stuff in TT, where it is most easily expressed.

The requirement to "do it all" in the template is misguided, and I'd suggest you try to find out who came up with that and why. It will work, but it makes your template more complex and possibly too difficult for a non-programmer to modify.

Replies are listed 'Best First'.
Re: Re: Re: Re: Template Toolkit and XML
by Anonymous Monk on Apr 21, 2004 at 01:13 UTC

    Well, that looks like two votes from you guys, and I definately will change that now. My original plan was to parse "X" keys out, and just dump that to the screen... as you both pointed out, that's misguided. So it seems my idea of "one place" is out of line, I'll change this to throw the variables into TT (which I'll be back tomorrow probably ;)

    It just seemed logical to me to separate the data and presentation layers, but now it seems I have two "middlemen", if you will... one .pl to parse the document, and one to present it -- on top of the data layer. I'm actually wondering why I can't just do this in XSL/T (which it seems pretty much what this module is doing) and drop it in that way. The one who suggested it happens to be the boss, and he's not up on Perl/TT that much either. Luckily, he's the type that should listen to reason.

    --DesertGhost

    Thanks to you both... I'll get on this tomorrow and see if that's a bit easier.

      It just seemed logical to me to separate the data and presentation layers

      Right, which is exactly what you are not doing by making your template parse the data and decide what to display.

      I'm actually wondering why I can't just do this in XSL/T

      You probably can. Go for it, if you like XSLT. XML::LibXML is still probably your best bet for that.