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
I am an absolute xslt beginner and am developing my first umbraco application.
I want to list all the sub nodes of a parent where the name of the parent remains fixed.
Here is my node structure
Home-Abc-efg-hij
About Us-blah-blah
i want to write an xslt file where it always returns the children of Home. Even when i am navigation thru the about us page.
I only want the results to be one level deep.
I know there is a topic like this on umbraco forums but i have tried that and its not working for me[me=umbraco beginner].
Any help would be greatly appreciated.
Hi amein,
Here's a start:
<xsl:variable name="homeNodeId" select="/macro/homeNodeId" /> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($homeNodeId)/node"> <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName" /></a></li> </xsl:for-each> </ul>
In above snippet, homeNodeId is a parameter you'd pass from the macro (that references the xslt file) onto the xslt. Alias for that parameter should be (for this example) homeNodeId.
Hope this helps.
Regards,
/Dirk
Try to start out with the built in "List subpages from a changeable source" xslt template.
Then look at this line:
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']">
Here you need to change the $source to the ID of your home node. You could do it by hardcoding the ID:
<xsl:for-each select="umbraco.library:GetXmlNodeById(1234)/node [string(data [@alias='umbracoNaviHide']) != '1']">
Or by getting the ID in the variable by page name in the variable (a bit further up in the file):
<xsl:variable name="source" select="$currentPage/ancestor-or-self::root/descendant::node [@nodeName = 'Home'][1]/@id"/>
Try it out :-)
Thank you guys that works great...
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get subpage from a specific parent.
I am an absolute xslt beginner and am developing my first umbraco application.
I want to list all the sub nodes of a parent where the name of the parent remains fixed.
Here is my node structure
Home
-Abc
-efg
-hij
About Us
-blah
-blah
i want to write an xslt file where it always returns the children of Home. Even when i am navigation thru the about us page.
I only want the results to be one level deep.
I know there is a topic like this on umbraco forums but i have tried that and its not working for me[me=umbraco beginner].
Any help would be greatly appreciated.
Hi amein,
Here's a start:
In above snippet, homeNodeId is a parameter you'd pass from the macro (that references the xslt file) onto the xslt. Alias for that parameter should be (for this example) homeNodeId.
Hope this helps.
Regards,
/Dirk
Try to start out with the built in "List subpages from a changeable source" xslt template.
Then look at this line:
Here you need to change the $source to the ID of your home node. You could do it by hardcoding the ID:
Or by getting the ID in the variable by page name in the variable (a bit further up in the file):
Try it out :-)
Thank you guys that works great...
is working on a reply...