support extend for xtemplate.Fixes #564