Umbraco - XSLT - List Sub Pages from a Specific Node, by Node Id

The following Umbraco XSLT list all sub pages from a specific Node using node ID.  The important bit is Highlighted.  

1)  umbraco.library:GetXmlNodeById(1062) <-- list all sub pages of nodeId 62.

2) You could replace this line above with something like this: umbraco.library:GetXmlNodeById($currentPage/chooseSubPagesToList)

and in your DocType, there would be a contentPicker called 'chooseSubPagesToList.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<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" 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" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">

<xsl:output method="xml" omit-xml-declaration="yes" />

<xsl:param name="currentPage"/>


<xsl:template match="/">

<!-- The fun starts here -->
<ul>
<xsl:for-each select="umbraco.library:GetXmlNodeById(1062)/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
&gt; <a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>

</xsl:template>

</xsl:stylesheet>

Comments

Popular posts from this blog

Umbraco - Reset the Admin Password via SQL Server

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version