Description
The functx:id-untyped function simulates the built-in fn:id function except that the value specified can be the value of any attribute, not just one declared to be of type xs:ID . This is useful for getting elements based on ID when a schema is not present. It returns all elements that have any attribute, regardless of name, whose value is the specified value.
Arguments and Return TypeName | Type | Description |
$node |
node()* |
the root node(s) to start from |
$id |
xs:anyAtomicType |
the "id" to find |
return value |
element()* |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:id-untyped" as="element()*"
xmlns:functx="http://www.functx.com">
<xsl:param name="node" as="node()*"/>
<xsl:param name="id" as="xs:anyAtomicType"/>
<xsl:sequence select="
$node//*[@* = $id]
"/>
</xsl:function>
|
Examples<xsl:variable name="in-xml" as="item()*"> | | <in-xml>
<a id="A001">abc</a>
<b foo="A001">def</b>
<c id="B001">ghi</c>
</in-xml>
|
| </xsl:variable> |
XPath Example | Results |
---|
functx:id-untyped($in-xml,'B001') |
<c id="B001">ghi</c> |
functx:id-untyped($in-xml,'A001') |
<a id="A001">abc</a>
<b foo="A001">def</b> |
functx:id-untyped($in-xml,'C001') |
() |
See AlsoHistory |
Recommended Reading:
|