Skip to main content
2 of 2
added 132 characters in body
Peter
  • 71
  • 5

How to display document approval status in a content query web part?

I have this XSLT to display document title and approval status

<xsl:template name="DocumentStatus" match="Row[@Style='DocumentStatus']" mode="itemstyle">
        <xsl:variable name="SafeLinkUrl">
            <xsl:call-template name="OuterTemplate.GetSafeLink">
                 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
            </xsl:call-template>
        </xsl:variable> 
        <xsl:variable name="LinkTitle"> 
            <xsl:value-of select="@Title" />
        </xsl:variable>                 
        <xsl:variable name="DocumentStatus"> 
            <xsl:value-of select="@_ModerationStatus" />
        </xsl:variable>
        <div class="documentStatus">
            <div class="documentStatusLeft"><span><a href="{$SafeLinkUrl}" title="{$LinkTitle}"><xsl:value-of select="@Title"/></a></span></div>
            <div class="documentStatusRight"><span>
            <xsl:value-of select="@_ModerationStatus"/>             
            </span></div>
        </div>  
</xsl:template>

When I look in the library where I have two documents one is Approved and the other one is Pending but the template above output both as Approved (0). Am I missing something here?

Thanks in advance.

Edit: what I then want to do do is

    <xsl:choose>
            <xsl:when test="@_ModerationStatus = 0">
                Approved
            </xsl:when>
            <xsl:when test="@_ModerationStatus = 1">
                Rejected
            </xsl:when>
            <xsl:when test="@_ModerationStatus = 2">
                Pending
            </xsl:when>
            <xsl:when test="@_ModerationStatus = 3">
                Draft
            </xsl:when>
            <xsl:when test="@_ModerationStatus = 4">
                Scheduled Approval
            </xsl:when>
    </xsl:choose>

But that's no good if the documents are always "approved".

Edit2: I realized now that if the document is checked out it displays approved, I checked it in and it now displays Pending (2)

Peter
  • 71
  • 5