XML News from Thursday, December 9, 2004

Ryan Tomayko has commenced work on Kid, "a simple Pythonic template language for XML based vocabularies. It was spawned as a result of a kinky love triangle between XSLT, TAL, and PHP." The language is based on just five attributes: kid:repeat, kid:if, kid:content, kid:omit, and kid:replace; each of which contains a Python expression. Since this expression can point to externally defined functions, this is most of what you need. In addition there are attribute value templates similar to XSLT's, and <?kid?> processing instructions can embed code directly in the XML document. I'm not sure I approve of the use of processing instructions in the language, but I'm not sure I don't either. Not having to escape XML-significant symbols like < and & in the embedded code is convenient. Kid templates are compiled to Python byte-code and can be imported and invoked like normal Python code. Kid templates generate SAX events and can be used with existing libraries that work along SAX pipelines. Overall it looks like a fairly well-designed, well-thought out system that has clearly learned from the mistakes of gnarly systems like PHP, JSP, and ASP. Why am I not surprised to see this coming out of the Python community?