I'm at my wit's end with this one. Within an xsl:if test, I'm not able to
get 2 variables to properly evaluate if one of them is wrapped within a
string function.
<!-- This works -->
<xsl:if test="$var:v141="true"">
<!-- This doesn't work -->
<xsl:if test="string($var:v141)="true"">
I can't figure out why. The transformation is taking place within dotnet and
the var:v141 is assigned through a function call and it doesn't matter if I
return a boolean value or a string value ("true" or "false"), it always
evaluates to true and outputs the information wrapped within the if
statement. To further complicate things, this if statement is being
generated by the Biztalk Mapper (ugghhh!) and so I cannot edit the statement
and remove the string function.
I don't get it. Am I just overlooking something obvious here (I hope so...).
Eric
Here's the entire code block that doesn't work (I mean, regardless of the
value returned from the fctequal function, the if statment always evaluates
to true):
<xsl:for-each select="DexRaces/DexRace">
<xsl:variable name="var:v141"
select="fctequal(string(Code/text()),"1")"/>
<xsl:if test="string($var:v141)="true"">
<xsl:variable name="var:v142" select=""true""/>
<RaceAIorANHMDA><xsl:value-of select="$var:v142"/></RaceAIorANHMDA>
</xsl:if>
</xsl:for-each>
neither version of the function helps:
public string fctequal(string value1, string value2)
{
if(value1.Equals(value2))
{
return "true";
}
return "false";
}
public bool fctequal(string value1, string value2)
{
return value1.Equals(value2)
}