+
+<xsl:template name="a_menu">
+ <xsl:copy>
+ <xsl:choose>
+ <xsl:when test="starts-with(@href,'/') or
+ starts-with(@href,'http://') or
+ starts-with(@href,'mailto:')">
+ <xsl:copy-of select="@href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$path_to_top"/>
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="@href"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="text()"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template mode="menu" match="*|text()|@*">
+ <xsl:choose>
+ <xsl:when test="name(.) = 'a'">
+ <xsl:call-template name="a_menu"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy>
+ <xsl:apply-templates mode="menu" select="*|text()|@*"/>
+ </xsl:copy>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+