In the last node of my site is where the articles are shown, and everyone has its own tags that of course can be the same between some of them, so I wrote a Macro for tags that is working (it lists the tags of the article the user is viewing), I've used the Tag datatype for my 'Article' doctype, and that Macro works correctly; but I got problems with the Macro I wrote to list those articles that have the same tags, I called it RelatedContent.xslt
. Here is the code for AllTags.xslt
that I found in Umbraco TV Tutorials that works:
<xsl:template match="/">
<div class="tags">
<xsl:variable name="Factor" select="6 div Exslt.ExsltMath:max(tags:getAllTagsInGroup('default')/tags/tag/@nodesTagged)"/>
<xsl:for-each select="tags:getAllTagsInGroup('default')/tags/tag">
<a class="tag{round($Factor * @nodesTagged)}x" href="?tag={.}">
<xsl:value-of select="."/>
</a><br/>
</xsl:for-each>
</div>
</xsl:template>
And the code for RelatedContent.xslt is this:
<xsl:template match="/">
<ul>
<xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1'] and (umbraco.library:Request('tag') = '' or contains(data [@alias = 'tags'], umbraco.library:Request('tag')))">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
<xsl:value-of select="newsTitle"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
I have not found anything to help me understand this, so I cannot realize how to do it. I will appreciate some help from you. Thanks for your advices.
(Umbraco 6.1.3)
The code for the related content is using the old XML Schema.
Replace this bit:
With
The /node element does not exist in the 4.6+ schema, and the element name is replaced with the name of the documentTypeAlias.
So if you have a document type
article
with a propertyarticleTitle
it would be like this:Instead of the old schema (this is incorrect for anything above 4.5)
You can see the difference between the 2 schemas at the Umbraco wiki:
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema