which works fine. but I don't want to use the nodeName but the pageTitle from the metatab and I know the field because the following macro in the master template put the pagetitle on the pages
but when I try to use it in the xlst codeI never get anything to display
<xsl:value-of select="@nodeName"/></a>.I have tried replacing @nodeName with @PageTitle, @pageTitle, @data [@alias = 'pageTitle'] and just about anything else I seen in this forum, but nothing seems to work.
SiteMap Help
I was thinking I was begining to understand Xslt but maybe I not.
Using Umbraco 4.7
I modifed the SiteMap Macro to display the data in a way I wanted.
<?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" 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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- update this variable on how deep your site map should be -->
<xsl:variable name="maxLevelForSitemap" select="4"/>
<xsl:template match="/">
<div id="sitemap">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template name="drawNodes">
<xsl:param name="parent"/>
<xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
<ul><xsl:for-each select="$parent/* [@isDoc and @level <= $maxLevelForSitemap]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
<xsl:if test="count(./* [@isDoc and @level <= $maxLevelForSitemap]) > 0">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="."/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
which works fine. but I don't want to use the nodeName but the pageTitle from the metatab and I know the field because the following macro in the master template put the pagetitle on the pages
<title><umbraco:Item field="Pagetitle" useIfEmpty="pageTitle" runat="server"></umbraco:Item></title>
but when I try to use it in the xlst codeI never get anything to display
<xsl:value-of select="@nodeName"/></a>.I have tried replacing @nodeName with @PageTitle, @pageTitle, @data [@alias = 'pageTitle'] and just about anything else I seen in this forum, but nothing seems to work.
any clues?
Bruce
Hi Bruce,
You were close...try just: Pagetitle (without the @)
Ex:
the @ signs are for attributes of a node (@id, @nodeName), for example <Textpage id="1111" nodeName="test" ...
Any custom properties are stored as elements, for example <Textpage id="1111" nodeName="test" ..><Pagetitle>your page title</Pagetitle></Textpage>
On a side note, if you wanted to still use the nodeName as a fallback, you could do:
Hope this helps,
Tom
Tom,
Thank you very much.
Thank you for the explantion about the @,
Bruce
is working on a reply...