Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Maurice Melchers 4 posts 24 karma points
    May 14, 2012 @ 01:43
    Maurice Melchers
    0

    Tags bugging out on content with children

    Hi all, new to umbraco here and trying to figure out why my tags aren't working.

    I made a contentstructure on which I have a articles about 'country' which contain many 'communities' (so communities are children of countries).

    Elsewhere on the site I have Newsposts which can be tagged with a country so I can find similar stories.

    Up till recently I could find newsposts from similar countries by using the following macro:

    <?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:tagsLib="urn:tagsLib"
      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 tagsLib 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"/>
        
    <xsl:variable name="location"  select="$currentPage/location" />

    <xsl:template match="/">
      <xsl:if test="$location">
        <div class="more-news">
          <h4>More news from <span class="capitalize"><xsl:value-of select="$location"/></span></h4>
          <ul>
            <xsl:for-each select="tagsLib:getEverythingWithTags($location)/root/node">
              <li><href="#"><xsl:value-of select="@nodeName"/></a></li>
              <xsl:value-of select="@nodeUrl"/>
            </xsl:for-each>
          </ul>
        </div>
      </xsl:if>

    </xsl:template>

    </xsl:stylesheet>

    However. I just set up the content structure with Countries containing many Communities. And now the tags system breaks the moment I assign a country with a tag.

    On the page it says Error parsing XSLT file: \xslt\SidebarCountryNews.xslt 

    and when I try to save the macro it throws me the following error:

    System.InvalidCastException: Unable to cast object of type 'umbraco.cms.businesslogic.CMSNode' to type 'umbraco.cms.businesslogic.Content'. 

    Any suggestions I could go about debugging this?

    Running Umbraco 4.7.1

Please Sign in or register to post replies

Write your reply to:

Draft