It didn't work

.
By the way, the first codebox I showed was my idea of what to do with musername, I'm more fond of Java so here's what it would look like in Java:
Code:
public class musername() {
if(field10.doesContainText()) {
showHTMLBegin();
showDisplayName();
showHTMLEnd();
} else {
showHTMLBegin();
showUsername();
showHTMLEnd();
}
}
That may look a little simpler as what I'm trying to do, that way, instead of editing the actual template, the username itself would change and keep the same HTML markups.