Shanmugalakshmi
Shanmugalakshmi

Reputation: 267

How to retain comment text with tag in XSL?

HTML:

<p>The effect of GCs on brown adipose growth and function is unknown and may contribute to the negative energy balance observed clinically.</p>
<!--<jid>JOE</jid><aid>140538</aid>-->
<p>Clinical cases of glucocorticoid (GC) excess are characterized by increased fat mass and obesity through the accumulation of white adipocytes.</p>

OUTPUT:

<para>The effect of GCs on brown adipose growth and function is unknown and may contribute to the negative energy balance observed clinically.</para>
&lt;jid&gt;JOE&lt;/jid&gt;&lt;aid&gt;140538&lt;/aid&gt;
<para>Clinical cases of glucocorticoid (GC) excess are characterized by increased fat mass and obesity through the accumulation of white adipocytes.</para>

XSL:

<xsl:template match="comment()">
  <xsl:value-of select="."/>
</xsl:template>

EXPECTED OUTPUT:

<para>The effect of GCs on brown adipose growth and function is unknown and may contribute to the negative energy balance observed clinically.</para>
<jid>JOE</jid><aid>140538</aid>
<para>Clinical cases of glucocorticoid (GC) excess are characterized by increased fat mass and obesity through the accumulation of white adipocytes.</para>

The tag is going to change as entity. But, I want to keep the comment of the same in the output also. How can i achieve that?

Upvotes: 1

Views: 53

Answers (1)

markusk
markusk

Reputation: 6677

Use disable-output-escaping.

<xsl:template match="comment()">
  <xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>

Upvotes: 1

Related Questions