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>
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>
is working on a reply...