My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 25, 2009 by pawel.knapik
usage  
how to make use of JSTAL

Introduction

JSTAL should work with:

Usage

The 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 template

you just need new JSTAL(template).execute();

There some environment-specific rules:


Sign in to add a comment
Hosted by Google Code