I can't work out what transformation you want to apply from your input and output (it's hard to see how they relate.). But since the input is non-XML, you won't find XSLT very useful for the task.
You haven't supplied enough information to assess how you should parse the input, for example whether it can be done with regular expressions or whether you need a recursive descent parser. That depends on the detailed parse rules
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference