XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

fn:data

Category:

Functions for sequences

Origin:

XPath 2.0

Return value:

A sequence of atomic values of different types which is generated from the processing (atomisation) of the items of an input sequence.

Call/Arguments:

fn:data($inputSequence)

$inputSequence:

A sequence of items of any type which are transformed atomised (into atomic values) by the function and outputted into an output sequence in unchanged order. If the input sequence is empty, the empty sequence is outputted.

Purpose of use:

For the input sequence passed on, the fn:data function returns a sequence of appropriate atomic values. An item of the input sequence which already exists in atomic form is passed on unchanged.

However, if the item is a node (with a Schema type bound to it), it is automised and an appropriate sequence of atomic, typed values is outputted. The item is generated according to the application of the accessor function dm:typed-value from Formal Semantics. If the node has no valid typed value property, the error »Argument node does not have a typed value« (err:FOTY0012) is reported.

However, if the node has a valid typed value property, one return value per node is outputted into the result sequence. This return value is determined for nodes of different types as follows:

  • For document nodes, element nodes and attribute nodes, each value of their typed value property is returned.
  • For commment nodes and Processing Instructions, each value of their content property is outputted as xs:string.
  • For namespace nodes, the value of the uri property is outputted as xs:string.
  • For text nodes, the value of their content property is outputted as xs:untypedAtomic.

For element nodes applies specifically the following:

  • For element nodes of xs:anyType type, their string value in form of xs:untypedAtomic is returned.

    If the element is typed as simple type or complex type with simple content, its string value is returned with an appropriate type connection.

    If an element declared as complex type has no content, it is presented as empty sequence and not taken into account in the output sequence. However, if it has mixed content, its string value is returned as xs:untypedAtomic.

    For elements declared as complex type with complex content, the typed value is undefined. Therefore, the attempt to transform it into an atomic typed value generally leads to a type error which is treated dependently on the runtime environment to be processed.

For attribute nodes applies specifically the following:

  • Attribute nodes of the base type xs:anySimpleType are also outputted in the form of their string value, typed as xs:untypedAtomic.
  • Attributes of a list type are outputted as a sequence of atomic values of the appropriate type; for example, an attribute of the list type xs:NMTOKENS as a sequence of atomic values of the xs:NMTOKEN type. The same applies for the list types xs:IDREFS and xs:ENTITIES.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:data($arg as item()*) as xs:anyAtomicType*

   

<< 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