Copied to clipboard

Flag this post as spam?

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


  • Steve 472 posts 1216 karma points
    May 31, 2016 @ 20:36
    Steve
    0

    Doctype Property Empty or Null Test in XSLT

    I've got a XSLT template that checks for 2 available properties on a collection of nodes. I would like to test whether or not the first property field is empty or null, and if it is use the second property, but the test for empty or null is causing an macro load error on the page. Here is my code:

    <xsl:template name="output-cell">
      <xsl:param name="node" />
      <xsl:param name="class" />
    
      <td class="listing {$class}" categories="{$node/categories}">
        <xsl:choose>
          <xsl:when test="$node/url != '' ">
            <a href="{$node/url}">
              <xsl:value-of select="$node/@nodeName" />
            </a>
          </xsl:when>
          <xsl:otherwise>
              <a href="{umbraco.library:NiceUrl($node/internalPage)}">
              <xsl:value-of select="$node/@nodeName" />
            </a>
          </xsl:otherwise>
        </xsl:choose>
      </td>
    
    </xsl:template>
    
Please Sign in or register to post replies

Write your reply to:

Draft