add validate() method to check template syntax