New templates have been added in page.xsl to help add code around contents/services that needs not to be cached.
For an example I used them directly in cms/skins/[skin]/templates/[template]/stylesheets/template.xsl but it may be better to use it in another import.
Note that these templates are used for contents, services and wrapper, so you should always check if there is a content-id.
Here are the new templates (before/after a zone and before/after a zone-item)
<xsl:template name="zone-before">
<xsl:param name="count"/>
<xsl:param name="zone-name"/>
<xsl:param name="level"/>
<xsl:param name="inherited"/>
</xsl:template>
<xsl:template name="zone-after">
<xsl:param name="count"/>
<xsl:param name="zone-name"/>
<xsl:param name="level"/>
<xsl:param name="inherited"/>
</xsl:template>
<xsl:template name="zone-item-before">
<xsl:param name="position"/>
<xsl:param name="count"/>
<xsl:param name="zone-name"/>
<xsl:param name="level"/>
<xsl:param name="inherited"/>
<xsl:param name="id"/>
<xsl:param name="type"/>
<xsl:param name="content-id"/>
<xsl:param name="service"/>
<xsl:param name="content-type"/>
</xsl:template>
<xsl:template name="zone-item-after">
<xsl:param name="position"/>
<xsl:param name="count"/>
<xsl:param name="zone-name"/>
<xsl:param name="level"/>
<xsl:param name="inherited"/>
<xsl:param name="id"/>
<xsl:param name="type"/>
<xsl:param name="content-id"/>
<xsl:param name="service"/>
<xsl:param name="content-type"/>
</xsl:template>
Doc was modified here https://docs.ametys.org/fr/ametys-v4/manuel-de-parametrage-et-d-integration/integration-graphique/definition-de-gabarit/ecriture-d-un-gabarit.html