Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Would appreciate any guidance. I have a list, which includes three columns, listed in the XSLT snippet. I can't get the "Scope Risk" aka "Scope_x0020_Risk" column to match, but the others match and behave as expected. It seems as if it should be straight-forward, but it is not.

    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" 

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" 

xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" 

xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
    <xsl:include href="/_layouts/xsl/main.xsl"/>
    <xsl:include href="/_layouts/xsl/internal.xsl"/> 

    <xsl:template name="FieldRef_body.Scope_x0020_Risk" match="FieldRef[@Name='Scope_x0020_Risk']" mode="body">
        <xsl:param name="thisNode" select="."/>
            <xsl:choose>
                <xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Green'">
                    <img src="/_layouts/images/IMNON.png"/>
                </xsl:when>
                <xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Amber'">
                    <img src="/_layouts/images/IMNIDLE.png"/>
                </xsl:when>
                <xsl:otherwise>
                    <img src="/_layouts/images/IMNBUSY.png"/>
                </xsl:otherwise>
            </xsl:choose>
    </xsl:template>

    <xsl:template name="FieldRef_body.Schedule_x0020_Risk" match="FieldRef[@Name='Schedule_x0020_Risk']" mode="body">
        <xsl:param name="thisNode" select="."/>
            <xsl:choose>
                <xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Green'">
                    <img src="/_layouts/images/IMNON.png"/>
                </xsl:when>
                <xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Amber'">
                    <img src="/_layouts/images/IMNIDLE.png"/>
                </xsl:when>
                <xsl:otherwise>
                    <img src="/_layouts/images/IMNBUSY.png"/>
                </xsl:otherwise>
            </xsl:choose>
    </xsl:template>
    <xsl:template name="FieldRef_body.Resource_x0020_Risk" match="FieldRef[@Name='Resource_x0020_Risk']" mode="body">
        <xsl:param name="thisNode" select="."/>
            <xsl:choose>
                <xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Green'">
                    <img src="/_layouts/images/IMNON.png"/>
                </xsl:when>
                <xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Amber'">
                    <img src="/_layouts/images/IMNIDLE.png"/>
                </xsl:when>
                <xsl:otherwise>
                    <img src="/_layouts/images/IMNBUSY.png"/>
                </xsl:otherwise>
            </xsl:choose>
    </xsl:template>


</xsl:stylesheet>
share|improve this question
    
Some troll gave you a -1 without saying why. Your question isn't so bad as that, I think. –  BGM Jul 26 '13 at 16:08
1  
Thanks for the support, BGM. XSLT can be a bit numbing at times. –  1c1cle Aug 6 '13 at 23:28
add comment

1 Answer 1

up vote 0 down vote accepted

My fault. After stepping away and stabbing again: I went into Designer and viewed the code for the webpart and saw that some of the column names were different from their titles when viewing the column information through a web browser. A person must have changed the column names, but the column names when view in teh code through designer didnt' actually change.

share|improve this answer
1  
If this fixed it, you should mark your thread solved. –  BGM Jul 26 '13 at 16:08
    
Ah, yes, anytime there is a space in the title name, it gets swapped with _x0020_. Also, if someone renames the column titles using the Sharepoint GUI, the code-behind names don't get switched along with it. Firebug is our friend! –  BGM Aug 7 '13 at 2:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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