home contribute faq download

FunctX XQuery Functions

functx:max-node

The XML node whose typed value is the maximum

Google
Webxqueryfunctions.com

Description

The functx:max-node function returns the node(s) that contains the maximum value, based on typed value. Unlike the built-in fn:max function, it returns the node itself, not its atomic value.

Arguments and Return Type

NameTypeDescription
$nodes node()* the sequence of nodes to test
return value node()*

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:max-node
  ( $nodes as node()* )  as node()* {

   $nodes[. = max($nodes)]
 } ;

Examples

let $in-xml :=
<values>
      <int>1</int>
      <int>23</int>
      <int>115</int>
</values>
return
XQuery ExampleResults
functx:max-node($in-xml//int)
<int>115</int>

See Also

fn:maxThe maximum of a sequence of values
functx:min-nodeThe XML node whose typed value is the minimum

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Need XQuery Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley