Reference Productlist By Rule Configuration XML
Overview
This page lists the elements and attributes of the Product List by Rule XML configuration and what each one does. For the mental model, the build workflow, the modes, and the document parameters, see Concepts.
Take a look at the attached example that shows a few common configurations. Note that the attached Example is just a reference and can't be used without project-specific customization.
AccPackProductListRuleSample.xml
XML Configuration
(*): required
productListRuleSets(*)
The root element of the XML configuration. It can contain one or more productListRuleSet elements.
productListRuleSet(*)
| Attribute | Required | Description |
|---|---|---|
configId | yes | Unique id of each rule set. It should match the _renderingruleset value of the document parameter. |
mode | yes | Three modes are supported. Planning records run in planning mode as they are, or are converted to buckets in bucket mode. Bucket records run in bucket mode. Bucket records in planning mode return an error. • planning: works only when products are planning records.• bucket: works whether the products are buckets or planning records.• dummy: renders templates from dummy buckets when no products are planned. Useful when building a table of contents or index template. |
log | • 1: write the log to file.• 0: do not write the log. | |
logPath | File path to write the log. It supports some Predefined Comet Variables. Example: $DESKTOP/product-list-rule.log | |
projectIdentifier | Associates the rule set with a project. The helper that lists rule sets by project returns this rule set when its projectIdentifier matches the current project, and returns all rule sets when it is empty. |
Example:
<productListRuleSet configId="AccPackGeneric" mode="planning" log="1" logPath="$DESKTOP/product-list-rule.log">
productListRules(*)
Child element of productListRuleSet.
| Attribute | Required | Description |
|---|---|---|
exclusive | • true: if a product matches several rules, keep only the first matching rule (the lowest sort of <productListRule>).• false: do not remove duplicates (default). | |
defaultPageTemplate | yes | Default page template (id or name) for building products. |
Example:
<productListRules exclusive="true" defaultPageTemplate="A4PageTemplate">
pageTemplate
Child element of productListRules.
documentParameter
Child element of pageTemplate.
It is used to get the page template from the document parameter by identifier for building. This page template overrides
defaultPageTemplate of productListRules.
| Attribute | Required | Description |
|---|---|---|
identifier | yes | Document parameter identifier. The document parameter can be a text field or a dropdown list. If parameter is a text field, the first value ( value1) is supported. |
Example:
<pageTemplate>
<documentParameter identifier="_priint_pageTemplate"/>
</pageTemplate>
productListRule(*)
Child element of productListRules. Each rule can filter products by conditions and add them to the result list with
actions.
| Attribute | Required | Description |
|---|---|---|
sort | yes | An integer value. Rules run in ascending order of sort, so the lowest number is processed first. When exclusive is true, the first matching rule (the lowest sort) wins. |
pageTemplate | Page template (id or name) for building products of the current rule. It makes the build break to a new page for each rule. | |
masterPage | Master page name for this rule. This means all products of this rule are built with the specified master page. |
Example:
<productListRule sort="1" pageTemplate="HalfPageTemplate" masterPage="A-MasterPage">
conditionList
Filter root bucket/root planning by condition list. If conditionList is empty, do not filter.
| Attribute | Required | Description |
|---|---|---|
operator | • or: return a result if the product matches at least one condition (default).• and: return a result if the product matches all conditions. |
Example
<conditionList operator="or">
condition
Child element of conditionList.
Each condition can filter by entity, media asset, root planning record, or planning metadata.
Conditions run in ascending order of sort, so the lowest number is processed first.
| Attribute | Required | Description |
|---|---|---|
sort | yes | An integer value. Conditions are evaluated in ascending order of sort. |
A condition must contain exactly one of the following filter types:
Condition by entity
Filter by product entity and/or its label. The label supports regular expressions.
Example
<condition sort="1">
<entity>
<entityIdentifier>product</entityIdentifier>
<label>^(?!Logistic).*$</label>
</entity>
</condition>
Condition by media asset
Filter by media asset entity and/or its label. The label supports regular expressions.
Example
<condition sort="2">
<mediaAsset>
<entityIdentifier>product_image</entityIdentifier>
<label>Main Image(.*)</label>
</mediaAsset>
</condition>
Condition by root planning template
Filter by root planning entity and/or root planning assigned template.
rootTemplate accepts a template name, or PLANNED_TEMPLATE to match any record that has an assigned template.
Case 1: Match exactly a template
Only records whose assigned template matches the given template name are returned.
Example
<condition sort="3">
<planning>
<entityIdentifier>product</entityIdentifier>
<rootTemplate>Product Template</rootTemplate>
</planning>
</condition>
Case 2: Match any template
Use PLANNED_TEMPLATE keyword to return any record that has an assigned template, regardless of the template name.
Example
<condition sort="3">
<planning>
<entityIdentifier>product</entityIdentifier>
<rootTemplate>PLANNED_TEMPLATE</rootTemplate>
</planning>
</condition>
Condition by root planning metadata
Filter by metadata of the root planning record. Applies to planning records only.
Example
<condition sort="4">
<planningMetadata>
<metaDataEntityIdentifier>planning_layout</metaDataEntityIdentifier>
<value>1</value>
</planningMetadata>
</condition>
actionList
Contains a list of action elements. Each action can filter before it adds products to the result list.
Example
<actionList>
<action/>
<action/>
</actionList>
action
Child element of actionList.
An action adds products to the result list. Each action can filter before it adds.
| Attribute | Required | Description |
|---|---|---|
method | yes | Must be one of the supported values: • addDummyBucket• addCurrentBucket• addChildBucket |
We have some simple cases, as in the examples below:
Add a dummy bucket
Use addDummyBucket method.
This method is useful when building a table of contents or index template without planning records.
This method is used together with mode="dummy"
Example
<action method="addDummyBucket">
<pageItemIds>
<when assignTemplate="IndexAZ"/>
</pageItemIds>
</action>
Add root bucket
Use addCurrentBucket method.
<entity> is optional.
Example
<action method="addCurrentBucket">
<entity>
<entityIdentifier>article</entityIdentifier>
</entity>
<pageItemIds>
<when assignTemplate="Article Template"/>
</pageItemIds>
</action>
Add child bucket
Use addChildBucket method.
<entity> is optional.
Adds child bucket at level 1 under the root bucket. Root bucket is level 0.
The action is executed only for entities matching the configured entityIdentifier and entityLevel.
Set entityLevel to ANY to disable level validation.
Example
<action method="addChildBucket">
<entity>
<entityIdentifier>article</entityIdentifier>
<entityLevel>1</entityLevel>
</entity>
<pageItemIds>
<when assignTemplate="Article Table"/>
</pageItemIds>
</action>
pageItemIds
Child element of action. It contains a list of <when> elements that define the conditions for assigning templates to
products.
<when> is processed from top down and return when the first is matched. Top is higher priority.
Inside a when condition, entity can list several entityIdentifier values, matched with OR.
Imagine we want to filter some products and then, depending on each media asset/key value of the product, assign a specific template.
If you need to define a list of <when> elements as children of pageItemIds, you can do so for each rule you want.
These are some examples for <pageItemIds>:
Assign fixed template
This will override assigned template of bucket/planning record.
Example
<pageItemIds>
<when assignTemplate="Article Table"/>
</pageItemIds>
Assign planned template
This uses planned template of planning or bucket record.
Use PLANNED_TEMPLATE keyword.
Example
<pageItemIds>
<when assignTemplate="PLANNED_TEMPLATE"/>
</pageItemIds>
Assign template and break page
After applied template, should page break or not.
| Attribute | Required | Description |
|---|---|---|
type | Sets the direction of the page break: • any• left• right | |
value | • true: insert a page break. |
Example
<pageItemIds>
<when assignTemplate="Article Table">
<pageBreak type="any" value="true"/>
</when>
</pageItemIds>
Assign template if match key value and/or key value metadata
Assigns a template when the bucket contains matching key/value data.
| Attribute | Required | Description |
|---|---|---|
type | yes | Must be KEYVALUE. |
level | Specifies which bucket level is evaluated. The level of the current bucket processed by the current action is 0. Default 0. | |
ifEmpty | • true: the condition is considered a match if the bucket contains no key value data.• false: the condition is considered not matched if the bucket contains no key value data. |
A match is successful when a key value with the specified <entity> and <metaData> is matched.
Example
<pageItemIds>
<when assignTemplate="Article Spec Template">
<when type="KEYVALUE" level="0" ifEmpty="true">
<entity>
<entityIdentifier>product_attribute</entityIdentifier>
<key>code</key>
<value>123456</value>
</entity>
<metaData>
<entityIdentifier>display</entityIdentifier>
<key>display</key>
<value>yes</value>
</metaData>
</when>
</when>
</pageItemIds>
Assign template if match media asset and/or media asset metadata
Assigns a template when the bucket contains a matching media asset.
| Attribute | Required | Description |
|---|---|---|
type | yes | Must be MEDIA_ASSET. |
level | Specifies which bucket level is evaluated. The level of the current bucket processed by the current action is 0. Default 0. | |
ifEmpty | • true: the condition is considered a match if the bucket contains no media asset data.• false: the condition is considered not matched if the bucket contains no media asset data. |
A match is successful when a media asset with the specified <entity> exists and the <metaData> is matched.
Example
<pageItemIds>
<when assignTemplate="Article Image Template">
<when type="MEDIA_ASSET" level="0" ifEmpty="true">
<entity>
<entityIdentifier>product_image</entityIdentifier>
</entity>
<metaData>
<entityIdentifier>imageSize</entityIdentifier>
<key>layout</key>
<value>L</value>
</metaData>
</when>
</when>
</pageItemIds>