Conditional Selection

The code below works, but is too complex, I’d like to simplify it. How can I make the select portion conditional or how can I use a variable in the select?

  1. <xsl:choose>
  2. <xsl:when test="count(current()/child::* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
  3. <xsl:for-each select="$currentPage/self::* [@isDoc and string(umbracoNaviHide) != '1']">
  4. <h3>
  5. <a href="{umbraco.library:NiceUrl(@id)}">
  6. <xsl:value-of select="@nodeName"/>
  7. </a>
  8. </h3>
  9. </xsl:for-each>
  10. </xsl:when>
  11. <xsl:otherwise>
  12. <xsl:for-each select="$currentPage/parent::* [@isDoc and string(umbracoNaviHide) != '1']">
  13. <h3>
  14. <a href="{umbraco.library:NiceUrl(@id)}">
  15. <xsl:value-of select="@nodeName"/>
  16. </a>
  17. </h3>
  18. </xsl:for-each>
  19. </xsl:otherwise>
  20. </xsl:choose>
Share this post
[social_warfare]
Create and Apply templates
Absolute Location paths and descendant selection

Get industry recognized certification – Contact us

keyboard_arrow_up