To generate a comment in the result tree, use the xsl:comment instruction.
Generating entity references is more difficult, because entity references do not appear as such in the tree data model: this means they can only be produced at serialization time. Generally it's not a good idea to attempt it: ask yourself carefully WHY you want to do this. If you have a really good reason, then you can achieve it using character maps:
<xsl:character-map name="amp">
<xsl:output-character character="#" string="&"/>
</xsl:character>
<xsl:output use-character-maps="amp"/>
then
<xsl:attribute nmae="atr1">#abc;def</xsl:attribute>
Of course you can use any character in place of #, it doesn't have to be ASCII.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference