XSLT Function isnull

The AS:isnull function returns a specified value if the expression is NULL. If the expression is not NULL, this function returns the expression.
NAMESPACE
xmlns:AS="http://schema.advantages.cz/AsapFunctions"

SYNTAX

Xml isnull(string expression, string value)

PARAMETERS

Name Description
expression The expression to test whether is NULL
value The value to return if expression is NULL

EXAMPLE

Source Result
AS:isnull('twenty', '20') twenty
AS:isnull('', '20') 20
AS:isnull(NULL, '20') 20

STYLESHEET

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:AS="http://schema.advantages.cz/AsapFunctions"
    xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="AS date">
    <xsl:template match="/">
        <ROOT>
            <xsl:value-of select="AS:isnull('twenty', '20')"/>
        </ROOT>
    </xsl:template>
</xsl:stylesheet>