Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I have installed 4.7.2 and I need some example XSLT to do the Top Menu
Site is as follows
> Home
> Products
> Services
> Contact Us
Many thanks for your help in advance
Kind Regards
This code might help you, however I am looking right now for more functionalities
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " ">]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:param name="currentPage"/> <!-- Input the documenttype you want here --> <xsl:variable name="level" select="1"/> <xsl:template match="/"> <ul id="topNavigation"> <li class="home topNavigLi has_submenu"> <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id"> <xsl:attribute name="class">home current topNavigLi has_submenu</xsl:attribute> </xsl:if> <a href="/" style="width:200px;">About Patient Direct</a> <ul class="submenu"> <li class="submenu_first"> <div class="item"> <a href="#">Program Coverage</a> </div> </li> <li class="submenu_middle"> <div class="item"> <a href="#">Eligibility</a> </div> </li> <li class="submenu_middle"> <div class="item"> <a href="#">Terms and Conditions</a> </div> </li> <li class="submenu_middle"> <div class="item"> <a href="#">Frequently Asked Questions</a> </div> </li> <li class="submenu_last"> <a href="#">Brochure</a> </li> </ul> </li> <li class="home separator"> </li> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <xsl:attribute name="class"> topNavigLi page<xsl:number value="position()" format="1" /> <xsl:if test="@nodeName='Network' "> has_submenu network </xsl:if> </xsl:attribute> <xsl:if test="@id = $currentPage/@id"> <xsl:attribute name="class"> current topNavigLi page<xsl:number value="position()" format="1" /> </xsl:attribute> </xsl:if> <xsl:if test="position() = last()"> <xsl:attribute name="class"> last topNavigLi page<xsl:number value="position()" format="1" /> </xsl:attribute> </xsl:if> <xsl:if test="@id = $currentPage/@id and position() = last()"> <xsl:attribute name="class"> current last topNavigLi page<xsl:number value="position()" format="1" /> </xsl:attribute> </xsl:if> <xsl:choose> <xsl:when test="name() = 'Link'"> <a class="navigation" href="{current()/linkUrl}" target="_blank"> <xsl:attribute name="class">last </xsl:attribute> <xsl:value-of select="@nodeName" /> </a> </xsl:when> <xsl:otherwise> <a class="navigation" href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName" /> </a> <xsl:if test="@nodeName='Network' "> <ul class="submenu"> <li class="submenu_first"> <div class="item"> <a href="#">About the Patient Direct Network</a> </div> </li> <li class="submenu_last"> <a href="#">Dentist Search</a> </li> </ul> </xsl:if> </xsl:otherwise> </xsl:choose> </li> <xsl:if test="position()!=last() "> <li> <xsl:attribute name="class"> separator page<xsl:number value="position()" format="1" /> </xsl:attribute> </li> </xsl:if> </xsl:for-each> </ul> </xsl:template></xsl:stylesheet>
Hi Praveen,
What you can do is
<xsl:variable name="level" select="1"/><xsl:template match="/"><ul><xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc][not(umbracoNaviHide = 1)]"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li></xsl:for-each></ul>
Remember to add your other pages Products, Services and Contact Us on a different level.
- Content-- Home --- Products--- Services --- Contact Us
Hope this helps
Fuji, can you please take a look @ http://our.umbraco.org/forum/developers/xslt/33326-How-to-display-sitemapnavigation-for-a-site-using-xslt; I am waiting for an answer :|
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Top menu
Hi
I have installed 4.7.2 and I need some example XSLT to do the Top Menu
Site is as follows
> Home
> Products
> Services
> Contact Us
Many thanks for your help in advance
Kind Regards
This code might help you, however I am looking right now for more functionalities
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="topNavigation">
<li class="home topNavigLi has_submenu">
<xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
<xsl:attribute name="class">home current topNavigLi has_submenu</xsl:attribute>
</xsl:if>
<a href="/" style="width:200px;">About Patient Direct</a>
<ul class="submenu">
<li class="submenu_first">
<div class="item">
<a href="#">Program Coverage</a>
</div>
</li>
<li class="submenu_middle">
<div class="item">
<a href="#">Eligibility</a>
</div>
</li>
<li class="submenu_middle">
<div class="item">
<a href="#">Terms and Conditions</a>
</div>
</li>
<li class="submenu_middle">
<div class="item">
<a href="#">Frequently Asked Questions</a>
</div>
</li>
<li class="submenu_last">
<a href="#">Brochure</a>
</li>
</ul>
</li>
<li class="home separator">
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:attribute name="class">
topNavigLi
page<xsl:number value="position()" format="1" />
<xsl:if test="@nodeName='Network' ">
has_submenu network
</xsl:if>
</xsl:attribute>
<xsl:if test="@id = $currentPage/@id">
<xsl:attribute name="class">
current topNavigLi
page<xsl:number value="position()" format="1" />
</xsl:attribute>
</xsl:if>
<xsl:if test="position() = last()">
<xsl:attribute name="class">
last topNavigLi
page<xsl:number value="position()" format="1" />
</xsl:attribute>
</xsl:if>
<xsl:if test="@id = $currentPage/@id and position() = last()">
<xsl:attribute name="class">
current last topNavigLi
page<xsl:number value="position()" format="1" />
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="name() = 'Link'">
<a class="navigation" href="{current()/linkUrl}" target="_blank">
<xsl:attribute name="class">last
</xsl:attribute>
<xsl:value-of select="@nodeName" />
</a>
</xsl:when>
<xsl:otherwise>
<a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName" />
</a>
<xsl:if test="@nodeName='Network' ">
<ul class="submenu">
<li class="submenu_first">
<div class="item">
<a href="#">About the Patient Direct Network</a>
</div>
</li>
<li class="submenu_last">
<a href="#">Dentist Search</a>
</li>
</ul>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</li>
<xsl:if test="position()!=last() ">
<li>
<xsl:attribute name="class">
separator
page<xsl:number value="position()" format="1" />
</xsl:attribute>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi Praveen,
What you can do is
Remember to add your other pages Products, Services and Contact Us on a different level.
- Content
-- Home
--- Products
--- Services
--- Contact Us
Hope this helps
Fuji, can you please take a look @ http://our.umbraco.org/forum/developers/xslt/33326-How-to-display-sitemapnavigation-for-a-site-using-xslt; I am waiting for an answer :|
is working on a reply...