एक्सएसएलटी <xsl:message>
❮ पूर्ण एक्सएसएलटी तत्व संदर्भ
परिभाषा और उपयोग
<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>
❮ पूर्ण एक्सएसएलटी तत्व संदर्भ