Hey i have one page where i need to show the sub menu items from one menu. I dont want to show all sub menu items but only those that belong under a particular menu item.Like eg i have Services menu then under Services i have 4 sub items then when i go to the 1st sub item page then the rest 3 should get displayed on that page. Please help me with this as soon as possible. Thank you.
Hey thanks for this. I have displayed the sub items through the built in xslt i.e. listing subpages from changable source.Now one thing is want is that i have Services menu in that i have Service 1, Service 2 and so on .So when a user goes inside Service1 page i have the submenu listed there which lists every subitem inside the services menu. So inside this submenu i want that Service1 should be highlighted so the user comes to know that which page is he on. Can you please tell me how can I achieve this. I want the similar functionality for all subpages.
Hey please help me with this. I want the current page node name so how can i get it. I want the name of the page that is currently being displayed.Please respond as soon as possible.
I want to know on which technology u r working. If u have no problem can we share our ideas.I want ot become u r frnd.i m poor in xslt can u send me any useful documentation on xslt.
Hey Chris Thanks a lot. Can you please help me with this more. I want to compare the current node with all the sub nodes and want to write an if block that if the node is equal then i want the color of that text to be white. So if the node is the current node than the color of that text should be different than other nodes. Please provide me with the solution. Thanks in advance.
Getting child node items
Hey i have one page where i need to show the sub menu items from one menu. I dont want to show all sub menu items but only those that belong under a particular menu item.Like eg i have Services menu then under Services i have 4 sub items then when i go to the 1st sub item page then the rest 3 should get displayed on that page. Please help me with this as soon as possible. Thank you.
Akruti.
I don't have an XSLT example right now, but this is what you should do:
In the $currentPage, go up one level (with $currentPage/..) and do a for-each on the subitems of that parent node.
In your for-each, check if the id of the subpage is equals to the current page, don't show the submenu when the id's are the same.
Hey thanks for this. I have displayed the sub items through the built in xslt i.e. listing subpages from changable source.Now one thing is want is that i have Services menu in that i have Service 1, Service 2 and so on .So when a user goes inside Service1 page i have the submenu listed there which lists every subitem inside the services menu. So inside this submenu i want that Service1 should be highlighted so the user comes to know that which page is he on. Can you please tell me how can I achieve this. I want the similar functionality for all subpages.
Hi akruti,
My name is vijay.I m from mumbai.I m also new to Umbraco.Can we share our knowledge about umbraco if you have no problem.
hope you will give positive reply.
Have a nice day......tc.....bye.
--vijay.
Hey vijay i really dont have much idea on this but i have just read some documentation on umbraco.That was a good start for me.
Hey please help me with this. I want the current page node name so how can i get it. I want the name of the page that is currently being displayed.Please respond as soon as possible.
try this:
<?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"/>
<xsl:param name="level" select="1"/>
<xsl:template match="/">
<xsl:call-template name="menu">
<xsl:with-param name="level" select="$level"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="menu">
<xsl:param name="level"/>
<xsl:if test="count($currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']) > '0'">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
<li>
<xsl:choose>
<xsl:when test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<strong>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</strong>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:call-template name="menu">
<xsl:with-param name="level" select="$level+1"/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
hi Akruti,
I want to know on which technology u r working. If u have no problem can we share our ideas.I want ot become u r frnd.i m poor in xslt can u send me any useful documentation on xslt.
tc bye..
vijay.
Hi akruti,
Kemcho.If u have no problem mail me on [email protected].
Hope for positive reply.
--vijay.
Hi,
To answer one of Akruti's questions above to just get the current page's name using XSLT:
Or you can also use:
By using the second example it will also work if you include this within a for-each loop.
Cheers,
Chris
Hey Chris Thanks a lot. Can you please help me with this more. I want to compare the current node with all the sub nodes and want to write an if block that if the node is equal then i want the color of that text to be white. So if the node is the current node than the color of that text should be different than other nodes. Please provide me with the solution. Thanks in advance.
You mean adding a class to the list item (li) of the selected node?
Then this should work.
<xsl:if test="$currentPage/self::node/@id = current()/@id">
<xsl:attribute name="class">selected</xsl:attribute>
</xsl:if>
Hey thanks dennish. I managed to compare it with <xsl:when> block.
Hi Akruti,
I wish u a happy new year.
----- vijay.
is working on a reply...