XSLT <xsl:메시지>
❮ 완전한 XSLT 요소 참조
정의 및 사용
<xsl:message> 요소는 출력에 메시지를 씁니다. 이 요소는 주로 오류를 보고하는 데 사용됩니다.
이 요소는 거의 모든 다른 XSL 요소(<xsl:text>, <xsl:value-of> 등)를 포함할 수 있습니다.
종료 속성은 오류가 발생할 때 처리를 종료하거나 계속할 수 있는 선택권을 제공합니다.
통사론
<xsl:message terminate="yes|no">
<!-- Content:template -->
</xsl:message>
속성
Attribute | Value | Description |
---|---|---|
terminate | yes no |
Optional. "yes" terminates the processing after the message is written to the output. "no" continues the processing after the message is written to the output. Default is "no". |
실시예 1
아티스트가 빈 문자열인지 확인하십시오. 그렇다면 XSL 프로세서를 종료하고 다음 메시지를 표시합니다.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="catalog/cd">
<p>Title: <xsl:value-of select="title"/><br />
Artist:
<xsl:if test="artist=''">
<xsl:message terminate="yes">
Error: Artist is an empty string!
</xsl:message>
</xsl:if>
<xsl:value-of select="artist"/>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
❮ 완전한 XSLT 요소 참조