|
usage
how to make use of JSTAL
IntroductionJSTAL should work with:
UsageThe template has to be E4X XML object with TAL namespace. Simplest way to create it is: var template = new XML( <div xmlns:tal="http://xml.zope.org/namespaces/tal"> <p tal:content="data/author">author</p> <p tal:content="data/nested/deeper/hello">author</p> <p tal:replace="data/nested/array[0]">author</p> </div>); TAL attribute values may be global variables, but it's better to keep them in single object, for example var data = {
author : "pawel",
nested : {
array : ['one', 'two'],
deeper : {
hello : 'Hello, world!'
}
}to render the templateyou just need new JSTAL(template).execute(); There some environment-specific rules:
|
Sign in to add a comment