<xsl:template name="apply-annotations">
<xsl:if test="$annotation.support != 0">
<!-- do any annotations apply to the context node? -->
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
<xsl:variable name="aids">
<xsl:for-each select="//d:annotation">
<xsl:if test="@annotates=$id or starts-with(@annotates, concat($id, ' ')) or contains(@annotates, concat(' ', $id, ' ')) or substring(@annotates, string-length(@annotates)-3) = concat(' ', $id)">
<xsl:value-of select="generate-id()"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="normalize-space(@annotations) != ''">
<xsl:call-template name="annotations-pointed-to">
<xsl:with-param name="annotations" select="normalize-space(@annotations)"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:if test="$aids != ''">
<xsl:call-template name="apply-annotations-by-gid">
<xsl:with-param name="gids" select="normalize-space($aids)"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template> |