Copied to clipboard

Flag this post as spam?

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


  • Jan Vermeerbergen 79 posts 112 karma points
    Jan 19, 2012 @ 17:58
    Jan Vermeerbergen
    0

    getAllTagsInGroup also returns unpublished nodes.

    Hi there,
    I'm editing a blog here, and for some reason my category list also returns categories from unpublished posts.

    Is there any way at all to only show the categories (and the correct count for them) for blogposts that are published? Any help would be GREATLY appreciated!

    This is how my XSLT looks:

    <?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 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="blogIndexNodeId">
        <xsl:choose>
          <xsl:when test="/macro/blogIndexNodeId != ''"><xsl:value-of select="/macro/blogIndexNodeId"/></xsl:when>
          <xsl:otherwise><xsl:value-of select="$currentPage/ancestor-or-self::* [name() = 'BlogIndexDoctype']/@id"/></xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <xsl:variable name="showNrOfPosts" select="/macro/showNrOfPosts"/>
        
      <xsl:variable name="sidebarcat" select="1"/>

      <xsl:template match="/">

        <xsl:if test="$currentPage/../blogSidebarCategories = 1 or $currentPage/blogSidebarCategories = 1">      
        <xsl:if test="count(tagsLib:getAllTagsInGroup('Categories')/tags/tag) != 0">
          
          <div class="categories">

            <xsl:variable name="title" select="umbraco.library:GetDictionaryItem(string('blogSidebarCategoriesTitle'))"/>
      
          <ul>
            <xsl:for-each select="tagsLib:getAllTagsInGroup('Categories')/tags/tag">
              <xsl:sort select="." order="ascending" data-type="text" />
              <li>
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="umbraco.library:NiceUrl($blogIndexNodeId)"/>
                    <xsl:text>?category=</xsl:text>
                    <xsl:value-of select="Exslt.ExsltStrings:lowercase(.)"/>
                  </xsl:attribute>
                  
                  <xsl:attribute name="title">
                    <xsl:variable name="temp" select="Exslt.ExsltStrings:replace(umbraco.library:GetDictionaryItem('blogSidebarCategoriesAlt'), '[x]', @nodesTagged)"/>
                    <xsl:value-of select="Exslt.ExsltStrings:replace($temp, '[category]', Exslt.ExsltStrings:lowercase(.))"/>
                  </xsl:attribute>

                  <xsl:value-of select="."/>
                </a>
                <xsl:if test="$showNrOfPosts = 1">
                  (<xsl:value-of select="@nodesTagged"/>)
                </xsl:if>
              </li>
            </xsl:for-each>
            </ul>
          </div>
        </xsl:if>
        </xsl:if>
      </xsl:template>
      
    </xsl:stylesheet>

     

    thanks,

    Jan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 19, 2012 @ 19:01
    Jan Skovgaard
    0

    Hi Jan

    I'm not sure how the tagslib is working but if it is reading from the XML cache then you should try to republish the entire site, which should refresh it and make sure that no published tags are being shown.

    It's worth the try :)

    /Jan

  • Jan Vermeerbergen 79 posts 112 karma points
    Jan 19, 2012 @ 19:13
    Jan Vermeerbergen
    0

    Hi Jan,

    I republished the entire site, but unfortunately this changed nothing...

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft