XSLT <xsl:mesaj>
❮ XSLT Öğe Referansını Tamamlayın
Tanım ve Kullanım
<xsl:message> öğesi çıktıya bir mesaj yazar. Bu öğe öncelikle hataları bildirmek için kullanılır.
Bu öğe, hemen hemen tüm diğer XSL öğelerini içerebilir (<xsl:text>, <xsl:value-of>, vb.).
Sonlandırma özelliği, bir hata oluştuğunda işlemden çıkma veya işleme devam etme seçeneği sunar.
Sözdizimi
<xsl:message terminate="yes|no">
<!-- Content:template -->
</xsl:message>
Öznitellikler
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". |
örnek 1
Sanatçının boş bir dize olup olmadığını kontrol edin. Evet ise, XSL işlemcisinden çıkarız ve bir mesaj görüntüleriz:
<?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 Öğe Referansını Tamamlayın