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.
This is what I have so far.
<xsl:variable name="lsind">
<xsl:value-of select="'N'"/>
<xsl:for-each select='./Plan/InvestmentStrategy/FundSplit'>
<xsl:choose>
<xsl:when test="contains(./@FundName, 'Lifestyle')">
<xsl:value-of select="'Y'"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
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'.
I am doing it this way as if i use 'otherwise the last occurrence could potentially set lsind back to N?
Any suggestions?
<xsl:variable name="lsind">
<xsl:choose>
<xsl:when test="Plan/InvestmentStrategy/FundSplit[contains(@FundName, 'Lifestyle')]">
<xsl:text>Y</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>N</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
should suffice
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With