What part aren't you clear about? To get the value of a node you use the <xsl:value-of> element. To output a comma, you simply put a comma in your code. The only non-trivial part of the code is controlling white-space, so that you don't get extra blanks or line-endings where you don't want them. You might have to use the <xsl:text> element for that.
Perhaps you could post the code you have so far and tell us what is the problem with it?
This doesn't select anything because the element names in the document ("subElement") don't match the name in the code ("SubElement").
But let's suppose you fix that typo.
At this point your context node is a subElement node. So this statement says "Is there a child of this node which is a data element with a name attribute whose value is 'id1'? The answer is yes, there is.
This says "Find all of the data elements which are children of this node and concatenate all of the text nodes which are children of them. There are four such data elements so the result of that is '1234'.