[Solved] Insert a date in a Diazo base template?

I'm trying to insert the value of current year in the base template of a Diazo theme.

In my template, I have:
<span id="year">2019</span>

In my rules.xml I have:
<replace css:theme="span#year"> <xsl:value-of select="2020" /> </replace>
It works, but is it possible to use a function to insert the value?

I would use theme fragments, then you can do all the logic in py files.

It works very well; in a fragment:

<span id="year"
  tal:define="date context/Date"
  tal:content="python:date[:4]" />