Forum


HomeHomePremiumPremiumSkinningSkinningXSLT Menu TemplatesXSLT Menu Templates
Previous
 
Next
New Post
3/13/2013 1:42 AM
 

Hi Aderson,

Can you help me with this problem? I your XSLT templates were very helpful, but I still need more practice to fully understand how to use them properly...


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="SkinPath"></xsl:param>
<xsl:output method="html"/>
<xsl:template match="/*">
<xsl:apply-templates select="root" />
</xsl:template>
<xsl:template match="root">
<ul id="mainnav">
<xsl:apply-templates select="node" />
</ul>
</xsl:template>
<xsl:template match="node">


<li>
<xsl:attribute name="class">
            <xsl:text></xsl:text>
                 
<xsl:if test="@first = 1"><xsl:text>&#32;</xsl:text>first</xsl:if>
<xsl:if test="@last = 1"><xsl:text>&#32;</xsl:text>last</xsl:if>
<xsl:if test="@selected = 1"><xsl:text>&#32;</xsl:text>item-active</xsl:if>
</xsl:attribute>
<xsl:choose>
<xsl:when test="@enabled = 1">
<a href="{@url}">
<xsl:value-of select="@text" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@text" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="node">
<ul>
<xsl:apply-templates select="node" />
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>


This is my code, I understand how to add classes to the "li" elements... but how would I add a class of "current", to the <a> element instead?


Thanks in advance



 
New Post
3/13/2013 4:44 AM
 

Hi Purple,

I wasn't the one who has created that article. Armand Datema was the one. I will send your question to him and see if he can help.

Cheers,

Aderson

 
New Post
3/13/2013 8:49 AM
 

Hi

easiest way would be

 

<a>

 <xsl:if test="@breadcrumb=1">

<xsl:attribute name="class">

 <xsl:text>current</xsl:text>

</xsl:attribute>

</xsl:if>

</a>

 
New Post
3/13/2013 8:50 AM
 

Thank you Armand!

 
Previous
 
Next
HomeHomePremiumPremiumSkinningSkinningXSLT Menu TemplatesXSLT Menu Templates



Try FREE
30 days money back guaranteed