xsl:comment Element
9/8/2008
Gera um comentar na saída.
Syntax
<xsl:comment>
</xsl:comment>
Atributos
Nenhum.
Elemento informações
Número de ocorrências |
Ilimitado |
Elementos pai |
xsl:Copy, xsl:element, xsl: for-each, IF, xsl:otherwise, xsl:param, xsl: template, xsl:variable, xsl: when, xsl: com-param, saída elementos |
Elementos filho |
xsl:apply-modelos, Call-modelo, xsl:choose, xsl:Copy, xsl:copy - dos, xsl: for-each, IF, xsl:text, xsl:value - dos, xsl:variable |
Remarks
O texto gerado pelos filhos do < xsl:Comment > aparece entre os caracteres inicial <!--e os caracteres de fechamento-->.
Example
No seguinte exemplo, o folhas de estilo News.XSL transforma o documento News.xml e insere um comentar a saída XSLT.
news.xml
<?xml version ="1.0"?>
<?xml-stylesheet type="text/xsl" href="comment1.xsl"?>
<news>
<story1>Here is the top news story.</story1>
<story2>News is the next news story.</story2>
</news>
news.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML>
<BODY>
<xsl:comment>insert top news story</xsl:comment>
<P>
<xsl:value-of select="//story1"/>
</P>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
XSLT Output
<HTML>
<BODY>
<!--insert top news story-->
<P>Here is the top news story.</P>
</BODY>
</HTML>