This doesn't work:
<xsl:apply-templates select="citation[@id=./@ref]"/>
because the context node changes with the step expression.
But you can save the context and use it later:
<xsl:variable name="current" select="."/> <xsl:apply-templates select="citation[@id=$current/@ref]"/>
Or just save the value:
<xsl:variable name="ref" select="@ref"/> <xsl:apply-templates select="citation[@id=$ref]"/>