Description
The functx:precedes-not-ancestor function returns a boolean value indicating whether $a precedes $b without being its ancestor. If either argument is the empty sequence the function returns false.
Arguments and Return TypeName | Type | Description |
$a |
node()? |
the first node |
$b |
node()? |
the second node |
return value |
xs:boolean |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:precedes-not-ancestor
( $a as node()? ,
$b as node()? ) as xs:boolean {
$a << $b and empty($a intersect $b/ancestor::node())
} ; |
Exampleslet $in-xml := | <authors>
<author>
<fName>Kate</fName>
<lName>Jones</lName>
</author>
<author>
<fName>John</fName>
<lName>Doe</lName>
</author>
</authors> | return |
XQuery Example | Results |
---|
functx:precedes-not-ancestor(
$in-xml//author[1],$in-xml//author[2]) |
true |
functx:precedes-not-ancestor(
$in-xml//author[1],
$in-xml//author[1]/fName) |
false |
functx:precedes-not-ancestor(
$in-xml//author[2],$in-xml//author[1]) |
false |
See AlsoHistoryPublished On | Last Updated | Contributor(s) |
---|
2006-06-27 | 2007-02-26 | W3C XML Query Working Group, XQuery 1.0: An XML Query Language, http://www.w3.org/TR/xquery/(name was changed from precedes to precedes-not-ancestor for clarity) |
|
Recommended Reading:
|