[lxml-dev] Templating
Audun Wilhelmsen
skyfex at gmail.com
Thu Feb 5 23:31:06 CET 2009
Hey
I'd like to use lxml for creating a simple HTML templating engine, by
implementing some custom tags and attributes.
A simple example:
<p gc:text="foobar"></p>
Would replace the text content of the tag with the variable foobar.
But I'm not sure how to implement it using lxml. I've been using
Genshi succesfully, by simply processing the tag stream before
serializing. But I'd like to have the DOM-like capabilities and speed
of lxml.
What would be the best approach? I've been trying to use XPath to find
all the elements and attributes with a gc: prefix, but with little
success so far (maybe mixing namespaces with non-xml html doesn't work
that well?).
Audun Wilhelmsen
Student, NTNU, Norway
More information about the lxml-dev
mailing list