Output element in comments

Viewed 11108

I need to display HTML-element in comments (for example)

<!-- <img src="path" width="100px" height="100px"/> -->

I use this approach

<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="windows-1251"/>

    <xsl:template match="myNode">
        ...
        <xsl:comment><xsl:apply-templates select="image" /></xsl:comment>
        ...
    </xsl:template>

    <xsl:template match="image">
        <img src="{@src}" width="{@width}px" height="{@height}px" />
    </xsl:template>

</xsl:stylesheet>

As a result:

<!---->

that is the code in the element xsl:comment ignored.

How do I display an item in the comments?

4 Answers
Related