XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
Node names, identifiers and URI information
A Boolean value; true if the nilled property of the element node passed on is set, otherwise false.
An element node whose nilled property value shall be determined. For other node types or the empty sequence, the function returns an empty result sequence.
Purpose of use:
The fn:nilled() accessor function returns a Boolean value depending on whether the nilled property of the considered element node is set to true or false – this is determined on the element instance by a xsi:nil attribute with the value true or false. The xsi prefix refers to the namespace "www.w3.org/2001/XMLSchema-instance". If the attribute is set, the function accordingly returns the value true or false.
In case the node passed on per argument is not an element node, the function returns an empty result sequence instead of a Boolean value. The same happens if the input argument is the empty sequence.
Occasionally, it may happen that an element node shall not have any content, even if this is actually forbidden by its Schema type. In order to permit that an element instance is allowed to remain empty contrary to the Schema, the nillable property must be set to true within the scope of the Schema definition of the content model:
<xs:element name="example" type="xs:integer" nillable="true">
The element defined in this example must actually contain an integer. However, in exceptional cases, it shall be able to remain empty without that an error is reported during a validation. In this case (and only then), an instance of the element gets a xsl:nil attribute which indicates by the values true or false whether the element node has the property »nilled«. Once xsl:nil="true" is set, the considered element instance must be empty. During the processing its typed value is considered as the empty sequence in order to not cause any type errors. Therefore, the two following instances can be validated:
<example>42</example> <example xsl:nil="true"/>
The function is not available.
fn:nilled($arg as node()?) as xs:boolean?
|<< back||next >>|
Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany