Counts the number of elements that can be found by the specified Location Rules interpreted against the specified context element.

Parameters:

element

The initial context element against which the Location Rules are to be interpreted.

If this parameter is not specified, the generator context element is used by default, which is the same as the call: contextElement.findElementsByLRules(...)

See Also: GOMContext.contextElement

locationRules
Specifies an array of Location Rules to be interpreted (see "What are Location Rules?" below).

Each Location Rule is represented by an object created using LocationRule() function. See description of that function for more detail.

elementTypeSpec
Specify the list of target Element Types (see "Specifying Matching Element Types" below).

Only those initially found elements will be included in the result enumeration, which comply with at least one of the specified target Element Types.

filterQuery
Specify an additional condition on the returned elements.

This should be a boolean subquery created with BooleanQuery() function. The subquery will be processed against each initially selected element. It must return true if the element is to be counted and false otherwise. The tested element is passed as the generator context element.

Note: The null value in this parameter will be treated as no filtering condition.

uniqueKeyQuery
This parameter allows you to specify a different method of filtering the counted elements -- by unique keys -- which will work in addition to the direct filtering specified with the filterQuery parameter (above).

When specified, this should be a subquery created with FlexQuery() function. The subquery will be executed for each tested element (initially passed the filterQuery condition) to generate a certain key associated with that element. The elements whose keys are repeating will be excluded from the counting.

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 number of counted elements.

See Also:

LocationRule(), findElementsByLRules(), checkElementsByLRules(), countElementsByLPath(), FlexQuery(), BooleanQuery(), HashKey()

${include ../../../refs/lrules.htm}

${include ../../../refs/matching_ets_spec.htm}