0

I am trying to declare a variable and set the xsl:value-of lookup column and later compare the stored value using conditions. I am facing issues while declaring and calling variables. This I am using to display a custom form in SharePoint 2016 using following code.

<xsl:variable name="storevalue" select="substring-before(substring-after(@Name_x0020_Name_x003a_Is, '&gt;'), '&lt;')" disable-output-escaping="yes"/>
<xsl:choose>
  <xsl:when test="$storevalue='ABZ'">
    <span style="color:red;">$storevalue</span>
  </xsl:when>
  <xsl:otherwise>
    <span style="color:green;">$storevalue</span>
  </xsl:otherwise>
</xsl:choose>

Thanks in advance

1 Answer 1

0

Please try to use below code for assigning variable and calling its value.

  <xsl:variable name="StoreValue">
    <xsl:value-of select="substring-before(substring-after(@LookUpFieldName, '&gt;'), '&lt;/a&gt;')" />
  </xsl:variable>

  <xsl:choose>
    <xsl:when test="($StoreValue == 'ABZ')"> 
       <span style="color:red;"> 
          <xsl:value-of select="@StoreValue"/> 
       </span>
    </xsl:when> 
    <xsl:otherwise> 
       <span style="color:green;"> 
          <xsl:value-of select="@StoreValue"/> 
       </span>
    </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.