Description
The functx:distinct-element-names function returns the distinct set of element names that exist in $nodes or among the descendants of $nodes.
Arguments and Return Type| Name | Type | Description |
$nodes |
node()* |
the root(s) to start from |
| return value |
xs:string* |
XSLT Function Declaration| See XQuery definition. | | XSLT 2.0 Syntax: |
|---|
<xsl:function name="functx:distinct-element-names" as="xs:string*"
xmlns:functx="http://www.functx.com" >
<xsl:param name="nodes" as="node()*"/>
<xsl:sequence select="
distinct-values($nodes/descendant-or-self::*/name(.))
"/>
</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> |
| XSLT Example | Results |
|---|
functx:distinct-element-names($in-xml)
|
('authors',
'author',
'fName',
'lName')
|
functx:distinct-element-names(
$in-xml/author[1])
|
('author',
'fName',
'lName')
|
Depends OnSee AlsoHistory |
|