XSLT - Declare variable with condition

0 votes
500 views
added Sep 26, 2019 in XSLT by anonymous
<!--example 1-->
<xsl:variable name="priceProperty">
  <xsl:choose>
    <xsl:when test="$isProp-pkg-a or $isProp-pkg-b or umbraco.library:LastIndexOf($category, 'Real Estate') &gt; -1">
      <xsl:value-of select="TP.CommonHelper:FormatPrice($price, 1, 0)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="normalize-space('')"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

 

1 Response

0 votes
responded Sep 26, 2019 by anonymous
<!--example 1-->
 <xsl:variable name="LoggedInUser" select="TP.CommonHelper:GetUserXPath()" />
      <xsl:if test="$LoggedInUser/UserData">
        <xsl:choose>
          <xsl:when test="umbraco.library:RequestQueryString('shownumber') = 1">
            <xsl:variable name="alertMsg">
              <xsl:choose>
                <xsl:when test="$LoggedInUser/UserData/emailverified">
                You are now logged in, proceed to click 'Show Number' to reveal seller's number
                </xsl:when>
                <xsl:otherwise>
                You are now logged in, one more step, activate your activate and you can access seller's information.
                  <br/>We have sent an activation link, follow the instruction to activate your account
                </xsl:otherwise>
              </xsl:choose>
            </xsl:variable>
            <div class="container">
              <xsl:call-template name="RenderDesktopAlert">
                <xsl:with-param name="alert" select="TP.CommonHelper:GenerateAlert('Successfully log in',$alertMsg,'','success')" />
              </xsl:call-template>
            </div>
          </xsl:when>
        </xsl:choose>
      </xsl:if>
</xsl:variable>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...