Share via


<xsl:comment> 요소

출력에 주석을 생성합니다.

<xsl:comment>
</xsl:comment>

요소 정보

발생 횟수

제한 없음

부모 요소

xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:template, xsl:variable, xsl:when, xsl:with-param, 출력 요소

자식 요소

xsl:apply-imports, xsl:apply-templates, xsl:call-template, xsl:choose, xsl:copy, xsl:copy-of, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:number, xsl:text, xsl:value-of, xsl:variable

설명

<xsl:comment>의 자식에 의해 생성된 텍스트가 시작 문자(<!--)와 닫는 문자(-->) 사이에 나타납니다.

예제

다음 예제에서는 news.xsl 스타일시트는 news.xml 문서를 변환하며 XSLT 출력에 주석을 삽입합니다.

XML 파일(news.xml)

<?xml version ="1.0"?>
<?xml-stylesheet type="text/xsl" href="news.xsl"?>
<news>
<story1>Here is the top news story.</story1>
    <story2> Here is the next news story.</story2>
</news>

XSLT 파일(news.xsl)

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<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>

출력

다음은 형식이 지정된 출력입니다.

Here is the top news story.

다음은 프로세서 출력입니다.

<HTML>
<BODY><!--insert top news story-->
<P>Here is the top news story.</P>
</BODY>
</HTML>