Finds elements by the specified Element Location Path interpreted against the specified context element and returns an enumeration of the found elements.
Parameters:
element
The context element against which the Location Path is interpreted.If this parameter is not specified, the Location Path will be interpreted against the generator context element, which is the same as the call:
contextElement.findElementsByLPath(lpath)
See Also:
GOMContext.contextElement
lpath
The Location Path expression specifying how the elements should be searched.Use the Location Path Builder (found at the left panel's tree) to quickly construct a Location Path needed for this parameter.
filterQuery
This parameter allows you to specify a direct filtering condition on the element included in the result enumeration.When specified, this should be a boolean subquery created with
BooleanQuery()
function. The subquery will be processed against each initially selected element and should returntrue
if the element must be counted andfalse
otherwise. The tested element is passed to the subquery as the generator context element.Note: The
null
value in this parameter will mean that no filtering condition is specified.
uniqueKeyQuery
This parameter allows you to specify a different method of filtering the result elements -- by unique keys -- which will work in addition to the direct filtering specified with thefilterQuery
parameter (above).When specified, this should be a subquery created with
FlexQuery()
function. The subquery will be executed for each tested element (initially passed thefilterQuery
condition) to generate a certain key associated with that element. The elements whose keys are repeating will be excluded from the result enumeration.The tested element is passed to the subquery as the generator context element. The value returned by the subquery should be an object good to be a hash key. The
null
value is also allowed.Note: The
null
value in this parameter will be treated as no filtering by keys is specified.Note: When you need to filter elements by several keys with different types so that only the whole set of keys generated for each element must be unique, you can do it by creating a single compound filtering key using
HashKey()
function.
Returns:
The enumeration of the found and filtered elements.
See Also:
countElementsByLPath(), findElementsByLRules(), HashKey()
Tips:
You may also call this function in a method-like style, e.g.:
element.findElementsByLPath(lpath)
See Also:
findElementByLPath(), countElementsByLPath(), checkElementsByLPath(),
getValuesByLPath(), findElementsByLRules(), findChildren()
Examples:
The following expression counts those children of the generator's current context element, which are instances of 'Class' Element Type:
This expression was taken from the real template:count (findElementsByLPath ("Class"))
findElementsByLPath(rootElement, "classes^::ClassDoc [getAttrBooleanValue('isInterface')]")
It returns all those elements:
true
${include ../../../refs/lpaths.htm}