Name
id()
Returns the node in the source tree whose ID attribute matches the value(s) passed in as input.
Syntax
[1.0] node-setid(
object
)
[2.0] element()*id(
xs:string*
)
[2.0] element()*id(
xs:string*
,node()
)
Inputs
[1.0] An object. If the input object is
a node-set, the result is a node-set that contains the result of
applying the id()
function
to the string value of each node in the argument node-set.
Usually, the argument is some other node type, which is (or is
converted to) a string. That string is then used as the search
value while all attributes of type ID
are searched.
[2.0] An xs:string
and an optional node. If the
optional node argument is present, the processor looks for those
values in the document that contains that node.
In both XSLT 1.0 and 2.0, if the string value contains
multiple values separated by spaces, each space-separated value is
used as a search argument for the id()
function. Our examples here use
both simple strings and strings with multiple values.
Remember that a limitation of the XML ID
datatype is that a single set of
names across all attributes is declared to be of type ID
. The XSLT key()
function and the associated
<xsl:key>
element address
this and other limitations; see the description of the key()
function earlier in this appendix and
the description of the <xsl:key>
element in
Appendix A for more information.
Output
[1.0] A node-set containing all nodes
whose attributes of type ID
match the string values of the input node-set.
[2.0] A sequence containing ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.