Function Sets for the Z39.98-2012 Content Selection Feature

Table of Contents

The Target Function Set

The Target Function Set is used to select content based on intended properties of the output.

The canonical URI of this function set is http://www.daisy.org/z3998/2012/auth/features/select/functionSets/#target.

There are three functions in this set; the format(arg), audience(arg) and language(arg)functions:

The format function

The format(arg) function is used to specialize content fragments for particular physical output formats. This function takes one argument, arg, which must match the string datatype as defined in XML Schema Part 2: Datatypes Second Edition.

The following EBNF definition defines the allowed values of arg:

arg := 'BRAILLE' | 'LARGE_PRINT' | 'TALKING_BOOK' | 'EBOOK' | 'PRINT' | string
string := [A-Za-z0-9_]*

An explanation of the allowed values follows:

BRAILLE
Specifies that the output format is Braille. Note that this argument does not include the ability to specify Braille locales and varieties (contracted, non-contracted, etc).
LARGE_PRINT
Specifies that the output format is large print.
TALKING_BOOK
Specifies that the output format is a DAISY talking book.
EBOOK
Specifies that the output format is a an E-Book.
PRINT
Specifies that the output format is regular sized print (compare LARGE_PRINT). This value is typically used when producing content types such as PDF and XPS.

It is recommended to use arguments from the set of predefined values, but the possibility to use any string as an argument allows for more specialized implementations of this function.

Example:

<sel:select>
  <sel:when expr="target:format('BRAILLE')">
    …
  </sel:when>  
  <sel:otherwise>
    …
  </sel:otherwise>
</sel:select>

The audience function

The audience(arg) function is used to target content fragments to specific user groups.

This function takes one argument, arg, which must match the string datatype as defined in XML Schema Part 2: Datatypes Second Edition.

The following EBNF definition defines the allowed values of arg:

arg := 'BLIND | 'LOW_VISION' | 'DYSLEXIC' | 'DEAF' | 'HARD_OF_HEARING' | 'DEAF_BLIND' | 'COGNITIVE' | string
string := [A-Za-z0-9_]*

It is recommended to use arguments from the set of predefined values, but the possibility to use any string as an argument, allows for more specialized implementations of this function.

Example:

<sel:select>
  <sel:when expr="target:audience('COGNITIVE')">
    …      
  </sel:when>  
  <sel:otherwise>
    …
  </sel:otherwise>
</sel:select>

The language function

The language(arg) function is used to describe parallell language versions of a content fragment.

This function takes one argument, arg, which must match the language datatype as defined in XML Schema Part 2: Datatypes Second Edition.

All descendants of a when element which is using the language(arg) function inherit the language given as arg in the when parent, unless a descendant explicitly overrides this inheritance using the xml:lang attribute. In other words, the language(arg) function has the same semantics as xml:lang in terms of language inheritance.

Example showing a bilingual document, where the base language of the document is English:

<sel:select>
      <sel:when expr="target:language('es')">
            <p>Considerando también esencial promover el desarrollo 
                  de relaciones amistosas entre las naciones;</p>
      </sel:when>
      <sel:otherwise>
            <p>Whereas it is essential to promote the development 
                  of friendly relations between nations,</p>
      </sel:otherwise>
</sel:select>

The Parameter Test Function Set

The Parameter Test Function Set is used to test whether a string, the value argument, is equal to the value of the runtime name parameter.

The canonical URI of this function set is http://www.daisy.org/z3998/2012/auth/features/select/functionSets/#parameterTest.

This function set contains one function; the test(name, value) function. It takes two arguments, both of which must match the string datatype as defined in XML Schema Part 2: Datatypes Second Edition:

name
represents the name of a runtime parameter
value
represents value that the runtime parameter given in name must equal in order for the test to evaluate to true

String comparisons are case sensitive, and are done following

Example:

<sel:select>
  <sel:when expr="parameter:test('redistribution','prohibited')">
    <p>Any reproduction or redistribution of this publication is expressly prohibited by law …</p>
  </sel:when>      
  <sel:otherwise/>            
</sel:select>

Or, inversely, if the default nature of the document is to have restrictions on redistribution:

<sel:select>
  <sel:when expr="parameter:test('redistribution','unprohibited')" />      
  <sel:otherwise>
  	<p>Any reproduction or redistribution of this publication is expressly prohibited by law …</p>
  </sel:otherwise>            
</sel:select>

The Feature Supported Function Set

The Feature Supported Function Set is used to test whether a specific ANSI/NISO Z39.98-AI Feature is supported by the processing agent.

There is one function in this set, the featureSupported(uri) function. It takes one argument, uri, which is a string equal to the canonical URI of a NISO Z39.98-2012 Feature.

The canonical URI of this function set is http://www.daisy.org/z3998/2012/auth/features/select/functionSets/#featureSupported.

Example:

<sel:select xmlns:sel="http://www.daisy.org/ns/z3998/authoring/features/select/">
    <sel:when expr="fs:featureSupported('http://www.example.com/z3998/2012/auth/features/foo/2.0/')">        
        …
    </sel:when>    
    <sel:otherwise>
        …
    </sel:otherwise>
</sel:select>

Note that since feature URIs are versioned, this function can be used to test support for different versions of the same feature.