views:

96

answers:

3

when I output the value of the node directly for example:

 <fo:inline><xsl:value-of select="isEnabled" /></fo:inline>

I get the correct string outputted in pdf "true"..

but if I set the value of isEnabled directly to a variable and then try to do the comparison on it.. it doesn't seem to work as if the node doesn't exist.

<xsl:variable name="isEnabled" select="isEnabled" />

<xsl:choose>
<xsl:when test="$isEnabled = 'true'">
   dostuff...

It seems that the value is never received correctly here and the test always fails

Any ideas?

+1  A: 

How about?

<xsl:variable name="isEnabled">
    <xsl:value-of select="isEnabled" />
</xsl:variable>

<xsl:when test="normalize-space($isEnabled)='true'">
rsp
will that work if I'm not really checking a boolean value but really the string "true"?
Ayrad
Edited for the case you're testing against the string value.
rsp
+3  A: 

Does isEnabled contain whitespace?

<isEnabled>true</isEnabled>

vs.

<isEnabled>true </isEnabled>

or

<isEnabled>
true
</isEnabled>

will give different results for your test. The first one should pass, the next two likely will not. Yet, they may all appear to render as the text "true" when using value-of.

Ron's Brain
ah yea maybe I need an ignore space function or a trim
Ayrad
A: 

ok turned out it wasn't an xsl issue but the problem is much earlier.. at the velocity template that generates the xml for the transformation. How can I close this question?

Ayrad