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.

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