Two suggestions...
1) Could it be that your code is not working because of carriage
returns, i.e. this code
<xsl:when test="_Ctrl">
<xsl:value-of select="'1'"/>
</xsl:when>
sets your variable to the value '
1
'
and so it is not string-equal to '1'?
You could avoid this problem by taking Michael Kay's suggestion
about using a boolean variable; or by using number(),
or strip-space().
2) You said your xml inside <Rpt_Inven> varies all the time;
but does the location of _Ctrl vary? If not, you could
get rid of the variable and do
<xsl:if test="/lay:data/_Ctrl">
instead of
<xsl:if test="$CtrlExists='1'">
HTH,
Lars
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list