home contribute faq download

FunctX XQuery Functions

fn:string

Converts a value or a node to string

Google
Webdatypic.com

Description

The fn:string function converts a value or a node to a string. If $arg is a node, this function returns its string value. The method of determining the string value of a node depends on its kind. For an element node, it is the character data content of the element and all of its descendants concatenated together. For an attribute node, it is simply the value of the attribute as a string. If $arg is an atomic value, the function returns that value, cast to xs:string.

This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book.

Arguments and Return Type

NameType
$arg item()?
return value xs:string

Examples

let $in-xml-2 :=
 <product dept="MEN">
  <number>784</number>
  <name language="en">Cotton Dress Shirt</name>
  <colorChoices>white gray</colorChoices>
  <desc>Our <i>favorite</i> shirt!</desc>
 </product>
return
XQuery ExampleResults
string($in-xml-2/number)
784
string($in-xml-2/desc)
Our favorite shirt!
string($in-xml-2/@dept)
MEN

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XQuery Services

Recommended Reading:

XQuery