in reply to Using a value to add to xml line

Have you declared $epname anywhere? You have not shown that in the provided extract.