0

I am using sp 2010. I have a custom search result in xslt. I would like to check if "srportalurl" is not empty before show a ahref. If variable "srportalurl" is empty I would like show only the variable "srprojectname" without ahref. How to check if variable "srportalurl" is not empty?

<a>
                <xsl:attribute name="href"><xsl:value-of select="srportalurl" /></xsl:attribute>
                <xsl:value-of select="srprojectname" />
            </a>

1 Answer 1

1

Please try below code:

<xsl:choose>
    <xsl:when test="srportalurl!= ''">
       <a>
            <xsl:attribute name="href"><xsl:value-of select="srportalurl" />
            <xsl:value-of select="srprojectname" />
        </a>
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="srprojectname" />
    </xsl:otherwise>
</xsl:choose>

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.