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?

<xsl:choose>
        <xsl:when test="count(current()/child::* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
          <xsl:for-each select="$currentPage/self::* [@isDoc and string(umbracoNaviHide) != '1']">
            <h3>
              <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
              </a>
            </h3>
          </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
          <xsl:for-each select="$currentPage/parent::* [@isDoc and string(umbracoNaviHide) != '1']">
            <h3>
              <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
              </a>
            </h3>
          </xsl:for-each>
        </xsl:otherwise>
      </xsl:choose>