home contribute faq download

FunctX XSLT Functions

functx:follows-not-descendant

Whether an XML node follows another without being its descendant

Google
Webdatypic.com

Description

The functx:follows-not-descendant function returns a boolean value indicating whether $a follows $b without being its descendant. If either argument is the empty sequence the function returns false.

Arguments and Return Type

NameTypeDescription
$a node()? the first node
$b node()? the second node
return value xs:boolean

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:follows-not-descendant" as="xs:boolean"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="a" as="node()?"/>
  <xsl:param name="b" as="node()?"/>

  <xsl:sequence select="
   $a >> $b and empty($b intersect $a/ancestor::node())
 "/>

</xsl:function>

Examples

<xsl:variable name="in-xml" as="item()*">
<authors>
   <author>
      <fName>Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName>John</fName>
      <lName>Doe</lName>
   </author>
</authors>
</xsl:variable>
XPath ExampleResults
functx:follows-not-descendant(
     $in-xml//author[2],$in-xml//author[1])
true
functx:follows-not-descendant(
     $in-xml//author[1]/fName,
     $in-xml//author[1])
false
functx:follows-not-descendant(
     $in-xml//author[1],$in-xml//author[2])
false

See Also

functx:precedes-not-ancestorWhether an XML node precedes another without being its ancestor
functx:last-nodeThe XML node in a sequence that is last in document order

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C XML Query Working Group, XQuery 1.0: An XML Query Language, http://www.w3.org/TR/xquery/(name was changed from follows to follows-not-descendant for clarity)
Datypic XSLT Services

Recommended Reading:

XQuery