W3C

XHTML Role Attribute Module

A module to support role classification of elements

W3C Editor's Draft 24 September 2008

This version:
http://www.w3.org/TR/2008/ED-xhtml-role-20080924
Latest version:
http://www.w3.org/TR/xhtml-role
Previous version:
http://www.w3.org/TR/2008/WD-xhtml-role-20080407/
Diff from previous version:
xhtml-role-diff.html
Editors:
Mark Birbeck, webBackplane mark.birbeck@webBackplane.com
Shane McCarron , Applied Testing and Technology, Inc.
Steven Pemberton , CWI / W3C ®
T. V. Raman , Google, Inc.
Richard Schwerdtfeger , IBM Corporation

This document is also available in these non-normative formats: PostScript version , PDF version , ZIP archive , and Gzip'd TAR archive .

The English version of this specification is the only normative version. Non-normative translations may also be available.


Abstract

The XHTML Role Attribute defined in this specification allows the author to annotate XML Languages with machine-extractable semantic information about the purpose of an element. Use cases include accessibility, device adaptation, server-side processing, and complex data description. This attribute can be integrated into any markup language based upon XHTML Modularization [ XHTMLMOD ].

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 document is a Candidate Recommendation of the XHTML Role module. It is based upon comments received during the last call period, and also upon work done in the definition of [ XHTML2 ]. It is considered mature and stable by the working group. A record of how the comments from the last call period were addressed is available at http://www.w3.org/MarkUp/2008/xhtml-role-lc2-doc-20080618.html . An implementation report is available at http://www.w3.org/MarkUp/2008/xhtml-role-impl-report.html . The working group invites comments on this draft through 30 July 2008. Comments should be addressed to www-html-editor@w3.org . All comments sent to that address are available in a ( public archive ).

Publication as a Candidate Recommendation 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 has been produced by the W3C XHTML 2 Working Group as part of the HTML Activity . The goals of the XHTML 2 Working Group are discussed in the XHTML 2 Working Group charter .

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 .

Please report errors in this specification to www-html-editor@w3.org ( archive ). It is inappropriate to send discussion email to this address. Public discussion may take place on www-html@w3.org ( archive ).

Table of Contents

1. Introduction

This section is informative.

This document is a module designed to be used to help extend the scope of XHTML-family markup languages into new environments. It has been developed in conjunction with the accessibility community and other groups to make it easier to describe the semantic meaning of XHTML-family document content.

2. Conformance Requirements

This section is normative .

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [ RFC2119 ].

Note that all examples in this document are informative, and are not meant to be interpreted as normative requirements.

2.1. Document Conformance

XHTML Role Attribute Module is not a stand-alone document type. It is intended to be integrated into other host languages such as XHTML. A conforming XHTML Role Attribute Module document is a document that requires only the facilities described as mandatory in this specification and the facilities described as mandatory in its host language. Such a document must meet all the following criteria:

  1. The document MUST conform to the constraints expressed in its host language implementation.

  2. If the host language is not in the XHTML namespace, and the host language does not incorporate this module into its own namespace, then the document MUST contain an XML namespace declaration for the XHTML Role Attribute Module namespace [ XMLNAMES ] . The namespace for XHTML Role Attribute Module is defined to be http://www.w3.org/1999/xhtml . An example start tag of a root element might look like:

    This example is informative
    <mylang xmlns="http://www.example.com/dtd/mylang" 
            xmlns:xh="http://www.w3.org/1999/xhtml" xml:lang="en" >
    

2.2. Host Language Conformance

When the XHTML Role Attribute Module is included in a host language, all of the facilities required in this specification MUST be included in the host language. In addition, the attribute defined in this specification MUST be included in the content model of the host language.

3. The XHTML Role Attribute

This section is normative.

The Role Attribute Module defines the role attribute. The role attribute takes as its value one or more whitespace separated CURIE s [ CURIE ]. Each CURIE maps to a URI that corresponds to a vocabulary term that SHOULD be defined using RDF. Note that CURIEs can be prefixed (of the form prefix:reference ) or unprefixed (of the form reference ). As per the requirements of the CURIE specification, this document defines unprefixed CURIEs as mapping to the terms in the XHTML vocabulary. Any unprefixed value MUST be interpreted as being from the XHTML vocabulary at http://www.w3.org/1999/xhtml/vocab# . For a list of all roles in the default vocabulary, see [ XHTMLVOCAB ].

The attribute describes the role(s) the current element plays in the context of the document. This can be used, for example, by applications and assistive technologies to determine the purpose of an element. This could allow a user to make informed decisions on which actions may be taken on an element and activate the selected action in a device independent way. It could also be used as a mechanism for annotating portions of a document in a domain specific way (e.g., a legal term taxonomy). Although the role attribute may be used to add semantics to an element, authors SHOULD use elements with inherent semantics, such as <p> , rather than layering semantics on semantically neutral elements, such as <div role="paragraph"> .

The following is an example of a good, appropriate use of the role attribute:

This example is informative
<ul role="navigation">
    <li href="downloads">Downloads</li>
    <li href="docs">Documentation</li>
    <li href="news">News</li>
</ul>

The next example, on the other hand, is a poor use of the role attribute because it attempts to apply semantics of an element that already exists onto some other element:

This example is informative
<p>Do you agree with the above license?
    <span role="checkbox">Yes</span>
    <span role="checkbox">No</span>
</p>

A more appropriate use of this module would be to use the existing checkbox element:

This example is informative
<p>Do you agree with the above license?
    <input type="checkbox" name="agree" value="y" />Yes
    <input type="checkbox" name="agree" value="n" />No
</p>

3.1. Extending the collection of roles

It is possible to define additional role values. Such values MUST be defined in their own vocabulary. Note that current best practice is that the URI associated with that vocabulary resolve to a resource that allows for the discovery of the definition of the roles in the vocabulary.

A. DTD Implementation

This appendix is informative .

The DTD implementation of XHTML Role Attribute Module conforms to the requirements defined in [ XHTMLMOD ]. Consequently, it provides a Qualified Names declaration module.

A.1. Qualified Names Module

Note that this module defines the parameter entity %xhtml-role-attrs.qname; . This entity is intended to be used in the attribute lists of elements in any host language that permits the use of the role attribute on elements in its own namespace. If a host language does not permit role in its namespace, then the host language driver should set a parameter entity %XHTML-ROLE.prefixed; to INCLUDE and a parameter entity %XHTML-ROLE.prefix; to a value that is the prefix for the XHTML Role Attribute Module attribute.

<!-- ....................................................................... -->
<!-- XHTML Role Qname Module  ............................................ -->
<!-- file: xhtml-role-qname-1.mod
     This is XHTML Role - the Role Attribute Module for XHTML.
     Copyright 2006 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     This DTD module is identified by the PUBLIC and SYSTEM identifiers:
       PUBLIC "-//W3C//ENTITIES XHTML Role Attribute Qnames 1.0//EN"
       SYSTEM "http://www.w3.org/MarkUp/DTD/xhtml-role-qname-1.mod"
     Revisions:
     (none)
     ....................................................................... -->
<!-- XHTML Role Attribute Qname (Qualified Name) Module
     This module is contained in two parts, labeled Section 'A' and 'B':
       Section A declares parameter entities to support namespace-
       qualified names, namespace declarations, and name prefixing
       for XHTML Role and extensions.
       Section B declares parameter entities used to provide
       namespace-qualified names for the XHTML role attribute:
         %role.qname;   the xmlns-qualified name for @role
         ...
     XHTML Role extensions would create a module similar to this one.
-->
<!-- Section A: XHTML Role Attribute XML Namespace Framework ::::::::::::::: -->
<!-- 1. Declare a %XHTML-ROLE.prefixed; conditional section keyword, used
        to activate namespace prefixing. The default value should
        inherit '%NS.prefixed;' from the DTD driver, so that unless
        overridden, the default behavior follows the overall DTD
        prefixing scheme.
-->
<!ENTITY % NS.prefixed "IGNORE" >
<!ENTITY % XHTML-ROLE.prefixed "%NS.prefixed;" >
<!-- 2. Declare a parameter entity (eg., %XHTML-ROLE.xmlns;) containing
        the URI reference used to identify the XHTML Role Attribute namespace
-->
<!ENTITY % XHTML-ROLE.xmlns  "http://www.w3.org/1999/xhtml" >
<!-- 3. Declare parameter entities (eg., %XML.prefix;) containing
        the default namespace prefix string(s) to use when prefixing
        is enabled. This may be overridden in the DTD driver or the
        internal subset of an document instance. If no default prefix
        is desired, this may be declared as an empty string.
     NOTE: As specified in [XMLNAMES], the namespace prefix serves
     as a proxy for the URI reference, and is not in itself significant.
-->
<!ENTITY % XHTML-ROLE.prefix  "" >
<!-- 4. Declare parameter entities (eg., %XHTML-ROLE.pfx;) containing the
        colonized prefix(es) (eg., '%XHTML-ROLE.prefix;:') used when
        prefixing is active, an empty string when it is not.
-->
<![%XHTML-ROLE.prefixed;[
<!ENTITY % XHTML-ROLE.pfx  "%XHTML-ROLE.prefix;:" >
]]>
<!ENTITY % XHTML-ROLE.pfx  "" >
<!-- declare qualified name extensions here ............ -->
<!ENTITY % xhtml-role-qname-extra.mod "" >
%xhtml-role-qname-extra.mod;
<!-- 5. The parameter entity %XHTML-ROLE.xmlns.extra.attrib; may be
        redeclared to contain any non-XHTML Role Attribute namespace 
        declaration attributes for namespaces embedded in XML. The default
        is an empty string.  XLink should be included here if used
        in the DTD.
-->
<!ENTITY % XHTML-ROLE.xmlns.extra.attrib "" >
<!-- Section B: XML Qualified Names ::::::::::::::::::::::::::::: -->
<!-- 6. This section declares parameter entities used to provide
        namespace-qualified names for the XHTML role attribute.
-->
<!ENTITY % xhtml-role.role.qname  "%XHTML-ROLE.pfx;role" >
<!-- The following defines a PE for use in the attribute sets of elements in
     other namespaces that want to incorporate the XHTML role attribute. Note
     that in this case the XHTML-ROLE.pfx should be defined. -->
<!ENTITY % xhtml-role.attrs.qname
   "%XHTML-ROLE.pfx;role             CDATA        #IMPLIED"
    >
<!-- end of xhtml-role-qname-1.mod -->

B. Schema Implementation

This appendix is informative .

The schema implementation of XHTML Role Attribute Module conforms to the requirements defined in [ XHTMLMOD ]. It is included here as an example implementation.

B.1. Attributes Module

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 elementFormDefault="qualified"
 xmlns:xh11d="http://www.w3.org/1999/xhtml/datatypes/"
>
    <xs:import namespace="http://www.w3.org/1999/xhtml/datatypes/" 
               schemaLocation="xhtml-datatypes-1.xsd" />
    <xs:annotation>
        <xs:documentation>
      This is the XML Schema attribute module for XHTML Role
      $Id: xhtml-role-diff.html,v 1.1 2008/09/24 17:25:58 smccarro Exp $
    </xs:documentation>
        <xs:documentation source="xhtml-copyright-1.xsd"/>
        <xs:documentation source="http://www.w3.org/TR/xhtml-role#A_role"/>
    </xs:annotation>
    <xs:attribute name="role" type="xh11d:CURIEs"/>
</xs:schema>

C. References

This appendix is normative .

C.1. Normative References

[ CURIE ]
" CURIE Syntax 1.0 ", W3C Working Draft, M. Birbeck, S. McCarron, ed. , 2 April 2008.
Available at: http://www.w3.org/TR/2008/WD-curie-20080402/
The latest version is available at: http://www.w3.org/TR/curie
[RFC2119]
" Key words for use in RFCs to indicate requirement levels ", RFC 2119, S. Bradner, March 1997.
Available at: http://www.rfc-editor.org/rfc/rfc2119.txt
[ XHTMLMOD ]
" Modularization of XHTML™ 1.1 ", W3C Proposed Recommendation, D. Austin et al. , eds. , 11 June 2008.
Available at: http://www.w3.org/TR/2008/PR-xhtml-modularization-20080611
The latest version is available at: http://www.w3.org/TR/xhtml-modularization
[ XHTMLVOCAB ]
" XHTML Vocabulary ", XHTML 2 Working Group.
Available at: http://www.w3.org/1999/xhtml/vocab
[XMLNAMES]
" Namespaces in XML ", W3C Recommendation, T. Bray et al. , eds. , 14 January 1999.
Available at: http://www.w3.org/TR/1999/REC-xml-names-19990114
The latest version is available at: http://www.w3.org/TR/REC-xml-names

C.2. Other References

[ XHTML ]
" XHTML™ 1.0: The Extensible HyperText Markup Language (Second Edition) ". S. Pemberton et al. , 26 January 2000, revised 1 August 2002.
Available at: http://www.w3.org/TR/2002/REC-xhtml1-20020801
The latest version is available at: http://www.w3.org/TR/xhtml1
[ XHTML2 ]
" XHTML™ 2.0 ". J. Axelsson et al. , 27 May 2005.
Available at: http://www.w3.org/TR/2005/WD-xhtml2-20050527
The latest version is available at: http://www.w3.org/TR/xhtml2

D. Acknowledgments

This section is informative.

At the time of publication, the participants in the W3C XHTML 2 Working Group were: