Haxe isn't a scripting language that can be called from within a html file in that way. You have to adapt a workflow where you prepare your html templates and your data as separate units and let the compiled application combine them according to your wishes.
Here's a quick example that should work in any Haxe server target language (php, neko, cpp). (Maybe also java and c# - not sure if the Template implementation is ready) :
package ;
import haxe.Template;
import neko.Lib;
class Main
{
static function main()
{
var data = { greeting: 'Hello' };
var template = new Template('<html><body>::greeting::</body></html>');
var output = template.execute(data);
Sys.print(output);
}
}
There are a bunch of template engines for Haxe out there, for example the .NET Razor clone Erazor