Your question leads me to believe you’re trying to solve a problem in a way that, while possible, probably isn’t the best way to do it with Mendix.
Can you take a step back and edit your question to explain the problem/functionality you’re trying to build?
It feels like you would have more luck creating a custom widget to achieve this.
Mendix brings in the content it needs to display via JavaScript and a custom widget can hook into the workflow and run at the correct times, as well as allowing you the flexibility of setting your own HTML templates.
Take a look at the Widget Development documentation for more details.