| ||
![]() |
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">
Or use this match to create a button: <xsl:template match="xhtml:a" mode="parentlink">
|