W3C

Content Selection for Device Independence (DISelect) 1.0

W3C Working Draft 10 October 2006

This version:
http://www.w3.org/TR/2006/WD-cselection-20061010/
Latest version:
http://www.w3.org/TR/cselection/
Previous version:
http://www.w3.org/TR/2005/WD-cselection-20050502/
Editors:
Rhys Lewis, Volantis Systems Ltd. <rhys@volantis.com>
Roland Merrick, IBM <roland_merrick@uk.ibm.com>
Max Froumentin, W3C <maxf@w3.org>

Abstract

This document specifies a syntax and processing model for general purpose content selection or filtering. Selection involves conditional processing of various parts of an XML information set according to the results of the evaluation of expressions. Using this mechanism some parts of the information set can be selected for further processing and others can be suppressed. The specification of the parts of the infoset affected and the expressions that govern processing is by means of XML-friendly syntax. This includes elements, attributes and XPath expressions. This document specifies how these components work together to provide general purpose selection.

There is a companion document which provides introductory information concerned with this specification [DI Primer].

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is the second W3C Last Call Working Draft of the Content Selection for Device Independence (DISelect) specification, for review by W3C members and other interested parties. The list of comments received during the first Last Call Working Draft and their resolutions made by the WG are available in the first Disposition of Comments document.

Substantial modifications have taken place in response to comments received on the first last call draft of this document. Structurally, the specification has been split into three documents. In addition to this markup specification there is now a separate XPath function specification and, in addition, a Primer. They each cross reference each other. Functionally, a number of substantive changes have been made. In particular, there are now two profiles of the specification. One of these is a subset suitable for implementation on systems with limited processing power. The full profile of the specification can now use more than just the delivery context in determining which content is selected. In particular, the source infoset that contains the DISelect markup can now be used as a source of information on which decisions can be taken. In addition to these major changes, a number of typographical errors have been corrected and a number of clarifications have been made.

This Last Call review period ends on 07 November 2006 at 2359Z. Please send review comments before the end of the review period to public-diselect-editors@w3.org. This list is archived at http://lists.w3.org/Archives/Public/public-diselect-editors/.

Following completion of Last Call, the Device Independence Working Group plan to produce formal responses to all comments received by the Working Group and then advance the specification to a Candidate Recommendation.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document is published as part of the W3C Device Independence Activity by the Device Independence Working Group (Member-only link). It is a deliverable as defined in the Charter of that group.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1 Introduction
    1.1 Towards a Device Independent Markup Language Profile
    1.2 Reading the Specification
        1.2.1 Conformance Information for DISelect
            1.2.1.1 Normative and Informative Parts
            1.2.1.2 Normative Language for Conformance Requirements
            1.2.1.3 DISelect Profiles
            1.2.1.4 Document Conformance
            1.2.1.5 DISelect Implementation Conformance
    1.3 Documentation Conventions
2 Document Structure
    2.1 The Namespaces
    2.2 The Selection Module
3 Processing Model
    3.1 Events Overview
    3.2 Events in Response to Errors
        3.2.1 The diselect-invalid-type-error Event
        3.2.2 The diselect-redeclaration-error Event
        3.2.3 The diselect-declaration-exception Event
        3.2.4 The diselect-compute-exception Event
4 Attributes for Conditional Processing
    4.1 Overview
    4.2 The expr Attribute
    4.3 The selid and selidname Attributes
        4.3.1 Generated Host Language Identifiers
    4.4 The functions Attribute
    4.5 Using the Attributes
5 Elements for Conditional Processing
    5.1 Overview
    5.2 Conditional Processing
        5.2.1 The if Element
            5.2.1.1 Attributes
        5.2.2 The select Element
            5.2.2.1 Attributes
            5.2.2.2 Processing
        5.2.3 The when Element
            5.2.3.1 Attributes
        5.2.4 The otherwise Element
            5.2.4.1 Attributes
    5.3 Using the Elements
6 Variables
    6.1 The variable Element
        6.1.1 Attributes
        6.1.2 Declaring a Variable
        6.1.3 Referencing an Existing Variable Using the variable Element
        6.1.4 References to Variables in XPath Expressions
        6.1.5 Scope of Variables and Nesting
        6.1.6 Types
            6.1.6.1 Type Conversion
    6.2 The value Element
        6.2.1 Attributes
    6.3 Using Variables
7 Attribute Value Templates
    7.1 Using Attribute Value Templates
8 XPath Expressions
    8.1 Identifying Profiles and Versions
        8.1.1 The getProfileName function
            8.1.1.1 Prototype
            8.1.1.2 Function
        8.1.2 The sel:getVersion function
            8.1.2.1 Prototype
            8.1.2.2 Function
    8.2 DISelect Basic XPath Support
        8.2.1 Accessing the Delivery Context using the XPath Subset
        8.2.2 Formal Grammar for the DISelect Basic Subset
    8.3 DISelect Full XPath Support
        8.3.1 Path-Based Access to the Delivery Context
        8.3.2 Path-Based Access to the Host Document
    8.4 Extension Functions

Appendices

A Schema
B References
    B.1 Normative References
    B.2 Informative References
C Changelog (Non-Normative)
    C.1 Changes in this Version
D Acknowledgements (Non-Normative)


1 Introduction

1.1 Towards a Device Independent Markup Language Profile

This specification represents one part of the approach being developed within DIWG for the provision of a markup language that supports creation of web sites that can be used from a wide variety of devices with a wide variety of characteristics. This document is one of a set of three related to the specification. The companion documents are a primer [DI Primer] and a specification for a set of XPath functions [DCN XAF].

DIWG is developing a device independent authoring language profile [DIAL]. The profile will be based on specifications such as XHTML Version 2 [XHTML 2], XForms [XForms] and current and forthcoming versions of CSS [CSS]. DIWG is developing additional modules that can be added to this combination of specifications to complete the profile. This specification describes one of these modules.

The module described in this specification provides the ability to select between different versions of materials. The module is designed to be used within other markup languages, and in particular, within the device independent authoring language profile [DIAL] being developed by DIWG. The term host language is used in this document to indicate the language within which DISelect is being used.

In its paper on Authoring Challenges [Authoring Challenges], DIWG identified a series of challenges faced by authors trying to create materials that could be used on a wide variety of devices with very different characteristics. One common theme emerging from this work was the need to support authors in the specification of variabilityin the materials they produce.

In its paper on Device Independence Principles [DI Principles], DIWG pointed out that the process by which authored materials are adapted for use on particular devices may take place at any point between the source of the material and the device itself.

The ability to select between different versions of material provides one important mechanism by which authors can support variability. The mechanism by which a particular version is chosen from those available, during adaptation should not be excessive in its processing demands, since it may need to be performed on a device with limited capacity.

Some user agents provide programming capability that can be exploited by authors to achieve results similar to those described in this specification. For example, [ECMAScript] is available in some browsers. Such facilities are, of course, very powerful, and allow dynamic modification of and interaction with the page during the user interaction. However, they are not universally available. In addition, the intent of the author is embodied within the program code rather than being declared within markup. This may cause difficulties in interpretation for assistive technologies, for example. A recent TAG Finding [Least Power] encourages the use of the least powerful language which is suitable for a particular purpose. The definition of this module attempts to follow this principle.

This specification provides a mechanism for the selection of the content that is to be expressed when adaptation takes place. It does not attempt to provide the dynamic modification associated with browser programming, embodied in languages such as [ECMAScript], nor does it attempt to provide the comprehensive transformation capabilities of [XSLT]. Rather, it provides capabilities that could be implemented using those mechanisms, but in a way that can requires only modest capability from the processors involved.

1.2 Reading the Specification

1.2.1 Conformance Information for DISelect

1.2.1.1 Normative and Informative Parts

The normative and informative parts of this specification are identified by use of labels within various sections. Generally, everything in the specification is considered to be normative, apart from the examples.

1.2.1.2 Normative Language for Conformance Requirements

Individual conformance requirements or testable statements are identified in the DISelect specification by the use of specific key words. In particular, the key words must, must not, required, shall, shall not, should, should not, recommended, may, and optionalin this specification are to be interpreted as described in [IETF RFC 2119].

1.2.1.3 DISelect Profiles

This specification defines two profiles of the DISelect markup:

DISelect Full

This profile contains all the markup normatively defined in this specification.

DISelect Basic

This profile contains all the markup normatively defined in this specification, with the exception of the markup labelled as belonging only to the DISelect Full profile

This profile is a subset of the DISelect Full profile intended to be implemented on small-footprint DISelect implementations, typically running on portable devices with limited processing power and memory.

1.2.1.4 Document Conformance

A Document conforming to the DISelect Full profile can include any markup defined in this document.

A Document conforming to the DISelect Basic profile must not include markup defined in this document as belonging only to the DISelect Full profile.

1.2.1.5 DISelect Implementation Conformance

A DISelect Full implementation must implement all the normative features defined in this specification.

A DISelect Basic implementation must implement the normative features defined in this specification which are not described as belonging to the DISelect Full profile. A DISelect Basic processor encountering features belonging only to the DISelect Full profile must raise a diselect-compute-exception exception.

1.3 Documentation Conventions

The following namespace prefixes and corresponding namespace identifiers are used in this document:

sel:

The DISelect namespace described in section 2.1 The Namespaces.

dcn:

The Delivery Context namespace described in section 2.1 The Namespaces.

In the examples, the default namespace, with no prefix, is used to indicate the host language within which the content selection markup is being used. The examples assume that the host language is XHTML Version 2 [XHTML 2].

The XML representations of various elements within DISelect are presented using the syntax for Abstract Modules in XHTML Modularization [XHTML Modularization]

Expressions in the examples used in this document are based on [XPath 1.0]. This syntax requires that specific characters be escaped appropriately for use within XML processors. This quoting is used explicitly throughout the document.

2 Document Structure

2.1 The Namespaces

DISelect is not a stand-alone document type. It is intended to be integrated into other host languages such as XHTML.

A DISelect document must contain a declaration for the DISelect namespace.

XML Processors must use the XML namespaces mechanism [XML Names] to recognize elements and attributes from this namespace.

The DISelect namespace has the URI: http://www.w3.org/2005/sel.

The Delivery Context namespace has the URI: http://www.w3.org/2005/dcn.

2.2 The Selection Module

Elements and attributes in the content selection module
Elements Attributes Minimal Content Model
ANY ##other expr
ANY ##other selid
ANY ##other selidname
ANY ##other functions
if expr, selidname, functions ((ANY ##other) | if | select)*
select expr, precept, selidname, functions when* otherwise?
when expr, selidname, functions ((ANY ##other) | if | select)*
otherwise selidname, functions ((ANY ##other) | if | select)*
variable name, ref, value EMPTY
value expr

The selection module consists of a set of elements and associated attributes that allow authors to specify how content will be selected for use in different delivery contexts.

The if and select elements provide mechanisms for choosing whether or not to use particular parts of the content. Their associated attributes and sub-elements provide the means to control how the alternatives are defined and how the decisions are made.

Section 4 Attributes for Conditional Processing describes how the attributes are used within a host markup language. Section 5 Elements for Conditional Processing describes the markup elements themselves. Section 6 Variables describes variables that can be used to simplify expressions. Section 7 Attribute Value Templates describes how DISelect supports the use of attribute value templates in host language elements. Finally, section 8 XPath Expressions describes the expressions used within DISelect to control the decisions about which content is used.

3 Processing Model

This section is normative.

Selection, as defined in this document, is a specific type of transformation applied to an XML information set [XML Infoset]. The input for the selection transformation is referred to as the source infoset. The result of the transformation is referred to as the result infoset.

The source infoset includes elements and attributes from the DISelect namespace. These attributes and elements control whether or not certain parts of the source infoset are expressed in the result infoset. The details of how the attributes and elements control selection are described in 4 Attributes for Conditional Processing and 5 Elements for Conditional Processing.

The elements and attributes from the DISelect namespace which are present in the source infoset do not appear in the result infoset.

3.1 Events Overview

DISelect uses the events system defined in [DOM2 Events] and [XML Events]. These event models specify an event capture flow that includes:

Capture Phase

Processing where the event flows down the DOM tree towards its target element. In this phase, appropriately registered event handlers are notified of the event and may perform processing based on it.

Arrival at Target

When the event arrives at its target element, event handlers registered there are notified of the event and may perform processing based on it.

Bubbling Phase

Processing in which the event flows back up the DOM tree towards its root. In this phase, appropriately registered event handlers are notified of the event an may perform processing based on it.

The following sections define specific events associated with DISelect. In each case, the target element is defined together with information about whether the event bubbles and whether or not the default action can be cancelled.

3.2 Events in Response to Errors

During transformation, certain situations may occur that cause events to be raised. These situations represent errors that have been detected by the DISelect processor. DISelect does not contain any facilities by which events can be detected and processed other than by the processor.

Error indications happen as a result of unusual conditions in the DISelect Processor. There are two types of error indication.

Exception

Exceptions cause the DISelect processor to halt. The names bear the suffix exception.

Error

Errors are raised for notification. They do not cause the DISelect processor to halt. They bear the suffix error. It is permissible for the DISelect Processor to perform default handling for any of the events of this type. For example, a DISelect processor might choose to log error messages to a file.

3.2.1 The diselect-invalid-type-error Event

This event is raised when the DISelect processor detects a type mismatch. For example, this event will be raised if an attempt is made to assign a value to a variable which cannot be converted to the variable's type.

Cancelable? Bubbles? Target Element Default Action
No Yes The element in which the type mismatch occurred The DISelect processor ignores the assignment.

3.2.2 The diselect-redeclaration-error Event

This event is raised when an attempt is made to declare a variable that is already in existence. It is an error.

Cancelable? Bubbles? Target Element Default Action
No Yes The element in which the redeclaration occurred The DISelect processor ignores the redeclaration.

3.2.3 The diselect-declaration-exception Event

This event is raised when an attempt is made to declare a variable but the declaration is invalid. A declaration is invalid, for example, if no initial value is specified for the variable. It is an exception.

Cancelable? Bubbles? Target Element Default Action
No Yes The element in which the declaration occurred The DISelect processor halts.

3.2.4 The diselect-compute-exception Event

This event is raised when an exception occurs during the evaluation of an XPath expression. It is raised, for example, if an XPath function required for evaluation of an expression is not available to the processor. It is also raised if a DISelect Basic processor encounters an expression only defined in the DISelect Full profile. It is an exception.

This exception should not be used to detect which DISelect profile is supported by a processor. Instead, a document author should use the getProfileName or getVersion functions. See 8.1 Identifying Profiles and Versions

Cancelable? Bubbles? Target Element Default Action
No Yes The element in which the compute exception occurred The DISelect processor halts.

4 Attributes for Conditional Processing

This section is normative.

4.1 Overview

DISelect provides three attributes that can be used with elements of the host language. This section describes those attributes. One attribute, expr, simplifies the specification of selection under certain circumstances. The other attributes, selid and selidname, provide a mechanism for avoiding problems associated with duplication of values of host language attributes that represent unique identifiers.

When used within a host language element, the DISelect attributes need to be appropriately qualified to indicate that they are within the content selection namespace.

4.2 The expr Attribute

The expr attribute is useful for simple decisions that affect small amounts of content. It is used within elements of the host language. It defines an expression used to determine whether or not the host language element appears in the result infoset. It can be added to any element of the host language.

The DISelect processor evaluates the expression defined by the exprattribute. If the result is a boolean value of true, the element that contains the attribute and all of its descendents appear in the result infoset. If it has a value of false, the element and its descendents are omitted from the result infoset. The attribute itself does not appear in the result infoset.

The expressions used with this attribute are described in section 8 XPath Expressions.

The default value of this attribute is true. Consequently, if the attribute is not specified on a host language element, the element and all of its descendents appear in the result infoset.

Section 4.5 Using the Attributes illustrates the use of the expr attribute.

If the decision to include or exclude material applies to a significant amount of content or if a number of different versions of the content are available, it is usually simpler to use the elements which are also part of this module. These are described in section 5 Elements for Conditional Processing.

4.3 The selid and selidname Attributes

The notion of unique identifiers that can be associated with particular elements in markup languages is common, if not universal. Using them allows particular instances to be identified so that, for example, links can be created or particular styling can be specified. Often, markup languages use an attribute named id for this identifier. Markup languages based on XML often use the attribute xml:id for this purpose.

The uniqueness of these identifiers usually forms part of the validity constraints associated with the host language. The presence of multiple elements with the same identifier violates the constraints and makes the associated document invalid. This is a potential issue when the host language is combined with a selection mechanism, such as the one detailed here. An author may wish to provide alternative versions of particular elements to be used under different circumstances. Both versions may need to carry the same identifier. Consequently, although the document resulting from processing the selection markup will be valid, the document containing the selection markup is not.

The selid and selidname attributes provide a solution for this problem. Rather than specify the host language unique identifier attribute directly, authors can use the DISelect selidand selidnameattributes instead. The selid attribute defines the value of a host language identifier while the selidname attribute defines its name.

4.3.1 Generated Host Language Identifiers

By default, a DISelect processor uses the value of the selidattribute to generate an xml:id attribute. During processing, the value of selid attribute on an element of in the source infoset becomes the value of the generated xml:id attribute on the equivalent element of the result infoset.

If the host language uses an attribute other than xml:id as its unique identifier, the attribute generated can be named using the selidname attribute. The value of the selidnameattribute is the name of the host language attribute which represents a unique identifier. When selidname is used, the DISelect processor generates unique identifiers with the specified name, rather than xml:id. The scope of the selidname attribute is the host language element on which it is used and all descendent elements. Consequently, if it is specified on the root element of the host document, it can be made to apply to the entire document.

Section 4.5 Using the Attributes illustrates the use of the selid and selidnameattributes.

4.4 The functions Attribute

This attribute defines the names of additional XPath functions that are required to enable processing of material that contains DISelect elements and attributes. It allows authors to verify that the materials they have provided can be processed by the DISelect processor. The names in the list reference functions that are required by the content in addition to the set provided by the DISelect processor itself. Facilities that must be provided by the DISelect processor are described in section 8 XPath Expressions.

The value of the functionsattribute is a space-separated list of the XPath extension functions that are required for processing. Each extension function is represented by a QName.

The DISelect processor verifies that any functions specified using this element are available. If they are not, the processor causes an invalid computation exception to be raised (see 3.2.4 The diselect-compute-exception Event).

A DISelect processor mustverify the availability of the resources defined by this attribute no later than the point during processing at which it encounters the functionsattribute in the source infoset. A DISelect processor mayverify resource availability before it encounters the attribute. For example, the processor may verify the availability of resources at the time the infoset containing the attribute is loaded. This provides an optimization by avoiding unnecessary processing that would be rendered invalid by subsequent discovery of missing resources.

The functions attribute can occur any number of times within a source infoset. The set of resources required by the source infoset is considered to be the union of those defined by all of the functions attributes that are processed by the DISelect processor.

4.5 Using the Attributes

The examples in this section are informative. They have been chosen for clarity and simplicity. They are not intended to represent best practice. The companion primer [DI Primer] discusses a variety of ways to use DISelect under different circumstances.

The following example illustrates suppression of the display of an image if the usable width of the display on a device is too small. The first and third paragraphs containing the text are always presented. However, the second paragraph containing the image is shown only if the dcn:cssmq-width function indicates that the usable width of the device display is more than 200 pixels. If the second paragraph is shown, the object element will carry a generated xml:id attribute with a value of artimg42.

<p>The flooding was quite extensive.</p>
<p sel:expr="dcn:cssmq-width('px') &gt; 200">
    <object src="image1" sel:selid="artimg42"/>
</p>
<p>Many people were evacuated from their homes.</p>

The conditional expressions used within the expr attribute can contain multiple terms that relate to different characteristics from the delivery context. So, for example, if the image should only be shown on devices with color displays wider than 200 pixels, the following markup might be used.

<p>The flooding was quite extensive.</p>
<p sel:expr="dcn:cssmq-width('px') &gt; 200 and dcn:cssmq-color() &gt; 0">
    <object src="image1" sel:selid="artimg42" sel:selidname="myns:myid"/>
</p>
<p>Many people were evacuated from their homes.</p>

In this version of the example, the value of the expr attribute is true only if the dcn:cssmq-width function indicates that the usable width of the device is more than 200 pixels and that the dcn:cssmq-color function indicates that the display supports color.

In addition, in this second example, if the second paragraph is shown, the object element will carry a generated myns:myid attribute with a value of artimg42. In this case, the selid attribute specifies the value of the generated attribute and the selidname attribute specifies its name.

<div selidname="myns:myid">
  <p>The flooding was quite extensive.</p>
  <p sel:expr="dcn:cssmq-width('px') &gt; 200 and dcn:cssmq-color() &gt; 0">
    <object src="image1" sel:selid="artimg42"/>
  </p>
  <p>Many people were evacuated from their homes.</p>
</div>

This version of the example is the same as the previous one, except that the selidname attribute is used to specify the name of the attribute to be generated from any sel:selid attributes in the markup contained within the div element.

Notice that in these examples, the attributes relating to conditional selection are qualified to indicate that they are from the DISelect namespace.

5 Elements for Conditional Processing

This section is normative.

5.1 Overview

DISelect defines several elements used for controlling whether or not material appears in the result infoset as a result of processing. It also defines one element used to specify additional capabilities that must be available for use.

5.2 Conditional Processing

5.2.1 The if Element

This element defines a set of material that is to be included in the result infoset if the associated expression has the appropriate value. This element provides an alternative to use of the expr attribute in the elements of the host language. It is particularly useful when a specific condition applies to several elements of the host language. In addition, the if element allows control to be applied to a wider range of XML document fragments than does the expr attribute alone.

Note that there is no else element. Instead, the select element and its children, provide the mechanism for choosing between alternative versions of material.

5.2.1.1 Attributes
expr

This mandatory attribute defines an expression used in determining whether or not the descendents of the element appear in the result infoset. If the expression evaluates to a boolean value of true, the descendents of the if element appear in the result infoset. If the expression evaluates to a value of false, the descendents of the if element are omitted from the result infoset.

selidname

This optional attribute defines the name of the host language attribute that provides unique identifiers. If it is not specified on this element, and has not been specified on any antecedent element, the DISelect processor assumes that the host language unique identifiers are specified using the xml:id attribute. Section 4.3 The selid and selidname Attributes contains more details on the use of attributes associated with host language identifiers.

functions

This optional attribute defines the names of additional XPath functions that are required to enable processing of material within the element on which it is used. The value of the attribute is a space-separated list of the XPath extension functions (represented by QNames) that are required for processing. Section 4.4 The functions Attribute contains more details on the use of this attribute.

5.2.2 The select Element

This element encloses one or more sets of material that are subject to conditional selection. It contains one or more when elements and an optional otherwise element. Expressions associated with the select and when elements control the conditions under which particular parts of the content are processed.

5.2.2.1 Attributes
expr

This optional attribute defines an expression used in determining whether or not the entire select element is processed by the DISelect processor. If the expression evaluates to a boolean value of true, the select element is processed with the result that some of the content it contains may appear in the result infoset. If the expression has a value of false, the entire select element is ignored by the DISelect processor.

precept

This optional attribute defines the basic rule applied to matching within the select element. It can take one of the following values:

matchfirst

This is the default value. When it is specified, the descendents of the first when element that has an expr attribute that evaluates to true appear in the result infoset. The descendents of other when elements are ignored, even if their expr attributes evaluate to true. The descendents of any otherwise element is ignored if any of the when elements has an expr attribute that evaluates to true.

matchevery

When this value is specified, the descendents of every when element that has an expr attribute that evaluates to true appear in the result infoset. The descendents of any otherwise element are ignored if any of the when elements has an expr attribute that evaluates to true.

selidname

This optional attribute defines the name of the host language attribute that provides unique identifiers. If it is not specified on this element, and has not been specified on any antecedent element, the DISelect processor assumes that the host language unique identifiers are specified using the xml:id attribute. Section 4.3 The selid and selidname Attributes contains more details on the use of attributes associated with host language identifiers.

functions

This optional attribute defines the names of additional XPath functions that are required to enable processing of material within the element on which it is used. The value of the attribute is a space-separated list of the XPath extension functions (represented by QNames) that are required for processing. Section 4.4 The functions Attribute contains more details on the use of this attribute.

5.2.2.2 Processing

The whenelements within a selectare processed in document order. This is significant since this order can affect the particular whenelement chosen when the precept attribute has a value of matchfirst. It also affects the order in which material is included in the result infoset when the preceptattribute is set to matcheveryand multiple whenelements have exprattributes that evaluate to true.

5.2.3 The when Element

This element defines a set of material that is to be selected for processing if the associated expression has the appropriate value. A single select element may contain multiple when elements.

5.2.3.1 Attributes
expr

This mandatory attribute defines an expression used in determining whether or not the descendents of the element appear in the result infoset. If the expression evaluates to a boolean value of true, the descendents of the when element appear in the result infoset. If it evaluates to false, the descendents of the when element are omitted from the result infoset. Note, however, that the value of the precept attribute of the containing select element determines overall which when elements are considered for possible selection.

selidname

This optional attribute defines the name of the host language attribute that provides unique identifiers. If it is not specified on this element, and has not been specified on any antecedent element, the DISelect processor assumes that the host language unique identifiers are specified using the xml:id attribute. Section 4.3 The selid and selidname Attributes contains more details on the use of attributes associated with host language identifiers.

functions

This optional attribute defines the names of additional XPath functions that are required to enable processing of material within the element on which it is used. The value of the attribute is a space-separated list of the XPath extension functions (represented by QNames) that are required for processing. Section 4.4 The functions Attribute contains more details on the use of this attribute.

5.2.4 The otherwise Element

This element defines a set of material that appears in the result infoset if none of the when elements within the containing select element has an expr attribute that evaluates to true.

5.2.4.1 Attributes
selidname

This optional attribute defines the name of the host language attribute that provides unique identifiers. If it is omitted, the DISelect processor assumes that the host language unique identifier is xml:id. Section 4.3 The selid and selidname Attributes contains more details on the use of attributes associated with host language identifiers.

functions

This optional attribute defines the names of additional XPath functions that are required to enable processing of material within the element on which it is used. The value of the attribute is a space-separated list of the XPath extension functions (represented by QNames that are required for processing. Section 4.4 The functions Attribute contains more details on the use of this attribute.

5.3 Using the Elements

The examples in this section are informative. They have been chosen for clarity and simplicity. They are not intended to represent best practice. The companion primer [DI Primer] discusses a variety of ways to use DISelect under different circumstances.

In this first example, the expr attribute on the if element controls the selection. If the display on the device is more than 200 pixels wide, both the image and the paragraph will be included in the result infoset. If the display is not more than 200 pixels wide, they will be omitted.

<sel:if expr="dcn:cssmq-width('px') &gt; 200">
  <object src="image1"/>
  <p>Many people had to be evacuated.</p>
</sel:if>  

In the second example, the expr attributes on the when elements control the selection.

<sel:select>
  <sel:when expr="dcn:cssmq-width('px') &gt; 200">
    <object sel:selid="pic42" src="image1"/>
  </sel:when>
  <sel:when expr="dcn:cssmq-color() &gt; 4">
    <object sel:selid="pic42" src="image2"/>
  </sel:when>
  <sel:otherwise>
    <p sel:selid="pic42">Many people had to be evacuated.</p>
  </sel:otherwise>
</sel:select>  

Each when element carries an expression in its expr attribute. The select element does not have a precept attribute. As a result, the precept defaults to matchfirst. Consequently, the descendents of the first when element whose expr attribute evaluates to true will be included in the result infoset. Based on the expressions in the example, if the usable width of the device, as reported by the dcn:cssmq-width function, is greater than 200 pixels, image1 will be included. If it is not, but if the device supports more than 4 bits per color, as reported by the dcn:cssmq-color function, image2 will be included. If neither of these conditions is true the paragraph of text is included.

This example also illustrates use of the selid attribute. The image elements and the paragraph element all carry the same value of pic42 for this attribute. After processing, whichever of the elements appears in the result infoset will carry an id attribute with this value.

<sel:select precept="matchevery">
  <sel:when expr="dcn:cssmq-width('px') &gt; 200">
    <object src="image1"/>
  </sel:when>
  <sel:when expr="dcn:cssmq-color() &gt; 4">
    <object src="image2"/>
  </sel:when>
  <sel:otherwise>
    <p>Many people had to be evacuated.</p>
  </sel:otherwise>
</sel:select>  

The third example is a slightly modified version of the second example. The select element carries a precept attribute with a value of matchevery. This change means that the descendents of every when element whose expr attribute evaluates to true are included in the result infoset. In this version of the example, if the usable width of the device is greater than 200 pixels and the device supports more than 4 bits per color, both images will be included. With a precept of matchfirst, only image1 would have been included. If neither of the conditions is true, the paragraph be included instead of the images.

<div sel:selidname="myns:myid" sel:functions="myfns:specialFunction1 mynfs:specialFunction2">
...
  <sel:select precept="matchfirst">
    <sel:when expr="dcn:cssmq-width('px') &gt; 200 and dcn:cssmq-color() &gt; 4">
      <object src="image1"/>
    </sel:when>
    <sel:when expr="dcn:cssmq-color() &gt; 4">
      <object src="image2"/>
    </sel:when>
    <sel:otherwise>
      <p>Many people had to be evacuated.</p>
    </sel:otherwise>
  </sel:select> 
...
</div>

The final example illustrates the use of slightly more complex expressions within the expr attribute on the when elements. In this case, the content of the first when element will be selected if the usable width of the device is greater than 200 pixels and the device supports more than 4 bits per color.

In addition, this example illustrates use of the selidname attribute on the containing host language div element. This attribute defines the name of the generated unique identifiers as myns:myid. The same div element also includes a functions attribute that defines two additional functions needed within this particular source infoset.

6 Variables

DISelect supports the use of variables to help reduce the complexity of expressions and markup. Variables are declared and initialized using markup. Their values can also be modified using markup. Variables can be referenced from within expressions using standard XPath mechanisms.

6.1 The variable Element

The variable element is used to declare a variable and to set its value.

6.1.1 Attributes

name

This attribute specifies the name of the variable. It is used when declaring a new variable.

ref

This attribute specifies the name of the variable. It is used when referring to a variable that has already been declared.

value

This attribute specifies an XPath expression that provides the value to be assigned to the variable.

6.1.2 Declaring a Variable

A variable is declared by using the variable element with its name attribute set to the name of the new variable. Variables must be declared before they can be referenced.

The initial value of a variable is used to determine its type. The type of the variable is the type of the result of the expression that provides its initial value.

It is mandatory, to supply an initial value to a variable when declaring it. Initial values are supplied using a suitable expression in the value attribute. If the initial value is omitted from a declaration, an invalid declaration exception is raised (see 3.2.3 The diselect-declaration-exception Event). The DISelect processor halts.

6.1.3 Referencing an Existing Variable Using the variable Element

References to existing variables from markup use the variable element and specify the name of the variable through the ref attribute. The value of a variable can be altered using this form of reference.

When a variable is updated, the supplied value is converted to the type associated with the variable when it was originally declared. If conversion fails, an invalid type event is raised (see 3.2.1 The diselect-invalid-type-error Event). The DISelect processor continues processing, but the value of the variable remains unchanged.

6.1.4 References to Variables in XPath Expressions

References from XPath expressions use the normal notation. The name of the variable is prefixed with $. Consequently, a variable declared using a variable element with a name attribute of width is referenced from an XPath expression as $width.

6.1.5 Scope of Variables and Nesting

The declaration of a variable defines its scope. The scope of a variable is from the point within its parent element at which it is declared, to the end of the parent element. Repeated declaration of a variable within the same scope causes a redeclaration event to be raised (see 3.2.2 The diselect-redeclaration-error Event). This is an error. The DISelect processor continues processing, but ignores the redeclaration.

A variable can be referenced only from within its scope. An element can reference a variable if it is within the scope of the variable. An expression can reference a variable if it is associated with an element that is within the scope of the variable.

If variables with the same name are declared in nested scopes, the inner declaration hides the outer declaration for the scope of the inner declaration. References to the variable from within the inner scope apply to the inner declaration.

6.1.6 Types

Variables in DISelect are typed. The following datatypes are recognized by DISelect processors:

string

This is the string data type as defined in [XPath 1.0]

number

This is the number data type as defined in [XPath 1.0]

boolean

This is the boolean data type as defined in [XPath 1.0]

6.1.6.1 Type Conversion

When the value being assigned to a variable differs in type from the type associated with the variable itself, conversion is required. The rules that apply to conversion in DISelect are the same as those described in XPath [XPath 1.0].

If conversion fails, a diselect-invalid-type-error event is raised. This is an error. The DISelect processor continues processing, but ignores the assignment.

6.2 The value Element

The value element is used to include the value of an expression in the content. The DISelect processor evaluates the expression specified in the element. It places the value of that expression in the result infoset in place of the value element.

6.2.1 Attributes

expr

This mandatory attribute defines the expression that is evaluated to compute the value to be inserted into the result infoset in place of the element.

6.3 Using Variables

The examples in this section are informative. They have been chosen for clarity and simplicity. They are not intended to represent best practice. The companion primer [DI Primer] discusses a variety of ways to use DISelect under different circumstances.

<sel:variable name="nColors" value="dcn:cssmq-color(0)"/>
<sel:if expr="$nColors &gt; 0">
        <p>Your device can display <sel:value expr="$nColors"/> different colors.</p>
</sel:if>

In this example, variable nColors is set by a call to the function dcn:cssmq-color . This function returns the number of colors supported by the device. The variable is referenced within the expression in the exprattribute of the ifelement. If the value of the variable is greater than zero, indicating that the device supports color, the paragraph is included in the result infoset. The value of the nColors variable appears in place of the sel:value element within the paragraph.

7 Attribute Value Templates

This section is normative. It applies only to the full profile of DISelect.

The concept of Attribute Value Templates (AVTs) is taken from XSLT [XSLT]. Support for AVTs is provided by the Full profile of DISelect. It is not available in the Basic profile. A DISelect Basic processor encountering an AVT must raise a tsselect-compute-exception exception.

AVTs provide additional flexibility in the specification of the values of attributes in the host language. An AVT is an XPath expression that is evaluated to yield the value for a host language attribute. AVTs are enclosed in curly braces {} (Unicode code points U+007B and U+007D, respectively) to distinguish them from literal values for attributes. The expressions used within an AVT can include any XPath expression supported by the DISelect Full processor. During processing, the value is computed and is used as the value of the attribute.

7.1 Using Attribute Value Templates

The examples in this section are informative. They have been chosen for clarity and simplicity. They are not intended to represent best practice. The companion primer [DI Primer] discusses a variety of ways to use DISelect under different circumstances.

This example illustrates the use of a variable within an attribute of the host language. Two variables are defined in the example. Variable isColor is set by a call to the function dcn:cssmq-color. This function returns a value of zero if the device does not support color. The value of isColor is used to control the value of variable presClass. This variable holds the name of the CSS style class used to provide styling definitions for the user experience. The different values of this class provide different styles appropriate for monochrome and color devices. The value of variable presClass is used in an AVT to specify the value of the class attributes on various elements in the host markup. The DISelect processor replaces the expressions in each AVT with the appropriate value, and this is subsequently used by the host language element.

<sel:variable name="isColor" value="dcn:cssmq-color(0)"/>
<sel:variable name="presClass" value="'colorDisplay'"/>
<sel:if expr="$isColor = 0">
    <sel:variable ref="presClass" value="'monochromeDisplay'"/>
</sel:if>
...
<h3 class="{$presClass}">Latest Cricket News</h3>
<dl class="{$presClass}">
    <dt>South Africa win latest one day international</dt>
    <dd>In a thrilling run chase, England yesterday just failed to overtake
    South Africa's mammoth score of 311.....</dd>
    <dt>Flintoff layoff will last four months</dt>
    <dd>Following recent surgery to correct a recurring injury problem, .......</dd>
</dl>

In this example, the two referenced classes define CSS style properties appropriate for use on devices with color and monochrome displays respectively. The example is intended primarily to illustrate the syntax of the use of AVTs and is not necessarily realistic. Note the quoting required around the string literal values colorDisplay and monochromeDisplay.

8 XPath Expressions

This section is normative.

DISelect uses XPath 1.0 [XPath 1.0] to express the calculations and conditions involved when determining whether or not a particular piece of content is to be included for processing. This specification defines two levels of support for XPath 1.0. One applies to the Basic Profile of DISelect and the other to the Full Profile.

Both DISelect Basic and DISelect Full processors must provide the XPath 1.0 subset defined in section 8.2 DISelect Basic XPath Support. In addition, DISelect Full processors must provide the XPath 1.0 support defined in section 8.3 DISelect Full XPath Support.

A DISelect Basic processor encountering features belonging solely in the DISelect Full profile must raise an diselect-compute-exception exception.

8.1 Identifying Profiles and Versions

The two functions described in this section are useful for a content author to determine which profile and which version of DISelect are supported. Both functions must be supported by DISelect processors. Both are defined in the DISelect namespace, bound to the prefix "sel" in the prototypes below.

8.1.1 The getProfileName function

8.1.1.1 Prototype

string sel:getProfileName()

8.1.1.2 Function

This function returns a string which contains the name of the DISelect profile that the processor supports. Upon evaluating this function, a DISelect Basic processor must return the string "Basic", while a DISelect Full processor must return the string "Full".

8.1.2 The sel:getVersion function

8.1.2.1 Prototype

string sel:getVersion()

8.1.2.2 Function

This function returns a string which contains the name of the DISelect profile that the processor supports. Upon evaluating this function, a DISelect 1.0 processor must return the string "1.0". Future versions of this specifications may define other possible values.

8.2 DISelect Basic XPath Support

The subset of XPath 1.0 defined in this section must be supported by all DISelect processors. The subset is sufficient to construct conditional expressions and expressions that return values. It also includes the ability to invoke XPath functions. It specifically omits the ability to construct expressions that contain paths.

8.2.1 Accessing the Delivery Context using the XPath Subset

DISelect makes use of XPath functions for access to the delivery context. These functions provide a means of abstraction that hides the specific details of the representations used in the delivery context from the markup that references it.

There is a specific set of XPath functions, which must be supported by DISelect processors. This set of functions is described in the companion specification Delivery Context: XPath Access Functions 1.0 [DCN XAF], in the section describing the convenience functions. In addition to this set, DISelect processors mayoptionally support otherextension functions. Such extension functions are described in 8.4 Extension Functions.

Note:

It is anticipated that, in future, additional sets of XPath functions will be defined that will allow alternative ways of accessing the delivery context.It is anticipated that, in future, additional sets of functions will be defined for more comprehensive access to the delivery context. The delivery context is essentially a set of metadata, and some representations of it, such as CC/PP [CC/PP], use technologies such as RDF [RDF Primer] to provide semantically rich definitions. It is expected that additional sets of functions will be developed in future specifications to provide access to the delivery context in ways that reflect its role as metadata.

8.2.2 Formal Grammar for the DISelect Basic Subset

The formal grammar for the XPath subset used in DISelect Basic expressions is defined using the same, simple Extended Backus-Naur Form (EBNF) notation, as is used in [XPath 1.0].

[1]    DISelectExpr    ::=    OrExpr
[2]    OrExpr    ::=    AndExpr
| OrExpr 'or' AndExpr
[3]    AndExpr    ::=    EqualityExpr
| AndExpr 'and' EqualityExpr
[4]    EqualityExpr    ::=    RelationalExpr
| EqualityExpr '=' RelationalExpr
| EqualityExpr '!=' RelationalExpr
[5]    RelationalExpr    ::=    AdditiveExpr
| RelationalExpr '<' AdditiveExpr
| RelationalExpr '>' AdditiveExpr
| RelationalExpr '<=' AdditiveExpr
| RelationalExpr '>=' AdditiveExpr
[6]    AdditiveExpr    ::=    MultiplicativeExpr
| AdditiveExpr '+' MultiplicativeExpr
| AdditiveExpr '-' MultiplicativeExpr
[7]    MultiplicativeExpr    ::=    UnaryExpr
| MultiplicativeExpr MultiplyOperator UnaryExpr
| MultiplicativeExpr 'div' UnaryExpr
| MultiplicativeExpr 'mod' UnaryExpr
[8]    MultiplyOperator    ::=    '*'
[9]    UnaryExpr    ::=    UnionExpr
| '-' UnaryExpr
[10]    UnionExpr    ::=    DISelectBasicPathExpr
| UnionExpr '|' DISelectBasicPathExpr
[11]    DISelectBasicPathExpr    ::=    FilterExpr
[12]    FilterExpr    ::=    PrimaryExpr
| FilterExpr Predicate
[13]    PrimaryExpr    ::=    VariableReference
| '(' DISelectBasicExpr ')'
| Literal
| Number
| FunctionCall
[14]    VariableReference    ::=    '$' QName
[15]    Literal    ::=    '"' [^"]* '"'
| "'" [^']* "'"
[16]    Number    ::=    Digits ('.' Digits ?)?
| '.' Digits
[17]    Digits    ::=    [0-9]+
[18]    FunctionCall    ::=    FunctionName '(' ( Argument ( ',' Argument )* )? ')'
[19]    FunctionName    ::=    BaseFunctionName
| ExtensionFunctionName
[20]    BaseFunctionName    ::=    ConvenienceFunctionName
[21]    Argument    ::=    DISelectBasicExpr
[22]    NodeType    ::=    'comment'
| 'text'
| 'processing-instruction'
| 'node'
[23]    Predicate    ::=    '[' PredicateExpr ']'
[24]    PredicateExpr    ::=    DISelectBasicExpr
ConvenienceFunctionName

These are the convenience functions that every DISelect processor must support. They are documented in the companion specification Delivery Context: XPath Access Functions 1.0 [DCN XAF], in the section describing the convenience functions.

ExtensionFunctionName

Additional functions that are available to the DISelect processor can be used within selection expressions. Such functions can be defined to the processor using the functions attribute (see 4.4 The functions Attribute). Such definitions allow the processor to verify the availability of the functions.

8.3 DISelect Full XPath Support

DISelect Full processors must provide support for full XPath 1.0 expressions. This support includes a complete implementation of XPath 1.0 [XPath 1.0] in addition to providing implementations of all of the XPath functions described the companion specification Delivery Context: XPath Access Functions 1.0 [DCN XAF]. In addition to the convenience functions, that specification defines additional functions that provide path-based access. These can be used with the delivery context and the host document.

8.3.1 Path-Based Access to the Delivery Context

In addition to access via the convenience functions, the Full Profile of DISelect provides direct access to the delivery context via path expressions. The dcn:delivery-context() function, defined in [DCN XAF], provides the means by which the root of the delivery context can be accessed. Paths within the delivery context are relative to this point. For example, the expression

dcn:delivery-context()/beverage/coffee[3]

returns the third coffee node below the beverage node which is itself below the root of the delivery context. Normal XPath 1.0 [XPath 1.0] rules apply to the way that the resulting node is used. Naturally, to use the path-based access to delivery context information, the author needs to be aware of the contents of the delivery context, and the way in which it is structured. Suppose, for example, that a particular implementation of delivery context includes an element from a particular namespace that indicates location, and that one of its child elements indicates the name of the city in which the device is currently located.

<variable name="city" value="dcn:delivery-context()/geo:location/geo:city-name"/>

In this example, the markup sets the value of variable city to the value of the geo:city-name node beneath the geo:location node in the delivery context.

Note that to use path-based access to the delivery context, an author must be aware of the representation used by the particular DISelect processor.

8.3.2 Path-Based Access to the Host Document

In addition to providing access to the delivery context, the Full Profile of DISelect also provides access to the host document from within XPath expressions. Consequently, decisions about the inclusion of material can be based on the contents of the host document, the contents of the delivery context or a combination of the two.

Access to the host document is achieved by means of normal XPath 1.0 [XPath 1.0] facilities. If a DISelect processor provides this support, it must treat path expressions as applying to the source infoset by default. Path expressions that access the delivery context make use of XPath functions. This kind of access is described in section 8.3.1 Path-Based Access to the Delivery Context. Use of specific functions allows host document access to be distinguished from delivery context access.

  <body>
    <p>Here is a paragraph.</p>
    <p id="important">Here is a paragraph which carries an id.</p>
    <p expr="//body/p[@id='important']">Here is a paragraph which is 
    included if there is also a paragraph carrying an id value of important
    present within the body.</p>
  </body>

In this example, a host document contains three paragraphs. The third paragraph contains an expr attribute. The expression within this attribute ensures that the third paragraph is only included in the result infoset if there is also a paragraph which carries an id attribute with the value important.

In this example, an absolute path has been used. Relative paths may also be used to access the host document. In this case, the path is relative to the element that contains the expression making the reference.

8.4 Extension Functions

Both DISelect Basic and DISelect Full processors may optionallysupport additional, implementation-specific, XPath functions. These functions might, for example, provide additional information from the delivery context. Such functions are known as extension functions.

Extension functions must not be placed in the DISelect namespace nor in the Delivery Context namespace. These namespaces are described in 2.1 The Namespaces. This is important because it is anticipated that additional sets of XPath functions will be defined in future versions of specifications related to DISelect. The DISelect and Delivery Context namespaces are reserved for such use.

The provision of the ability to provide extension functions recognizes that there is a need for capabilities beyond those described within this specification. The current diversity in representations of delivery context makes it difficult to define a standard yet comprehensive set of access functions. Instead, this specification defines a core set of such functions but allows for implementation-specific extensions. In future, it is anticipated that a wider range of types of access to the delivery context will become standardized.

Both DISelect Basic and DISelect Full processors may support additional functions over and above those defined in section 8.2 DISelect Basic XPath Support. These functions are known as extension functions.

Extension functions must notbe placed in the DISelect namespace nor in the Delivery Context namespace. These namespaces are described in section 2.1 The Namespaces. This is important because it is anticipated that, in future, additional sets of functions will be defined, in future versions of specifications related to DISelect, to provide more comprehensive access to the delivery context. These functions will be defined within the Delivery Context namespace

The delivery context is essentially a set of metadata. Some representations of delivery context, such as [CC/PP], use technologies such as RDF [RDF Primer] to provide semantically rich definitions. It is expected that additional sets of functions will be developed in future specifications to provide access to the delivery context in ways that reflect its role as metadata.

A Schema

The schema for DISelect is available as a W3C XML Schema.

B References

B.1 Normative References

IETF RFC 2119
RFC 2119: Key words for use in RFCs to Indicate Requirement Levels. Internet Engineering Task Force, 1997. (See http://www.ietf.org/rfc/rfc2119.txt.)
DCN XAF
Delivery Context: XPath Access Functions 1.0 R.Lewis and R.Merrick, 2006. W3C Working Draft (See http://www.w3.org/TR/cselection-xaf/ )
XHTML Modularization
Modularization of XHTML M. Altheim, et al., 2001. W3C Recommendation (See http://www.w3.org/TR/xhtml-modularization/.)
XML Names
Namespaces in XML (See http://www.w3.org/TR/REC-xml-names/.)
XPath 1.0
XML Path Language (XPath) Version 1.0 J. Clark et al., 1999. W3C Recommendation (See http://www.w3.org/TR/xpath.)
XML Infoset
XML Information Set (Second Edition) J. Cowan et al., 2004. W3C Recommendation (See http://www.w3.org/TR/2004/REC-xml-infoset-20040204/.)
DOM2 Events
Document Object Model (DOM) Level 2 Events Specification Tom Pixley, 2000. W3C Recommendation (See http://www.w3.org/TR/DOM-Level-2-Events/.)
XML Events
XML Events - An events syntax for XML Steven Pemberton et. al. W3C Proposed Recommendation (See http://www.w3.org/TR/xml-events/.)

B.2 Informative References

DI Primer
Content Selection Primer 1.0 R.Lewis and R.Merrick, 2006. W3C Working Draft (See http://www.w3.org/TR/cselection-primer/ )
DIAL
Device Independent Authoring Language Profile (DIAL) 1.0 K.Smith and R.Lewis, 2006. W3C Working Draft (See http://www.w3.org/TR/dial/.)
XHTML 2
XHTML TM 2 J. Axelsson et al., 2003. W3C Working Draft (See http://www.w3.org/TR/xhtml2/.)
Least Power
The Rule of Least Power T. Berners-Lee and N. Mendelsohn, 2006. W3C Tag Finding (See http://www.w3.org/2001/tag/doc/leastPower.html.)
Glossary
Glossary of Terms for Device Independence R.Lewis, 2005. W3C Working Draft (See http://www.w3.org/TR/di-gloss/.)
Authoring Challenges
Authoring Challenges for Device Independence R. Lewis, 2003. W3C Note (See http://www.w3.org/TR/acdi/.)
DI Principles
Device Independence Principles R. Gimson, 2003. W3C Note (See http://www.w3.org/TR/di-princ/.)
CC/PP
Composite Capability/Preference Profiles (CC/PP): Structure and Vocabularies 1.0 G.Klyne, et al., 2004. W3C Recommendation (See http://www.w3.org/TR/CCPP-struct-vocab/.)
XForms
XForms 1.0 M. Dubinko et al., 2003 W3C Recommendation (See http://www.w3.org/TR/xforms/.)
CSS
Cascading Style Sheets, level 2 B. Boss et al., 1998 W3C Recommendation (See http://www.w3.org/TR/CSS2/.)
RDF Primer
RDF Primer F. Manola et al., 2004 W3C Recommendation (See http://www.w3.org/TR/rdf-primer/.)
ECMAScript
ECMAScript Language Specification ECMA (European Computer Manufacturers Association) (See http://www.ecma-international.org/publications/standards/Ecma-262.htm.)
XSLT
XSL Transformations (XSLT) Version 1.0 J. Clark, 1999 W3C Recommendation (See http://www.w3.org/TR/xslt.)

C Changelog (Non-Normative)

C.1 Changes in this Version

  • Suggested rewordings from Rhys. See WG email

  • Various typos corrected.

  • Removed the profile exception, instead, a compute exception is raised in case of profile mismatch.

  • Rewrote XPath grammar for Basic profile

  • Minor typos

  • Clarified what the target element is for diselect-redeclaration-error

  • Removed unused Media Queries bibliography entry

  • Defined DISelect Basic and Full profiles

  • Fix the typo of a missing blank after DISelect in section 4.3.

  • Use a more realistic example for path-based access to delivery context.

  • Provide a reference to the document where dcn:delivery-context() is defined as well as a direct link to the function itself.

  • Typos - remove duplicate 'the's in the document.

  • Improve the description of the selid and selidname attributes and the way they are used to control host language id attributes in the section "The selid and selidname Attributes".

  • Improve the description of the expr attribute and the fact that its use is optional in the section on "The expr Attribute".

  • Fix typo "selidName" has incorrect capitalization in the Overview section of "Attributes for Conditional Processing".

  • Fix typo in discussion of bubbling phase - "event handlers are notified o the event"

  • Define the meaning of relative paths when the host document is being accessed. This applies to the section "Path-based Access to the Host Document" (ACTION-167).

    Provide an example in the section on "Path-based Access to the Host Document" illustrating the use of XPath (ACTION 169).

  • Improve the description of the scope of a variable in the section "Scope of Variables and Nesting " (ACTION-168).

  • Add a mandatory requirement that extension functions not be placed in the delivery context of diselect namespaces

  • Reorganise the material in the section on XPath expressions and functions. Add a section on optional additional xpath support (ACTION-158)

  • Change the wording of the description of the functions attribute to reference the section on XPath subset rather than the XPath functions document itself (ACTION-158).

  • Describe the use of paths for accessing the host document and the use of dcn:delivery-context() for direct access to the delivery context (ACTION-157)

  • Correct the formal grammar in the light of the extensions implied by the delivery context functions that provide direct access (ACTION-155)

  • Correct the missing quotes from the string literals in the example on AVTs. (ACTION-151)

  • Clarify that DISelect processors must support the XPath subset defined in this document and may support additional capabilities. In particular, remove all statements that "the value of the expr attribute must match the production DISelectExpr" as these imply that extensions are not allowed.(ACTION 152)

  • Correct broken links to functions defined in the XPath functions companion specification.

  • Add notes to the examples pointing out that they are not necessarily best practice and pointing to the primer as a source of additional information.

  • Add references to the term QName wherever used

  • Improve the wording of the description of selidname.

  • Simplify the use of english in the description of the expr attribute.

  • Update the information in the introduction to reference the new DIAL specification.

  • Make the reference to XHTML 2 to informative rather than normative.

  • Add a reference to the new TAG finding on Least Power to the introduction

  • Correct the formatting problem in the attributes section of the select element. This appears to be caused by nesting xmlspec glist elements. It is not apparent on all browsers. Rewrote the section to avoid the need for such nesting.

  • Add the selidname and functions attributes to if, select, when and otherwise elements.

  • Rename selidName to selidname.

  • Remove the now unnecessary idreplace attribute. The selidname attribute performs the function that previously needed the idreplace attribute.

  • Change precept attribute from mandatory to optional on select. This was a typo.

  • Correct typo in that #other should be ##other in the syntax table for DISelect.

  • Change the name of the 'required' attribute to 'functions' to match with the name of the equivalent attribute in XForms.

  • Remove the options element and convert the idreplace and required elements to attributes. This change resolves an issue about the scope of such definitions.

  • Add an example to show the use of the idreplace attribute on a host language element

  • Use the term production, rather than XPath production when referencing the grammar. The DISelect grammar is an XPath subset, not a full XPath implementation.

  • Remove process element and diselect-reprocess event.

  • Changes for satish-1 Last Call comment.

  • Change "output infoset" to "result infoset". Implements action08 from 2005-06-09 f2f. (Member-only link)

  • Clarification of processing when required @functions are not found.

  • Add a reference to XSLT in our description of AVTs. AVTs are defined by XSLT not XPath.

  • Updated the definitions of the expr attribute on the value element and the value attribute on the variable element to make them consistent.

  • Updated the descriptions of events to include DOM2/XML Event information. This includes definition of the element that is the target of the event, whether or not the event can be cancelled, and whether or not it bubbles. Guidance on the particular values used was taken from the XForms specification. The default action taken by the DISelect processor was also rationalized into the tables used for this additional event information.

  • The sel:selidName attribute was introduced to overcome a possible ambiguity in the mechanism that specified both the value and the name of the unique identifier generated from the sel:selid attribute.

  • Clarify the use of data types for variables and make the use of XPath 1 normative in response to discussion at the 9th F2F meeting in Boston in March 2005.

  • Added the section describing Attribute Value Templates, as the mechanism for computing the values of host language attributes using expressions

  • Added the section describing the value element as the mechanism for including the values of expressions in the body content of host language elements.

  • Added the variable and value elements to the list of elements in the description of the selection module.

  • Added the mechanism for reprocessing the document in response to an event. This is based on the diselect-reprocess event.

  • Updated the conformance information to be closer to that in the latest QA specification guidelines

  • Added the mechanism for specifying the name of the attribute to be generated by the sel:selid attribute.

  • Added the mechanism for allowing a processor to check that extension functions are available. This is based on the new sel:required element.

  • Updated examples in the section on starter set XPath functions to use the same format as examples from earlier in the document.

  • Added the diselect-invalid-declaration exception. Updated the section on declaration of variables to describe the conditions under which it is raised.

  • Renamed the Examples sections

  • Corrected the reference to examples that illustrate sel:selid to point to the examples associated with content selection elements.

  • Reworded the description in the Overview.

  • Added an editorial note about whether the processing model as described is sufficient. It may not be able to handle dynamic situations in which the source infoset is repeatedly reprocessed.

  • Completed the processing model. Added the appropriate error events and described the conditions under which they are raised. Clarified the rules on types and variable declarations.

  • Added a formal syntax for the expressions used within DISelect.

  • Resolved comments that use of XPath 2 requires a host language to specify the types that are valid and that DISelect itself was not necessarily playing the role of the host language for XPath 2.

    The changes made make XPath 1 the expression language for this version of DISelect. The changes made were:

    Remove references to the use of XML schema types
    Update the function prototypes to use XPath 1 types rather than XPath 2 types
    Remove the definition of the use of the xs: prefix
    Remove the normative reference to XPath 2
    Remove the normative reference to XML Schema Part 1

  • Changed the prefix in the document associated with XML Schema from xsd: to xs: to reflect more common usage in W3C documents.

  • Changed the prefix in the document associated with delivery context from dc: to dcn: to avoid a clash with the prefix used by convention for Dublin Core.

  • Paul Duffin commented that the specification as written implied that a number of attributes were global. This was not the intent. The specification has been updated to reflect the author's true intent. Attributes need to be qualified only when used within elements that are not within the DISelect namespace.

    All unnecessary use of explicit prefixes has been removed. A comment has been added concerning the examples and indicating that they assume that XHTML Version 2 is the host language.

    The description of the use of the default namespace in this document has been updated to reflect the use of XHTML Version 2 as the host language in the examples.

D Acknowledgements (Non-Normative)

At the time of publication, the participants of the Device Independence Working Group are:

The Device Independence Working Group has benefited in its work from the participation and contributions of a number of people not currently members of the Working Group, including in particular those named below. Affiliations given are those current at the time of their work with the WG.