Posted By

stentebjerg on 01/11/12


Tagged


Versions (?)

TopMenu


 / Published in: XSLT
 

XSLT menu

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE xsl:stylesheet [
  3. <!ENTITY nbsp "&#x00A0;">
  4. ]>
  5. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:random="http://www.microsoft.com/msxsl" xmlns:get="urn:Exslt.ExsltMath" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" version="1.0" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets random get">
  6. <xsl:output method="xml" omit-xml-declaration="yes"/>
  7. <xsl:param name="currentPage"/>
  8. <xsl:variable name="level" select="1"/>
  9. <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
  10. <xsl:template match="/">
  11. <div id="nav">
  12. <ul class="secondaryMenu contain">
  13. <xsl:apply-templates select="$siteRoot[self::SubfrontSecondary]"/>
  14. </ul>
  15. <!-- .secondaryMenu -->
  16. <ul class="primaryMenu contain">
  17. <xsl:apply-templates select="$siteRoot[self::SubfrontPrimary | Event]"/>
  18. </ul>
  19. <!-- .primaryMenu -->
  20. </div>
  21. <!-- #nav -->
  22. </xsl:template>
  23. <xsl:template match="SubfrontPrimary | Events | Event | SubfrontSecondary | Undersidebred">
  24. <li>
  25. <xsl:attribute name="class">
  26. <xsl:text>trigger</xsl:text>
  27. </xsl:attribute>
  28. <xsl:if test="$currentPage/ancestor-or-self::*[@id = current()/@id]">
  29. <xsl:attribute name="class">trigger selected</xsl:attribute>
  30. </xsl:if>
  31. <a>
  32. <xsl:attribute name="href">
  33. <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
  34. </xsl:attribute>
  35. <xsl:value-of select="@nodeName"/>
  36. </a>
  37. </li>
  38. </xsl:template>
  39. </xsl:stylesheet>

Report this snippet  

You need to login to post a comment.