5

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)

2 Answers 2

1

I'm not sure what you're trying to do exactly. Whenever you check a document in, it has to be approved in the approve/reject screen. To do so, you have to have approver permissions (approvers group).

The approval status shouldn't need a variable if you're iterating through line items. Just pull in the OOTB approval status column data.

0

Not sure if it's helpful or not, but you can filter on the "CheckedOutTo" field to see whether the document is checked out. The field will be empty when the document is not checked out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.