Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevon K. Hayes 255 posts 281 karma points
    Nov 10, 2010 @ 00:18
    Kevon K. Hayes
    0

    Tryin to output the value of custom property if another property is null

    The the "otherwise" block works but not the "when" block.

    <xsl:template match="/">
    <!-- Creating ID of the Menu Container -->
      <xsl:variable name="id" select="$currentPage/corMenuItemsID" />
      <ul>
       <!--- Getting the Menu Items in the Container-->
      <xsl:for-each select="umbraco.library:GetXmlNodeById($id)/corDeptMenuItem [@isDoc]">
        <!-- Setting variable to get the URL from below property -->
        <xsl:variable name="theURL" select="umbraco.library:NiceUrl(corDeptMenuItemLink)" />
        <!-- Setting variable to get the text value from below property -->
        <xsl:variable name="corURLValue" select="umbraco.library:Item($currentPage/@id, 'corURL')" />
        <xsl:choose>
          <!-- if the value of the corDeptMenuItemLink is null or "" output the value of corURL property-->
          <xsl:when test="theURL = ''">
            <li>
              <a href="corURLValue">
                <xsl:value-of select="@nodeName"/>
              </a>
            </li>
          </xsl:when>
          <!-- otherwise output the URL of the value of the URL of the corDeptMenuItemLink property-->
          <xsl:otherwise>
            <li>
              <a href="{umbraco.library:NiceUrl(corDeptMenuItemLink)}">
              <xsl:value-of select="@nodeName"/>
              </a>
            </li>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </ul>
    </xsl:template>

Please Sign in or register to post replies

Write your reply to:

Draft