Loading ...
Sorry, an error occurred while loading the content.

[Cheetahtemplate-discuss] populating template from a dom object

Expand Messages
  • Tim Arnold
    Hi, I m new to Cheetah. I was wondering if it s possible to populate a set of Cheetah templates from a document object model. For example, I have a DocBook XML
    Message 1 of 3 , Jan 12, 2010
    • 0 Attachment
      Hi,
      I'm new to Cheetah. I was wondering if it's possible to populate a set of Cheetah templates from a document object model.
      For example, I have a DocBook XML file that I can read and parse into a tree using lxml; is there a way I can apply a set of Cheetah templates to render that object into HTML?

      I know about the DocBook XSLT stylesheets, I was just wondering if the Cheetah template method is feasible.

      thanks,
      --Tim



      ------------------------------------------------------------------------------
      This SF.Net email is sponsored by the Verizon Developer Community
      Take advantage of Verizon's best-in-class app development support
      A streamlined, 14 day to market process makes app distribution fast and easy
      Join now and get one step closer to millions of Verizon customers
      http://p.sf.net/sfu/verizon-dev2dev
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • R. Tyler Ballance
      ... There s no built-in magic for handling this kind of scenario; that said if you re using lxml and you ve already got a handful of Element objects you can
      Message 2 of 3 , Jan 12, 2010
      • 0 Attachment
        On Tue, 12 Jan 2010, Tim Arnold wrote:

        > Hi,
        > I'm new to Cheetah. I was wondering if it's possible to populate a set of Cheetah templates from a document object model.
        > For example, I have a DocBook XML file that I can read and parse into a tree using lxml; is there a way I can apply a set of Cheetah templates to render that object into HTML?
        >
        > I know about the DocBook XSLT stylesheets, I was just wondering if the Cheetah template method is feasible.

        There's no built-in "magic" for handling this kind of scenario; that said if
        you're using lxml and you've already got a handful of Element objects you can
        likely write some template logic (that phrase sounds wrong ;)) to do your
        translation.



        Cheers,
        -R. Tyler Ballance
        --------------------------------------
        Jabber: rtyler@...
        GitHub: http://github.com/rtyler
        Twitter: http://twitter.com/agentdero
        Blog: http://unethicalblogger.com
      • Tim Arnold
        ... Yes, thanks. I wasn t expecting too much magic, but it would be nice! To take a specific example, say I ve got this as an lxml tree:
        Message 3 of 3 , Jan 12, 2010
        • 0 Attachment
          > -----Original Message-----
          > From: R. Tyler Ballance [mailto:tyler@...]
          > Sent: Tuesday, January 12, 2010 1:59 PM
          > To: Tim Arnold
          > Cc: cheetahtemplate-discuss@...
          > Subject: Re: [Cheetahtemplate-discuss] populating template from a dom object
          >
          >
          > On Tue, 12 Jan 2010, Tim Arnold wrote:
          >
          > > Hi,
          > > I'm new to Cheetah. I was wondering if it's possible to populate a set of
          > Cheetah templates from a document object model.
          > > For example, I have a DocBook XML file that I can read and parse into a
          > tree using lxml; is there a way I can apply a set of Cheetah templates to
          > render that object into HTML?
          > >
          > > I know about the DocBook XSLT stylesheets, I was just wondering if the
          > Cheetah template method is feasible.
          >
          > There's no built-in "magic" for handling this kind of scenario; that said if
          > you're using lxml and you've already got a handful of Element objects you
          > can likely write some template logic (that phrase sounds wrong ;)) to do
          > your translation.
          >
          >
          >
          > Cheers,
          > -R. Tyler Ballance
          > --------------------------------------
          > Jabber: rtyler@...
          > GitHub: http://github.com/rtyler
          > Twitter: http://twitter.com/agentdero
          > Blog: http://unethicalblogger.com

          Yes, thanks. I wasn't expecting too much magic, but it would be nice!
          To take a specific example, say I've got this as an lxml tree:
          <chapter>
          <info>
          <title>My first chapter</title>
          </info>
          <para role="intro">my first paragraph</para>
          </chapter>

          I wondered if I had Cheetah templates for chapter, info, title, and para, whether I could use the lxml tree as the namespace to feed in? I'm guessing the templates would belong to a class somehow so they could be referenced as one thing....

          If not, would you mind a snippet of the template logic you mentioned?

          thanks very much,
          --Tim

          ------------------------------------------------------------------------------
          This SF.Net email is sponsored by the Verizon Developer Community
          Take advantage of Verizon's best-in-class app development support
          A streamlined, 14 day to market process makes app distribution fast and easy
          Join now and get one step closer to millions of Verizon customers
          http://p.sf.net/sfu/verizon-dev2dev
          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        Your message has been successfully submitted and would be delivered to recipients shortly.