home contribute faq download

FunctX XSLT Functions

functx:first-node

The XML node in a sequence that appears first in document order

Google
Webdatypic.com

Description

The functx:first-node function returns the node in the sequence that appears first in document order. If nodes in the sequence are from multiple documents, which document is first is implementation-dependent.

Arguments and Return Type

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

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:first-node" as="node()?"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="nodes" as="node()*"/>

  <xsl:sequence select="
   ($nodes/.)[1]
 "/>

</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:first-node($in-xml//fName)
<fName>Kate</fName>
functx:first-node(
     ($in-xml//lName,
      $in-xml//fName) )
<fName>Kate</fName>

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-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery