The naming scheme used for the data types in MAX provides some insight into the relationships between elements.
All elements used in MAX are in the namespace http://www.endeca.com/MDEX/data/IR600. In examples, this is usually assigned the prefix mdata.
The input of each query function (except mdex:metadata-query()) is an element with local name Query that conforms to a data type ending in Query. For example, the input of mdex:navigation-query is an element named Query that conforms to the NavigationQuery data type.
The result of each function is an element with local name <QueryType>Results that conforms to a data type ending in Result. For example, the result of mdex:navigation-query is an element named NavigationResults that conforms to the NavigationResult data type.
Collections of similar elements are contained in an outer element with a plural name. For example, to specify which dimension values to select in a navigation query, you create a SelectedDimensionValueIds element that contain a DimensionValueId element for each dimension value you are selecting. For example:
<Query xmlns="http://www.endeca.com/MDEX/data/IR600"> <SelectedDimensionValueIds> <DimensionValueId>8026</DimensionValueId> </SelectedDimensionValueIds> </Query>
let $numFiltersApplied := fn:count($results/mdata:AppliedFilters/*)
Any data type ending in List can only contain elements of the same type (or that are extensions of the same type). In addition, all elements that conform to a type ending in List have a plural name. They may also contain attributes that relate to all of the elements that they contain.
for $record in $results/mdata:RecordsResult/mdata:Records/* return $record/@IdNote that in the example above, you could use either * or mdata:Record after mdata:Records, because all children of the Records element can be treated as a record.
for $attribute in $record/mdata:Attributes/* return fn:concat($attribute/@Key, "-", fn:data($attribute))Note that the * after mdata:Attributes will give you both the properties and the dimension values.
Any element with a type ending in List will not appear in the results if it is empty, although it may appear if it contains relevant attributes. The element will appear, even if it is empty, if it is a direct child of the Results element.
Empty elements with a type ending in List are allowed in the input of a function.