
| Imperative | Declarative |
|---|---|
| Program-based | Rule-based |
| Hard-coded conditions | Clean conditions |
| Embedded in the source code | Context-free |
| Hard to read | Easy to read |
| Hard to reuse | Easy to reuse |
| Hard to share | Easy to share |
| Hard to agree expectations | Easy to agree expectations |
Most evaluation tools follow the imperative approach.
| Taw | Hera | WAEX |
|---|---|---|
![]() | ![]() | ![]() |
| Taw | Hera | WAEX |
|---|---|---|
![]() | ![]() | ![]() |
| Taw | Hera | WAEX |
|---|---|---|
![]() | ![]() | ![]() |
<img src="img/logo_cost.gif" /> No alt!! <img src="img/logo_mause.jpg" /> No alt!!
| Expression | |
|---|---|
| DTD | <!ATTLIST img alt CDATA #REQUIRED> |
| XML Schema | <xs:element name="img"> <xs:complexType> <xs:attribute name="alt" use="required" type="xs:string"/> </xs:complexType> </xs:element> |
| XSLT | <xsl:template match="//img[not(@alt)]"> <xsl:message>Images with no alt attribute</xsl:message> </xsl:template> |
<blink>«</blink> Deprecated!!
<b>Address</b> Deprecated!!
| Expression | |
|---|---|
| DTD | No such <!ELEMENT b ...> nor <!ELEMENT blink ...> ... (in new XHTML versions) |
| XML Schema | No such <xs:element name="b"/> nor <xs:element name="blink"/> ... (in new XHTML versions) |
| XSLT | <xsl:template match="//b | //i | //u | //tt | //font | //center |//blink"> <xsl:message>Deprecated elements no longer in use</xsl:message> </xsl:template> |
<a href="..."><label>Room</label></a> Bad!! (but not in DTD)
<em><ins><p>Bad insertion</p></ins></em> Bad!! (but not in DTD)
| Container element | Forbidden contents | Condition to be forbidden |
|---|---|---|
| pre | img, object, big, small, sub, sup | Always forbidden |
| a, label | a, area, label, input, select, textarea, button | Always forbidden |
| form | form | Always forbidden |
| table | table | In XHTML Basic |
| ins | Any block-type element | If the ins element is inside an inline-type element |
<input type="image" name="submit1" /> No alt!!
<input type="radio" alt="..."/> Wrong alt!!
| Expression | |
|---|---|
| DTD | Not feasible |
| XML Schema | Not feasible |
| XSLT | <xsl:template match="//input[@type='image'][not(@alt)]"> <xsl:message>Image input with no alt</xsl:message> </xsl:template> |
| Container element | Attribute | Condition to be mandatory |
|---|---|---|
| img,area | alt | Always (and thus, expressible) |
| frame | title | Always (and thus, expressible) |
| input | alt | If input's type is "image" |
| th | abbr | If table header's text is too long |
| table | summary | If table contains tabular data, i.e, it is not a layout-only table |
| Container element | Required element | Condition to be mandatory |
|---|---|---|
| head | title | Always (expressed) |
| html | head | Always (expressed) |
| frameset, iframe | noframes | Always (expressible) |
| object | some alternative inside | If object does not contain alternative text |
| form | fieldset | If too many form fields |
| select | optgroup | If too many options |
| table | caption | If table contains tabular data, i.e, it is not a layout-only table |
<a href="javascript:loadUrl(...)">... Bad!! Use onclick instead!!
| Container element | Misused attribute | Misusage condition |
|---|---|---|
| a, area | href | JavaScript present at href attribute, instead of at onclick attribute |
| meta | http-equiv | Badly used for auto-refresh or auto-redirect |
| input | alt | If input's type is not "image" |
| * (any tag) | tabindex | Not a set of unique consecutive numbers |
| * (any tag) | accesskey | Not a unique character |
<h1>...</h1> <h3>...</h3> Missing h2!!
| Expression | |
|---|---|
| DTD | Not feasible |
| XML Schema | Not feasible |
| XSLT | <xsl:template match="//h6[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6][1][self::h6 or self::h5])] | //h5[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 orself::h5 or self::h6][1][self::h6 or self::h5 or self::h4])] | //h4[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 orself::h5 or self::h6][1][self::h6 or self::h5 or self::h4 or self::h3])] | //h3[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 orself::h5 or self::h6][1][self::h6 or self::h5 or self::h4 or self::h3 or self::h2])] | //h2[not(preceding::*[self::h1 or self::h2 or self::h3 or self::h4 orself::h5 or self::h6][1])]"> <xsl:message>Improper headers</xsl:message> </xsl:template> |
<area href="..."/ > Missing redundant link!
| Expression | |
|---|---|
| DTD | Not feasible |
| XML Schema | Not feasible |
| XSLT | <xsl:template match="//area"> <xsl:variable name="area" select="." /> <xsl:if test="not(//a[@href = $area/@href])"> <xsl:message>Missing redundant area's link</xsl:message> </xsl:if> </xsl:template> |
<input size="84" name="address" type="text" /> Missing label!
| Expression | |
|---|---|
| DTD | Not feasible |
| XML Schema | Not feasible |
| XSLT | <xsl:template match="//select | //textarea | input[@type='password' or @type='text' or @type='checkbox' or @type='radio' or @type='file']"> <xsl:variable name="ff" select="." /> <xsl:variable name="l" select="//label[@for=$ff/@id]" /> <xsl:if test="count($l)>1 or (count($l)=0 and not(@title))"> <xsl:message>Missing form field's label</xsl:message> </xsl:if> </xsl:template> |
<xsl:value-of select="document(concat( 'http://validator.w3.org/check?charset=%28detect+automatically%29&uri=' ,$url))//xhtml:*[contains(., 'Congratulations')]" />
<xsl:value-of select="document(concat( 'http://jigsaw.w3.org/css-validator/validator?uri=' ,$url))//xhtml:*[contains(., 'Congratulations')]" />
<xsl:value-of select="document(concat( 'http://cgi.w3.org/cgi-bin/headers?url=' ,$url))//xhtml:pre" />
| Taw | Hera | WAEX | |
|---|---|---|---|
| Size | 3 Mb | 329 Kb | 90 Kb |
| Platform | Java | PHP | XSLT |
| WCAG Coverage | OK | OK | OK |
| Standalone | Yes | Yes | Yes |
| Online | Yes | Yes | Yes |
| HTML | Any | Any | XHTML |
| Reusability | Poor | Poor | Rich |
| EARL | Yes | Yes | Not yet (easy) |
| Multiple idioms | Yes | Yes | Not yet (easy) |
| Multiple pages | Yes | No | No |
| HTTPS | Yes | No | No |
| Mobile OK | Yes | No | Yes |
| Uses external tools | No | Yes | Yes |
| Covers XHTML restrictions not in DTD | No | No | Yes |