mcs:feature

Purpose

Returns a boolean value indicating if the selected feature is supported on the current device.

A feature is a unique identifier for some functionality. It can refer to a single piece of functionality on a device, or to a functionality provided by a part of the application. Feature support depends on the version of MCS being used, and the capabilities of the device.

The mcs:feature function can be used to target policy variants. Refer to the topic entitled Variant selection criteria for more information.

Signature

mcs:feature [feature] as xs:boolean

Parameter

Name Description Type Use
feature A single string, or a sequence of strings representing the required features. If the set of the required features is a subset of the set of the features supported by MCS on the current device, or the required feature set is empty, then the function returns true; otherwise the function returns false. If the supplied values are not strings, then an error will be thrown. xs:string required 

Example

Note:

The mcs:feature function requires the http://www.volantis.com/xmlns/2006/01/xdime/mcs namespace declaration.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:sel="http://www.w3.org/2004/06/diselect"
  xmlns:cf2="http://www.volantis.com/xmlns/2009/07/cf2"
  xmlns:ui="http://www.volantis.com/xmlns/2009/07/cf2/ui"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>mcs:feature</title>
  </head>
  <body>
    <sel:select>
      <sel:when expr="mcs:feature('cf2:ui.SearchBar', 'cf2:ui.Button')">
        <p>Features supported</p>
      </sel:when>
      <sel:when expr="mcs:feature('cf2:ui.FlexibleBox')">
        <p>Feature supported</p>
      </sel:when>
      <sel:otherwise>
        <p>Features not supported</p>
      </sel:otherwise>
    </sel:select>
  </body>
</html>

Related topics