I'm not entirely sure what your problem is or how you are getting the output you are. It may depend on which XSLT processor you are using.
But I think there are a number of things you have got wrong anyway.
The first is that depending on which version of XSLT you are using <xsl:value-of select="comment"> will write out the textual value of all child comment elements, or just the first, so doing <xsl:value-of select="comment[1]"/> would be more specific.
To select the 'next' comment element you can also do this: <xsl:apply-templates select="following-sibling::comment[1]"/>.
Also, because you have the <xsl:value-of select="text"/> after the <xsl:apply-templates> you are going to be outputting stuff in the reverse order.
|