getting niceUrl error when trying to link to an ancestor
Hello
I am having a problem with niceUrl, I have defined two variables which stores the id and node name of an ancestor node. I do not get an error when saving, just an error when trying to render the macro content. Any help would be appreciated.
In think the reason is that the node set that you are saving in your variable no longer has ancestors. It's a completely new nodeset that only has the nodes you selected.
So you probably need to use something like GetXmlNodeById(@id) to get the actual current node when populating the blogParent and blogParentName variables.
getting niceUrl error when trying to link to an ancestor
Hello
I am having a problem with niceUrl, I have defined two variables which stores the id and node name of an ancestor node. I do not get an error when saving, just an error when trying to render the macro content. Any help would be appreciated.
<xsl:template name="listContributors">
<xsl:variable name="blogPostNodeSet">
<xsl:for-each select="$currentPage/descendant-or-self::node[@ nodeTypeAlias='BlogPost']">
<xsl:sort order="descending" select="@createDate" />
<xsl:if test="position() < $numOfBlogs">
<xsl:copy-of select="." />
</xsl:if>
</xsl:for-each>
</xsl:variable>
<ul>
<xsl:for-each select="msxsl:node-set($blogPostNodeSet)/node[not(@writerID = preceding-sibling::node/@writerID)]">
<xsl:variable name="blogParent" select="ancestor::node[@nodeTypeAlias='Blog']/@id" />
<xsl:variable name="blogParentName" select="ancestor::node[@nodeTypeAlias='Blog']/@nodeName" />
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl($blogParent)"/>
</xsl:attribute>
<xsl:value-of select="$blogParentName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
In think the reason is that the node set that you are saving in your variable no longer has ancestors. It's a completely new nodeset that only has the nodes you selected.
So you probably need to use something like GetXmlNodeById(@id) to get the actual current node when populating the blogParent and blogParentName variables.
Thanks for the info I'll try that.
is working on a reply...