XSLT <xsl:boodskap>
❮ Voltooi XSLT-elementverwysing
Definisie en gebruik
Die <xsl:message>-element skryf 'n boodskap na die uitvoer. Hierdie element word hoofsaaklik gebruik om foute aan te meld.
Hierdie element kan byna enige ander XSL-element bevat (<xsl:text>, <xsl:value-of>, ens.).
Die terminate-kenmerk gee jou die keuse om óf op te hou óf die verwerking voort te sit wanneer 'n fout voorkom.
Sintaksis
<xsl:message terminate="yes|no">
<!-- Content:template -->
</xsl:message>
Eienskappe
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". |
Voorbeeld 1
Kyk of kunstenaar 'n leë string is. Indien wel, verlaat ons die XSL-verwerker en vertoon 'n boodskap:
<?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>
❮ Voltooi XSLT-elementverwysing