Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Creating a Link to the Parent of the Current Document

You could parse the current URL to create a URL for the parent document. This requires finding the text before the last slash, then adding the optional language component and ".html". A much easier method is to use the breadcrumb navigation element:

Assuming the defaults:
1. The breadcrumb navigation is aggregated.
2. There is a template that copies all elements without a specific template.
3. There are no templates that damage A tags.
You can add a link to the parent document with:
<xsl:apply-templates select="xhtml:div[@id = 'breadcrumb']/xhtml:a[last()]"/>

For more fun, use
<xsl:apply-templates select="xhtml:div[@id = 'breadcrumb']/xhtml:a[last()]" mode="parentlink"/>

Then add a match for the A tag:

This example separates the information, then recreates the original link, but it demonstrates how to access the information.
<xsl:template match="xhtml:a" mode="parentlink">
<xsl:variable name="parentlinkurl"><xsl:value-of select="@href"/></xsl:variable>
<xsl:variable name="parenttitle"><xsl:value-of select="."/></xsl:variable>
<A HREF="{$parentlinkurl}"><xsl:value-of select="$parenttitle"/></A>
</xsl:template>


Or use this match to create a button:
<xsl:template match="xhtml:a" mode="parentlink">
<xsl:variable name="parentlinkurl"><xsl:value-of select="@href"/></xsl:variable>
<xsl:variable name="parenttitle"><xsl:value-of select="."/></xsl:variable>
<A HREF="{$parentlinkurl}"><xsl:value-of select="$parenttitle"/></A>
<INPUT TYPE="BUTTON" OnClick="javascript:window.location='{$parentlinkurl}';" VALUE="PARENT: {$parenttitle}"/>
</xsl:template>


<< Website Map with DescriptionsMenu: Top-Level >>

Contact Solprovider
Paul Ercolino