-<!-- get the http session
-->
<o:variable name="session" select="$servlet:req.getSession()"/>
-<!-- get a simple counter variable from the session
-->
<o:variable name="counter" select="$session.getAttribute('counter')"/>
-<o:if test="not($counter)">
-<!-- it doesn't exist - create
-->
<o:variable name="counter" select="1"/>
</o:if>
-<!-- increment the counter and save it to the session
-->
<o:eval select="$session.setAttribute('counter', $counter + 1)"/>
</session>