public class IdFunction extends Object implements Function
4.1 node-set id(object)
The id function returns a List
of all the elements in the context document that have an ID
matching one of a specified list of IDs. How an attribute is determined
to be of type ID depends on the navigator, but it normally requires that
the attribute be declared to have type ID in the DTD.
There should be no more than one element in any document with a certain ID. However, if there are multiple such elements — that is, if there are duplicate IDs — then this function selects only the first element in document order with the specified ID.
Constructor and Description |
---|
IdFunction()
Create a new
IdFunction object. |
Modifier and Type | Method and Description |
---|---|
Object |
call(Context context,
List args)
Returns a list of the nodes with the specified IDs.
|
static List |
evaluate(List contextNodes,
Object arg,
Navigator nav)
Returns a list of the nodes with the specified IDs.
|
public Object call(Context context, List args) throws FunctionCallException
call
in interface Function
context
- the context at the point in the
expression when the function is calledargs
- a list with exactly one item which is either a string
a node-setList
containing the first node in document
with each of the specified IDs; or
an empty list if there are no such nodesFunctionCallException
- if args
has more or less than one itempublic static List evaluate(List contextNodes, Object arg, Navigator nav)
contextNodes
- the context node-set. The first item in this list
determines the document in which the search is performed.arg
- the ID or IDs to search fornav
- the navigator used to calculate string-values and search
by IDList
containing the first node in document
with each of the specified IDs; or
an empty list if there are no such nodesCopyright 2001–2022 The Jaxen Project. All rights reserved.