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 TypeName | Type |
$arg |
item()? |
return value |
xs:string |
Exampleslet $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 Example | Results |
---|
string($in-xml-2/number) |
784 |
string($in-xml-2/desc) |
Our favorite shirt! |
string($in-xml-2/@dept) |
MEN |
History |
Recommended Reading:
|