Q:

XSLT Variables and Choose/Otherwise not working right

I have some XSLT that looks like:
<xsl:choose>
    <xsl:when test="string(//User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])">
        <xsl:variable name="Type" select="concat('Documenter', //User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])"/>                         
    </xsl:when>
    <xsl:otherwise>
        <xsl:variable name="Type" select="concat('Documenter', user:GetUserType(string(//Payload/@SiteID), string(@UserID)))"/>                         
    </xsl:otherwise>
</xsl:choose>

And I want to assign a variable to it called "Type" I see from other examples that I should be doing this instead:
<xsl:variable name="Type">
    <xsl:choose>
        <xsl:when test="string(//User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])">
            <xsl:value-of select="concat('Documenter', //User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="concat('Documenter', user:GetUserType(string(//Payload/@SiteID), string(@UserID)))"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

But my variable is NOT getting set. It should hit the Otherwise block but never does. Any ideas? It doesn't get set to anything..
The only way to get Type to be set is to do away with the Choose/When/Otherwise statements and just pick one of the two options, like:
<xsl:variable name="Type" select="concat('Documenter', //User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])"/>

for example.

A:

Okay I figured it out. The problem was in how I was accessing the XSLT variable Type.. I originally had:
<xsl:value-of select="user:InsertPerson($SiteID, $VisitGUID, $ID, $FirstName, $MiddleName, $LastName, $Address1, $Address2, $City, $State, $Zipcode, $Degree, $SSN, $Phone1, $Phone2, $Priority, $LogonCategory, $HospitalID, $DocumentCreateTime, $CoSigner, $Type, $Primary, $AddTime)" disable-output-escaping="yes"/>

But then I changed "..., $Type, ..." to "..., string($Type), ..." and that fixed it. I'm not sure why out of all the parameters, this is the only one that needed to be wrapped with "string(...)" but it did solve the problem.
Thanks for the help everyonE!

