是的,有一个XSLT元素可以实现这个功能:<xsl:comment>。 要完成您所描述的操作,您可以使用以下内容: <!-- Match foo elements in the XML --> <xsl:template match="foo"> <xsl:comment>foo</xsl:comment> <foo> <xsl:apply-templates /> </foo> </xsl:template>