views:

88

answers:

0

I'm writing an XSL file that contains a side-nav menu with a list of links. When the user clicks on one of the links, the page jumps to the corresponding table of information for that link. How can I make it so that when the link is clicked, the title of that table (not the link itself) is highlighted? It should also un-highlight if another link is clicked.

Here is the menu of links:

<div onclick = "highlight(this);" onblur = "undoHighlight(this);">
<a href = "#{generate-id(.)}">
<xsl:value-of select = "."/> (<xsl:value-of select = "count(../n1:entry)"/>)
</a>
</div>

This is the javascript for the highlight/undoHighlight functions:

function highlight(link)
{
     undoHighlight(link)
     link.style.background = "red";
}
function undoHighlight(link)
{
     link.style.background = "white"; 
}

Any help would be appreciated. Thanks in advance!

Edit: here is the general template for the tables

<!-- Component/Section -->    
<xsl:template match="n1:component/n1:section">
    <xsl:apply-templates select="n1:title"/>
    <xsl:apply-templates select="n1:text"/>
    <xsl:apply-templates select="n1:component/n1:section"/>    
</xsl:template>

<!--   Title  -->
<xsl:template match="n1:title">
<div id = "dataTitleStyle">      
    <a name="{generate-id(.)}"><xsl:value-of select="."/></a>
</div>
</xsl:template>

<!--   Text   -->
<xsl:template match="n1:text">  
<xsl:apply-templates />
</xsl:template>