home contribute faq download

FunctX XSLT Functions

functx:distinct-attribute-names

The distinct names of all attributes in an XML fragment

Google
Webdatypic.com

Description

The functx:distinct-attribute-names function returns the distinct set of attribute names that exist on nodes in $nodes or their descendants.

Arguments and Return Type

NameTypeDescription
$nodes node()* the root to start from
return value xs:string*

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:distinct-attribute-names" as="xs:string*"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="nodes" as="node()*"/>

  <xsl:sequence select="
   distinct-values($nodes//@*/name(.))
 "/>

</xsl:function>

Examples

<xsl:variable name="in-xml" as="item()*">
<authors a1="xyz">
   <author a2="abc">
      <fName a3="def">Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName a3="def">John</fName>
      <lName>Doe</lName>
   </author>
</authors>
</xsl:variable>
XPath ExampleResults
functx:distinct-attribute-names($in-xml)
('a1', 'a2', 'a3')

See Also

functx:distinct-element-namesThe distinct names of all elements in an XML fragment

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