I'm not sure if this is related or not, but you are using the same variable name at different scopes, so things might get strange. I'd suggest while you work this out, you use different variable names all around.
There was a problem with the fancy parser that it would not parse attributes inside of tags -- not just registered tags, but any tag. I used to have to use a patch to get around this, but I think a mainstream commit was made that may have fixed it. To test it, make sure you can do something like: <p foo="<%=$bar&%gt;"> Where you've defined some variable named "bar" -- make sure the value of bar comes through in your page. If that works, then I suspect you're dealing with a scope issue. If it doesn't work, then I'll have to see if I can remember how to fix the parser. Meanwhile, I've solved this problem by just using variables near the registered tag, rather than trying to make them work as attributes, so you could work around the bad behavior that way. Pete.
