title: XSLT default variable value if value not present
body: <p>I am trying to declare a variable that has a default value or if a value is present in a repeating set to use a new different value.</p>
  
  <p>This is what I have so far.</p>
  
  <pre><code>      &lt;xsl:variable name="lsind"&gt;
          &lt;xsl:value-of select="'N'"/&gt;
  
          &lt;xsl:for-each select='./Plan/InvestmentStrategy/FundSplit'&gt;
            &lt;xsl:choose&gt;
              &lt;xsl:when test="contains(./@FundName, 'Lifestyle')"&gt;
                &lt;xsl:value-of select="'Y'"/&gt;
              &lt;/xsl:when&gt;
            &lt;/xsl:choose&gt;
          &lt;/xsl:for-each&gt;
        &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>What I want is if any instances of ./Plan/InvestmentStrategy/FundSplit/@FundName 'contains' LifeStyle then lsind ' Y' otherwise it falls back to the default value of 'N'.</p>
  
  <p>I am doing it this way as if i use 'otherwise the last occurrence could potentially set lsind back to N?</p>
  
  <p>Any suggestions?</p>