DISelect and Delivery Context Access Functions 1.0: Test Suite

W3C Editors Draft 31 October 2007

This version:
http://www.w3.org/2007/uwa/editors-drafts/DISelect/TestSuite-2007-10-31/TestSuiteCselection.html
Latest version:
http://www.w3.org/2007/uwa/editors-drafts/DISelect/TestSuite-2007-10-31/TestSuiteCselection.html
Previous version:
None
Editor:
Rhys Lewis, Volantis Systems Ltd. <rhys@volantis.com>

Abstract

This document defines the test suite for Content Selction for Device Independence 1.0 [DISelect] and for the associated Delivery Context: XPath Access Functions 1.0 [DCN XAF].

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

Status of this Document

This document is an editors' copy that has no official standing.

This section describes the status of this document at the time of its publication....

This document was produced under the 5 February 2004 W3C Patent Policy. The Working Group maintains a public list of patent disclosures relevant to this document; that page also includes instructions for disclosing [and excluding] a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1 Introduction
2 Test Assertions
    2.1 The expr Attribute
    2.2 The sel:selid and sel:selidname Attributes
    2.3 The sel:functions Attribute
    2.4 The if Element
    2.5 The select Element
    2.6 The when Element
    2.7 The otherwise Element
    2.8 Variable Declaration
    2.9 Variable Update
    2.10 References to Variables in XPath Expressions
    2.11 Scope of Variables and Nesting
    2.12 Variable Types
    2.13 The value Element
    2.14 Attribute Value Templates
    2.15 Identifying the Supported Profile
    2.16 Identifying the Supported Version
    2.17 The Blah
3 Test Cases
    3.1 Structure of Tests
    3.2 The Delivery Context
    3.3 Test 4-2
    3.4 Test 4-3
        3.4.1 Test Case 4-3a
        3.4.2 Test Case 4-3b
    3.5 Test 4-4
    3.6 Test 5-2-1
        3.6.1 Test Case 5-2-1a
        3.6.2 Test Case 5-2-1b
        3.6.3 Test Case 5-2-1c
    3.7 Test 5-2-2
        3.7.1 Test Case 5-2-2a
        3.7.2 Test Case 5-2-2b
    3.8 Test 6-1
        3.8.1 Test Case 6-1a
        3.8.2 Test Case 6-1b
        3.8.3 Test Case 6-1c
    3.9 Test 6-1-5
        3.9.1 Test Case 6-1-5a
        3.9.2 Test Case 6-1-5b
        3.9.3 Test Case 6-1-5c
    3.10 Test 6-1-5 Part 2
        3.10.1 Test Case 6-1-5 Part 2a
    3.11 Test 7
        3.11.1 Test Case 7a
            3.11.1.1 Processor that Implements the Full DISelect Profile
            3.11.1.2 Processor that Implements the Basic DISelect Profile
    3.12 Test 8-1
        3.12.1 Test Case 8-1a
        3.12.2 Test Case 8-1b

Appendices

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


1 Introduction

The ...

2 Test Assertions

2.1 The expr Attribute

Location of the Assertion

The expr Attribute in Host Language Elements

Text from the Specification

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

Applicable Test Cases

3.3 Test 4-2

2.2 The sel:selid and sel:selidname Attributes

Location of the Assertion

The selid and selidname Attributes

Text from the Specification

"By default, a DISelect processor uses the value of the selid attribute 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 selidname attribute 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."

Applicable Test Cases

3.4 Test 4-3

2.3 The sel:functions Attribute

Location of the Assertion

The functions Attribute

Text from the Specification

"The value of the functions attribute 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.

A DISelect processor must verify the availability of the resources defined by this attribute no later than the point during processing at which it encounters the functions attribute in the source infoset. A DISelect processor may verify 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."

Applicable Test Cases

3.5 Test 4-4

2.4 The if Element

Location of the Assertion

The if Element

Text from the Specification

"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.

As described in 3 Processing Model, neither the element itself nor any of its attributes appears in the result infoset."

Applicable Test Cases

3.6 Test 5-2-1, 3.4 Test 4-3

2.5 The select Element

Location of the Assertion

The select Element

Text from the Specification

"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.

As described in 3 Processing Model, neither the element itself nor any of its attributes appears in the result infoset.

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 are 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."

Applicable Test Cases

3.7 Test 5-2-2

2.6 The when Element

Location of the Assertion

The when Element

Text from the Specification

"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.

As described in 3 Processing Model, neither the element itself nor any of its attributes appears in the result infoset."

Applicable Test Cases

3.7 Test 5-2-2

2.7 The otherwise Element

Location of the Assertion

The otherwise Element

Text from the Specification

"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.

As described in 3 Processing Model, neither the element itself nor any of its attributes appears in the result infoset."

Applicable Test Cases

3.7 Test 5-2-2

2.8 Variable Declaration

Location of the Assertion

Declaring a Variable

Text from the Specification

"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."

Applicable Test Cases

3.8 Test 6-1

2.9 Variable Update

Location of the Assertion

Referencing an Existing Variable Using the variable Element

Text from the Specification

"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."

Applicable Test Cases

3.8.2 Test Case 6-1b

2.10 References to Variables in XPath Expressions

Location of the Assertion

References to Variables in XPath Expressions

Text from the Specification

"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."

Applicable Test Cases

3.8.1 Test Case 6-1a

2.11 Scope of Variables and Nesting

Location of the Assertion

Scope of Variables and Nesting

Text from the Specification

"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. 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."

Applicable Test Cases

3.9 Test 6-1-5 and 3.10 Test 6-1-5 Part 2

2.12 Variable Types

Location of the Assertion

Types

Text from the Specification

"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]"

Applicable Test Cases

3.8 Test 6-1 includes examples of variables of all three types. Variable scanType is a string. Variable gridBased is a boolean. The other variables are numbers.

2.13 The value Element

Location of the Assertion

The value Element

Text from the Specification

"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.

As described in 3 Processing Model, neither the element itself nor any of its attributes appears in the result infoset."

Applicable Test Cases

3.8 Test 6-1, 3.9 Test 6-1-5 and 3.10 Test 6-1-5 Part 2 all illustrate use of the value element.

2.14 Attribute Value Templates

Location of the Assertion

Attribute Value Templates

Text from the Specification

"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 deselect-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."

Applicable Test Cases

3.11 Test 7

2.15 Identifying the Supported Profile

Location of the Assertion

The sel:getProfileName Function

Text from the Specification

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".

Applicable Test Cases

3.12 Test 8-1

2.16 Identifying the Supported Version

Location of the Assertion

The sel:getVersion Function

Text from the Specification

This function returns a string which contains the version of DISelect 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.

Applicable Test Cases

3.12 Test 8-1

2.17 The Blah

Location of the Assertion

Blah

Text from the Specification

Applicable Test Cases

3.7 Test 5-2-2

3 Test Cases

3.1 Structure of Tests

Tests in this document are written as pages of XHTML 1 markup which contains embedded DISelect markup. XPath expressions used in the tests include functions from the Delivery Context XPath Access Functions specification [DCN XAF]. Each test includes commentary information which indicate what should happen when the test is executed correctly.

Each test is described in the sections that follow.

3.2 The Delivery Context

The tests assume the following values for properties in the delivery context:

Total screen width in pixels208
Usable screen width in pixels200
Total screen height in pixels320
Usable screen height in pixels310
Total display width35 mm
Usable display width33 mm
Total display height45 mm
Usable display height42 mm
Bits per pixel for color16
Bits per pixel for monochrome12
Supports colortrue
Display aspect ratio width component3
Display aspect ratio height component4
Display scan'interlaced'
Display gridtrue

3.3 Test 4-2

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel"
  xmlns:dcn="http://www.w3.org/2005/dcn">
  <head>
    <title>DISelect and Delivery Context Access Functions 1.0: Test Case 4-2</title>
    <link rel="stylesheet" type="text/css" href="W3C-WD.css"/>
  </head>
  <body>
    <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 4-2</h2>
    <h3>The <code>expr</code> attrbute in host language statements</h3>
    <h4>Description</h4>
    <p>The content of the first paragraph should appear because the condition in the expression is
       true. The content of the second paragraph should not appear. The condition is false.</p>
    <h4>Test</h4>
    <p class="assertion" sel:expr="dcn:cssmq-device-width('px', 55)> 200">First host language
       statement: this content should appear.</p>
    <p class="assertion" sel:expr="dcn:cssmq-device-width('cm') > 20">Second host language
       statement: this content should not appear.</p>
  </body>
</html>

This test contains one test case.

In this test, two paragraphs each carry an expr attribute. In the first paragraph, the expression in the attribute evaluates to true. The paragraph appears in the page. In the second paragraph, the expression in the attribute evaluates to false. The paragraph does not appear.

3.4 Test 4-3

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel"
  xmlns:dcn="http://www.w3.org/2005/dcn">
  <head>
    <title>DISelect and Delivery Context Access Functions 1.0: Test Case 4-3</title>
    <link rel="stylesheet" type="text/css" href="W3C-WD.css"/>
  </head>
  <body>
    <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 4-3</h2>
    <h3>Test Case 4-3a: sel:selid within an IF element</h3>
    <h4>Description</h4>
    <p>The test section should contain a single paragraph. It should have an <code>xml:id</code>
      attribute of <code>testid1</code>.</p>
    <h4>Test</h4>
    <sel:if expr="dcn:cssmq-device-width('px', 55)> 200">
      <p class="assertion" sel:selid="testid1">This paragraph should appear. Its <code>xml:id</code>
        attribute should be <code>testid1</code>.</p>
    </sel:if>
    <h3>Test Case 4-3b: sel:selid and sel:selidname within an IF element</h3>
    <h4>Description</h4>
    <p>The test section should contain a single paragraph. It should have a <code>myID</code>
      attribute with a value of <code>testid2</code>.</p>
    <h4>Test</h4>
    <sel:if expr="dcn:cssmq-device-width('px')> 100">
      <p class="assertion" sel:selid="testid2" sel:selidname="myID">This paragraph should appear.
        Its <code>myID</code> attribute should be <code>testid2</code>.</p>
    </sel:if>
  </body>
</html>

This test includes two test cases.

3.4.1 Test Case 4-3a

In Test Case 4-3a, the expression in the if element evaluates to true. The paragraph appears. The attribute sel:selid="testid1" is replaced by xml:id="testid1".

3.4.2 Test Case 4-3b

In Test Case 4-3b, the expression in the if element evaluates to true. The paragraph appears. The attributes sel:selid="testid2" and sel:selidname="myID" are replaced by myID="testid2" .

3.5 Test 4-4

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel" 
    xmlns:dcn="http://www.w3.org/2005/dcn">
    <head>
        <title>DISelect and Delivery Context Access Functions 1.0: Test Case 4-2</title>
        <link rel="stylesheet" type="text/css" href="W3C-WD.css" />
        <script src="DISelect.js" type="text/javascript" />
    </head>
    <body>
        <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 4-4</h2>
        <h3>The <code>functions</code> attribute in host language statements</h3>
        <h4>Description</h4>
        <p>The test section should include the first paragraph. The expression is true and the 
           function <code>dcn:cssmq-device-width </code> does exist. However, the second
           paragraph should cause a <code>diselect-compute-exception</code>. There is no
           such function as <code>dcn:cssmq-device-depth</code>. This should
           halt the DISelect processor. On some systems the second
           paragraph may appear because it is not actively suppressed. The
           expression is false, but the DISelect processor cannot remove it
           since it has halted.</p>
        <h4>Test</h4>
        <p class="assertion" sel:functions="dcn:cssmq-device-width" 
             sel:expr="dcn:cssmq-device-width('px', 55)> 200">
           First host language statement: this content should appear.
       </p>
        <p class="assertion" sel:expr="dcn:cssmq-device-width('px', 55) > 500" 
             sel:functions="dcn:cssmq-device-height dcn:cssmq-device-depth">
           Second host language statement: this content should cause a
           compute exception.
        </p>
    </body>
</html>

In Test Case 4-4 the functions attribute in the second paragraph contains the name of a function that does not exist. This causes a diselect-compute-exception which halts the DISelect processor. On some systems, the halting of the DISelect processor prevents the second paragraph from being removed from the output. The expression it contains in its expr attribute is false. However, the processor has been halted and cannot remove it.

3.6 Test 5-2-1

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel"
  xmlns:dcn="http://www.w3.org/2005/dcn">
  <head>
    <title>DISelect and Delivery Context Access Functions 1.0: Test Case 5-2-1</title>
    <link rel="stylesheet" type="text/css" href="W3C-WD.css"/>
  </head>
  <body>
    <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 5-2-1</h2>
    <h3>Test Case 5-2-1a: IF element with an expression that is true</h3>
    <h4>Description</h4>
    <p>The test section should contain a single paragraph. The expression in the <code>if</code>
      element is true.</p>
    <h4>Test</h4>
    <sel:if expr="dcn:cssmq-device-width('px', 55)> 200">
      <p class="assertion">This content should appear.</p>
    </sel:if>
    <h3>Test Case 5-2-1b: IF element with an expression that is false</h3>
    <h4>Description</h4>
    <p>The test section should be empty. The expression in the <code>if</code> element is false.</p>
    <h4>Test</h4>
    <sel:if expr="dcn:cssmq-device-width('cm') > 20">
      <p class="assertion">IF statement: this content should not appear.</p>
    </sel:if>
    <h3>Test Case 5-2-1c: Nested IF statements with expressions that are true</h3>
    <h4>Description</h4>

    <p>The test section should contain two paragraphs. The expressions in both nested
      <code>if</code> elements are true.</p>
    <h4>Test</h4>
    <sel:if expr="dcn:cssmq-device-width('px', 55)> 200">
      <p class="assertion">Outer IF statement: this content should appear.</p>
      <sel:if expr="dcn:cssmq-device-width('px')> 100">
        <p class="assertion">Inner IF statement: this content should appear.</p>
      </sel:if>
    </sel:if>
  </body>
</html>

This test includes 3 test cases.

3.6.1 Test Case 5-2-1a

In Test Case 5-2-1a, the expression in the if element evaluates to true. The paragraph it contains appears.

3.6.2 Test Case 5-2-1b

In Test Case 5-2-1b, the expression in the if element evaluates to false. The paragraph it contains does not appear.

3.6.3 Test Case 5-2-1c

In Test Case 5-2-1c, the expressions in both of the nested if elements evaluate to true. Both paragraphs appear.

3.7 Test 5-2-2

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel"
  xmlns:dcn="http://www.w3.org/2005/dcn">
  <head>
    <title>DISelect and Delivery Context Access Functions 1.0: Test Case 5-2-2</title>
    <link rel="stylesheet" type="text/css" href="W3C-WD.css"/>
  </head>
  <body>
    <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 5-2-2</h2>
    <h3>Test Case 5-2-2a: Multiple WHEN clause expressions true and no PRECEPT</h3>
    <h4>Description</h4>
    <p>Content of the first WHEN clause should appear. The conditions of the first and third WHEN
      clauses are true but no precept has been specified, so only the first appears.</p>
    <h4>Test</h4>
    <sel:select>
      <sel:when expr="dcn:cssmq-device-width('px', 55)> 200">
        <p class="assertion">First WHEN clause: this content should appear.</p>
      </sel:when>
      <sel:when expr="dcn:cssmq-device-width('cm') > 20">
        <p class="assertion">Second WHEN clause: this content should not appear.</p>
      </sel:when>
      <sel:when expr="dcn:cssmq-device-width('cm') &lt; 20">
        <p class="assertion">Third WHEN clause: this content should not appear.</p>
      </sel:when>
      <sel:otherwise>
        <p class="assertion">This paragraph should not appear.</p>
      </sel:otherwise>
    </sel:select>
    <h3>Test Case 5-2-2b: Multiple WHEN clause expressions true and PRECEPT of MATCHEVERY</h3>
    <h4>Description</h4>
    <p>Content of the first and third WHEN clauses should appear. The conditions are true and a
      precept of matchevery has been specified.</p>
    <h4>Test</h4>
    <sel:select precept="matchevery">
      <sel:when expr="dcn:cssmq-device-width('px', 55)> 200">
        <p class="assertion">First WHEN clause: this content should appear.</p>
      </sel:when>
      <sel:when expr="dcn:cssmq-device-width('cm') > 20">
        <p class="assertion">Second WHEN clause: this content should not appear.</p>
      </sel:when>
      <sel:when expr="dcn:cssmq-device-width('cm') &lt; 20">
        <p class="assertion">Third WHEN clause: this content should appear.</p>
      </sel:when>
      <sel:otherwise>
        <p class="assertion">This paragraph should not appear.</p>
      </sel:otherwise>
    </sel:select>
  </body>
</html>

This test includes 2 test cases.

3.7.1 Test Case 5-2-2a

In Test Case 5-2-2a, the expressions in the first and third when elements evaluate to true. The paragraph within the first when element appears, but the third does not. This is because no precept is specified, and the default value is matchfirst.

3.7.2 Test Case 5-2-2b

In Test Case 5-2-2b, the expressions in the first and third when elements evaluate to true. The paragraphs within both when elements appear. This is because a precept is specified, and its value is matchevery.

3.8 Test 6-1

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel"
  xmlns:dcn="http://www.w3.org/2005/dcn">
  <head>
    <title>DISelect and Delivery Context Access Functions 1.0: Test Case 6-1</title>
    <link rel="stylesheet" type="text/css" href="W3C-WD.css"/>
    <script src="DISelect.js" type="text/javascript"/>
  </head>
  <body>
    <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 6-1</h2>
    <h3>Test Case 6-1a: Declaration of Variables</h3>
    <h4>Description</h4>
    <p>Declare a number of variables, and cause their values to be output. The expression involving
      that computes the total number of pixels on the display should execute correctly and should
      compute a value of 66560 pixels.</p>
    <h4>Test</h4>
    <p>The following declarations should process correctly.</p>
    <sel:variable name="nColors" value="dcn:cssmq-color(0)"/>
    <sel:variable name="nPixelsX" value="dcn:cssmq-device-width('px', 0)"/>
    <sel:variable name="nPixelsY" value="dcn:cssmq-device-height('px', 0)"/>
    <sel:variable name="height" value="dcn:cssmq-device-height('cm', 0)"/>
    <sel:variable name="scanType" value="dcn:cssmq-scan('progressive')"/>
    <sel:variable name="gridBased" value="dcn:cssmq-grid(false)"/>
    <p>The value for the number of colors should be 65536</p>
    <p class="assertion">Your device can display <sel:value expr="$nColors"/> different colors.</p>
    <p>The value for the number of pixels horizontally should be 208</p>
    <p class="assertion">Your device can display <sel:value expr="$nPixelsX"/> pixels horizontally.</p>
    <p>The value for the number of pixels vertically should be 320</p>
    <p class="assertion">Your device can display <sel:value expr="$nPixelsY"/> pixels vertically.</p>
    <p>The value for the height of the display in cm should be 4.5</p>
    <p class="assertion">Your device has a display that is <sel:value expr="$height"/> cm high.</p>
    <p>The value for the scan type of the display should be interlaced</p>
    <p class="assertion">The scan type of your display is  <sel:value expr="$scanType"/>.</p>
    <p>The value for whether or not the display is grid-based should be true</p>
    <p class="assertion">It is <sel:value expr="$gridBased"/> to say that your device is grid-based.</p>
    <p>The following value for the total number of pixels should be 66560</p>
    <p class="assertion">Your device can display <sel:value expr="$nPixelsX * $nPixelsY"/> pixels in
      total.</p>
    <h3>Test Case 6-1b: Change the Value of a Variable</h3>
    <h4>Description</h4>
    <p>Change the value of the number of colors that the device can display and output it to the
      page.</p>
    <h4>Test</h4>
    <p>The new value for the number of colors should be 256.</p>
    <sel:variable ref="nColors" value="256"/>
    <p class="assertion">Your device can display <sel:value expr="$nColors"/> different colors.</p>
    <h3>Test Case 6-1c: Invalid Declaration of a Variable</h3>
    <h4>Description</h4>
    <p>Declare a variable without supplying a value. This should cause a
      diselect-declaration-exception exception exception.</p>
    <h4>Test</h4>
    <p>The following declaration should fail with a diselect-declaration-exception exception,
      because no value is supplied.</p>
    <sel:variable name="invalidVariable"/>
  </body>
</html>

This test includes 3 test cases.

3.8.1 Test Case 6-1a

In Test Case 6-1a, a number of variables of different types are declared. The values of the variables are displayed in the page to demonstrate that they have been set. In addition, an expression is used that computes the value of the total number of pixels on the display from two of the variables.

3.8.2 Test Case 6-1b

In Test Case 6-1b, the value of an existing variable is updated and the new value is displayed.

3.8.3 Test Case 6-1c

In Test Case 6-1c, a variable is declared without a value. This is invalid. A diselect-declaration-exception exception is raised.

3.9 Test 6-1-5

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel" xmlns:dcn="http://www.w3.org/2005/dcn">
    <head>
        <title>DISelect and Delivery Context Access Functions 1.0: Test Case 6-1-5</title>
        <link rel="stylesheet" type="text/css" href="W3C-WD.css" />
        <script src="DISelect.js" type="text/javascript" />
    </head>
    <body>
        <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 6-1-5</h2>
        <h3>Test Case 6-1-5a: Variable in inner scope hides variable in outer scope</h3>
        <h4>Description</h4>
        <p>Declare a variable in a scope, and then declare the same variable in an inner scope. The
              declaration in the inner scope hides the declaration from the outer scope. The variable in the
              outer scope is unaffected by the variable in the inner scope.</p>
        <h4>Test</h4>
        <sel:variable name="myVariable" value="dcn:cssmq-color(0)" />
        <p>The value of myVariable in this outer scope should be 65536</p>
        <p class="assertion">The value of myVariable is <sel:value expr="$myVariable" />.</p>
        <div>
            <p>The value of myVariable in this inner scope should be 42</p>
            <sel:variable name="myVariable" value="42" />
            <p class="assertion">The value of myVariable is <sel:value expr="$myVariable" />.</p>
        </div>
        <p>The value of myVariable in this outer scope should still be 65536</p>
        <p class="assertion">The value of myVariable is <sel:value expr="$myVariable" />.</p>
        <h3>Test Case 6-1-5b: Variable cannot be redeclared in the same scope</h3>
        <h4>Description</h4>
        <p>Declare a variable in a scope, and then declare the same variable again in the same scope.
             The second declaration causes a diselect-redeclaration-event to be raised. The second
             declaration is ignored but the DISelect processor continues.</p>
        <h4>Test</h4>
        <p>Declare a variable with a value of 42.</p>
        <sel:variable name="duplicateVariable" value="42" />
        <p class="assertion">The value of duplicateVariable is <sel:value expr="$duplicateVariable" />.</p>
        <p>Declare the variable again with a value of 1234. A diselect-redeclaration-error is raised,
      the declaration is ignored and the value remains 42.</p>
        <sel:variable name="duplicateVariable" value="1234" />
        <p class="assertion">The value of duplicateVariable is <sel:value expr="$duplicateVariable" />.</p>
        <h3>Test Case 6-1-5c: Variable declared in inner scope unavailable to an XPath expression in outer scope</h3>
        <h4>Description</h4>
        <p>Declare a variable in an inner scope, and then refer to it from an XPath expression in the outer scope. A
              diselect-compute-exception should be raised, the DISelect processor should 
              halt and the value of the variable should not be available.</p>
        <h4>Test</h4>
        <div>
            <p>The value of innerVariable in this inner scope should be 9876</p>
            <sel:variable name="innerVariable" value="9876" />
            <p class="assertion">The value of innerVariable is <sel:value expr="$innerVariable" />.</p>
        </div>
        <p>innerVariable in this outer scope should not be available. A diselect-compute-exception 
              should be raised.</p>
        <p class="assertion">The value of innerVariable is <sel:value expr="$innerVariable" />.</p>
    </body>
</html>

This test includes 3 test cases.Note that because the final test case causes the DISelect processor to halt, there is a second part to this test (See 3.10 Test 6-1-5 Part 2)

3.9.1 Test Case 6-1-5a

In Test Case 6-1-5a, a variable is declared in a particular scope. Its value is displayed. The same variable is declared in an inner scope, in this case as the content of a <div> element. The value assigned in this second declaration is different. When displayed from the inner scope, the value of the variable in the inner declaration is obtained. Even after the inner scope is closed, the value of the variable in the outer scope is unaffected.

3.9.2 Test Case 6-1-5b

In Test Case 6-1-5b, a variable is declared in a particular scope. Its value is displayed. The same variable is declared again, within the same scope, and with a different value. A diselect-redeclaration-error is raised and the second declaration is ignored. The variable retains its original value.

3.9.3 Test Case 6-1-5c

In Test Case 6-1-5c, a variable is declared in an inner scope, but then subsequently referenced from an XPath expression in the outer scope. Such a refrerence is invalid.A diselect-compute-exception is raised and the DISelect processor halts.

3.10 Test 6-1-5 Part 2

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel" xmlns:dcn="http://www.w3.org/2005/dcn">
    <head>
        <title>DISelect and Delivery Context Access Functions 1.0: Test Case 6-1-5 (part 2)</title>
        <link rel="stylesheet" type="text/css" href="W3C-WD.css" />
        <script src="DISelect.js" type="text/javascript" />
    </head>
    <body>
        <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 6-1-5(2)</h2>
        <h3>Test Case 6-1-5c: Variable declared in inner scope unavailable in outer scope (2)</h3>
        <h4>Description</h4>
        <p>Declare a variable in an inner scope, and then refer to it in another variable element from
        the outer scope.</p>
        <h4>Test</h4>
        <div>
            <p>The value of innerVariable in this inner scope should be 9876</p>
            <sel:variable name="innerVariable" value="9876" />
            <p class="assertion">The value of innerVariable is <sel:value expr="$innerVariable" />.</p>
        </div>
        <p>innerVariable in this outer scope should not be available for updating. The reference to it from the 
        variable element should cause a diselect-compute-exception. The variable's value should not be reported 
        as 1234.</p>
        <sel:variable ref="innerVariable" value="1234" />
        <p class="assertion">The value of innerVariable is now <sel:value expr="$innerVariable" />.</p>
    </body>
</html>

This test includes 1 test case.

3.10.1 Test Case 6-1-5 Part 2a

In Test Case 6-1-5 Part 2a, a variable is declared in an inner scope, but then subsequently referenced from a variable element in the outer scope. Such a refrerence is invalid. A diselect-compute-exception is raised and the DISelect processor halts.

3.11 Test 7

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel"
  xmlns:dcn="http://www.w3.org/2005/dcn">
  <head>
    <title>DISelect and Delivery Context Access Functions 1.0: Test Case 7</title>
    <link rel="stylesheet" type="text/css" href="W3C-WD.css"/>
    <script src="DISelect.js" type="text/javascript"/>
    <style>
    .style-important {color:red; font-weight:bold}  
    .style-ok {color:green; font-style:italic}  
    </style>
  </head>
  <body>
    <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 7</h2>
    <h3>Test Case 7a: Using an AVT to set the value for a class attribute</h3>
    <h4>Description</h4>
    <p>Declare two variables and use them in expressions that set the value of a class for styling.</p>
    <h4>Test</h4>
    <sel:variable name="importantClass" value="'important'"/>
    <sel:variable name="OKClass" value="'ok'"/>
    <p>The following paragraph should be colored red and be bold.</p>
    <p class="{concat('style-',$importantClass)}">This important text should be bold and red.</p>
    <p>The following paragraph should be colored green and be italic.</p>
    <p class="{concat('style-',$OKClass)}">This text should be italic and green.</p>
  </body>
</html>

This test includes 1 test case.

3.11.1 Test Case 7a

3.11.1.1 Processor that Implements the Full DISelect Profile

In Test Case 7a, two variables are declared and used to control the styling of two paragraphs, via CSS. The variables are used in XPath expressions within AVTs to construct CSS class names, that are used in two paragraphs. The styles associated with these classes are defined within the head of the page.

3.11.1.2 Processor that Implements the Basic DISelect Profile

In Test Case 7a, a processor that implements the Basic DISelect profile does not support AVTs. The processor raises a deselect-compute-exception exception and halts.

3.12 Test 8-1

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:sel="http://www.w3.org/2005/sel" xmlns:dcn="http://www.w3.org/2005/dcn">
    <head>
        <title>DISelect and Delivery Context Access Functions 1.0: Test Case 8-1</title>
        <link rel="stylesheet" type="text/css" href="W3C-WD.css" />
        <script src="DISelect.js" type="text/javascript" />
    </head>
    <body>
        <h2>DISelect and Delivery Context Access Functions 1.0: Test Case 8-1</h2>
        <h3>Test Case 8-1a: Retrieve and Display Profile Information</h3>
        <h4>Description</h4>
        <p>Retrieve the DISelect profile supported by the DISelect processor and display it.</p>
        <h4>Test</h4>
        <p>The value of profile, shown in the next paragraph, should be whatever is supported by the
    processor being tested.</p>
        <p class="assertion">The DISelect profile supported by this processor is 
    <sel:value expr="sel:getProfileName()" />.</p>
        <h3>Test Case 8-1b: Retrieve and Display Version Information</h3>
        <h4>Description</h4>
        <p>Retrieve the DISelect version supported by the DISelect processor and display it.</p>
        <h4>Test</h4>
        <p>The value of version, shown in the next paragraph, should be whatever is supported by the
    processor being tested.</p>
        <p class="assertion">The DISelect version supported by this processor is 
    <sel:value expr="sel:getVersion()" />.</p>
    </body>
</html>

This test includes 2 test case.

3.12.1 Test Case 8-1a

In Test Case 8-1a, the profile of DISelect supported by the processor is retrieved and displayed.

3.12.2 Test Case 8-1b

In Test Case 8-1b, the version of DISelect supported by the processor is retrieved and displayed.

A References

A.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.)
DISelect
Content Selection for Device Independence (DISelect) 1.0 R. Lewis and R. Merrick 2006 (See http://www.w3.org/TR/2007/CR-cselection-20070725/.)
DCN XAF
Delivery Context: XPath Access Functions 1.0 R.Lewis and R.Merrick, 2006. W3C Working Draft (See http://www.w3.org/TR/2007/CR-cselection-xaf-20070725/.)
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/.)

A.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/2007/WD-cselection-primer-20070109/.)
XHTML 2
XHTMLTM 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 revision 1 B. Boss et al., 2004 W3C Candidate Recommendation (See http://www.w3.org/TR/CSS21/.)
RDF Primer
RDF Primer F. Manola et al., 2004 W3C Candidate 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.)

B Changes in this Version (Non-Normative)

  • This is the first version of this specification.

C Acknowledgements (Non-Normative)

This document was produced with the participation of the Device Independence Working Group participants:

  • Stéphane Boyera, W3C