In the Variant Selection Criteria section of a Policy editor, you can choose a value in the Criteria dropdown that determines how MCS will select the variant. The criteria options have the following meanings.
In the Variant Selection Criteria section of a Policy editor, you can choose a value in the Criteria dropdown that determines how MCS will select the variant. The criteria options have the following meanings.
Only this variant may be selected by MCS. All types of variant may have this value.
Enables selection of one or more target devices from the standard hierarchy and/or a single custom device category set.
Applies only to audio variants.
Applies only to image variants. MCS searches for a variant with properties that make it suitable; encoding, pixel depth, rendering and image size are all used.
The table shows the possible values for Criteria for each variant type. The x shows the relationships.
Criteria options | Audio | Binding | Image | Link | Script | Text |
---|---|---|---|---|---|---|
Default | x | x | x | x | x | x |
Targeted | x | x | x | x | x | x |
Encoding | x | |||||
Generic | x |
If you select a value of 'Targeted' in the Criteria dropdown, you enable the Targets control, and can Browse to open the Target Selection dialog, and choose a combination of standard and custom devices to target. The dialog contains three tabs.
The Device List tab initially lists all the devices in the repository in alphanumeric order, and you can enter filter values to display a subset. The Device Tree tab shows the standard device hierarchy, and the Device Category tab lists the custom device sets for the current repository. Selected targets are displayed in a consolidated list on all three tabs.
The Variant Content section in policy editors holds information that can be used either by MCS, or by the client device.
The URL control usually contains the filename of the variant. This value can be combined with a prefix from an Asset group.
Both script and text policy editors provide an option, either to enter the literal text in the editor, or to provide a URL reference.
The Variant Content section in policy editors also contains a Null variant option that you can use to prevent fallback. If you set this control MCS behaves as if no policy could be found for the current device. Any values in the Metadata section will be cleared and the controls will be disabled.
For example, if you set a text variant in a policy fallback for an image, it will not be used, even when if the image is not available. The same approach works in the device hierarchy. Checking Null variant for a policy variant bound to a PC device will prevent that image being used as fallback for a specific browser.
All kinds of variant may have a null setting, with the exception of generic images.
If you define a null value for a particular device, no variant of any kind may be targeted at that device. If another variant has the same target, you will see a validation error.
Metadata values are used by MCS to determine how to use the variant when it has been selected.
In this section you can set values such as MIME type, rendering, height and width values, the available controls depending on the policy type you are working with. See Common variant attributes for an overview.
Image variants may be treated as convertible variants. If you select the Convertible option, MCS routes the image through the Media Access Proxy (MAP), changing the file format and scaling it to fit the device in use.
It is possible to use expressions to target variants by device capabilities based on policies from the device repository. Expressions must be valid XPath expressions, can contain MCS functions such as device:policy-value and mcs:feature, and standard XPath operators and functions. The mechanism selects the first variant which evaluates to 'true', as defined by the fn:boolean function.
To use this selection mechanism authors have to edit policies manually, i.e. it is impossible to define an expression using the MCS policy editors in the Mobile Portal Toolkit workbench. The expression element within a variant contains an expression. For example, assuming that devices are to be categorized by the width of the screen, it is not possible to use the pixelsx device policy directly as a category because the policy does not have a finite set of values. Therefore, expressions can be used on the variants to select a variant based on the device screen width.
<variable-policy
xmlns="http://www.volantis.com/xmlns/2011/06/marlin-lpdm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rpdm="http://www.volantis.com/xmlns/2011/06/marlin-rpdm"
xmlns:struct="http://www.volantis.com/xmlns/2005/10/ThemeStruct"
xsi:schemaLocation="http://www.volantis.com/xmlns/2011/06/marlin-lpdm
http://www.volantis.com/schema/2011/06/marlin-lpdm.xsd">
<type>script</type>
<variants>
<variant>
<type>script</type>
<selection>
<expression>device:policy-value('pixelsx') < 100</expression>
</selection>
<meta-data>
<script>
<encoding>javascript1.2</encoding>
<character-set>iso-8859-1</character-set>
</script>
</meta-data>
<content>
<embedded>
<data> some textual content 1 </data>
</embedded>
</content>
</variant>
<variant>
<type>script</type>
<selection>
<expression>device:policy-value('pixelsx') >= 100</expression>
</selection>
<meta-data>
<script>
<encoding>javascript1.2</encoding>
<character-set>iso-8859-1</character-set>
</script>
</meta-data>
<content>
<embedded>
<data> some textual content 2 </data>
</embedded>
</content>
</variant>
</variants>
</variable-policy>
Please note that different selection mechanisms can be combined together. MCS will check variants targeted at current device first, then variants targeted by category, then variants targeted by expression.