I have a recursive function that sets a LOCAL variable and calls itself until a
condition is met. Basically I'm turing a Structure into and XML packet.

I've attached my code. it is not behaving as expected. it is expected to
perform like ASP,JS, SQL, or any other language, that is a function level
variable is only defined for that function. i shouldn't have create a unique
variable name and make work arounds for something CF is touting ("Recursive
Functions").

function writeBranch(str)
{
var local = StructKeyArray(str);
var text = "";
for(x = 1; x lte arraylen(local); x = x + 1)
{
cur = local[x];
text = text & "<" & cur & ">";
/**/
if( isStruct(str[cur]) )
{
text = text & writeBranch(str[cur]);
}

text = text & "</" & cur & ">";
}

return text;
}