<?xml version="1.0" ?>
<!--
	Schematron schema for WAI

	modified for XHTML by
        Dan Connolly, W3C http://www.w3.org/People/Connolly/
	$Id: wai.xml,v 1.2 2000/07/21 19:28:41 connolly Exp $

        originally...
	http://www.ascc.net/xml/resource/schematron/wai.xml
	Rick Jelliffe, ricko@gate.sinica.edu.tw
	Academia Sinica Computing Centre, Taipei, Taiwan

	Taken from http://www.w3.org/TR/1999/WAI-WEBCONTENT-19990505 
	Status: 
		Incomplete especially after ch 12. 
		Needs fine-toothed combing.
		Test for presence of attributes and elements; should 
			also text string-length > 0

	For the Schematron validator, go to 
	http://www.ascc.net/xml/resource/schematron/schematron.html

       Note: in a context, the XSLT "|" is used to indicate or. In a 
       test, the XPath "or" is used. 

-->
	
<schema
        xmlns="http://www.ascc.net/xml/schematron"
        ns="http://www.ascc.net/xml/resource/schematron/wai.xml"
        xmlns:h="http://www.w3.org/1999/xhtml"
>
  <ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>

	<title>Schema for Web Content Accessibility</title>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 1"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-provide-equivalents"
		fpi="+//IDN sinica.edu.tw/SGML Schema for WAI::Guideline 1//EN"
		id="g1">
		<rule context="h:img">
			<assert  test="@alt  or  @longdesc">(1.1) An image element should have some descriptive text: an alt or longdesc attribute.</assert>
			<key name="imgkey" path="@alt" />
		</rule>
		<rule context="h:input">
			<assert test="@alt">(1.1) An input element should have some descriptive text: an alt or longdesc attribute.</assert>
		</rule>
		<rule context="h:applet ">
			<assert test="@alt">(1.1) An applet element should have some descriptive text: an alt or longdesc attribute.</assert>
		</rule>
		<rule context="h:map">
			<assert test="h:area/@alt  or  a ">(1.1) A map element should have some descriptive text: an alt attribute or a link.</assert>
		</rule>
		<rule context="h:object">
			<assert test="string-length(text()) &gt; 0">(1.1) An object element should contain some descriptive text.</assert>
		</rule>
		<rule context="h:frame ">
			<assert test="@longdesc">(1.1) A frame element should have some descriptive text: a longdesc attribute.</assert>
		</rule>
		
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 2"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-color">
		<rule context="h:body">
			<report role="samecolor" test="string(@bgcolor) = string(@color)">(2.2) The background color and the foreground color are the same</report>
			<!-- put specific color comparisons here -->
		</rule>
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 3"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-structure-presentation">
		<rule context="h:b    | h:i ">
			<report test="self::*">(3.3) Concerning element <name />: B and I are not recommended. Use strong and em, or stylesheets.</report>
		</rule>
		<rule context="h:ul  | h:ol ">
			<assert test="h:li">(3.3) A list should not be used for formatting effects</assert>
		</rule>
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 4"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-abbreviated-and-foreign">
		<rule role="topdoc" context="h:html   | h:body">
			<assert test="@lang  or  @xml:lang ">(4.3) The primary language of a 
				document should be identified. </assert>
		</rule>
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 5"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/i#gl-table-markup">
		<rule context="h:table">
			<assert test="h:caption">(5.1) A table should have a caption</assert>
			<assert test="@summary ">(5.5) A table should have a summary attribute </assert>
		</rule>
		<rule context="h:td">
			<assert test="@scope  or  @headers  or  @axis  ">(5.2) Table data should identify 
			its scope, headers, axis in attributes.</assert>
		</rule>
		<rule context="h:th">
			<assert test="@abbr">(5.6) A table header should have an abbr attribute to give abbreviation</assert>
		</rule>
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 6"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-new-technologies">
		<rule context="*[@onmouseup]">
			<assert test="@onkeyup">(6.4) If you specify an "onmouseup" attribute
			on a <name /> element,
			you should also specify an "onkeyup" attribute</assert> 
		</rule>
		<rule context="*[@onmousedown]">
			<assert test="@onkeydown">(6.4) If you specify an "onmousedown" 
			attribute on a <name /> element,
			you should also specify an "onkeydown" attribute</assert> 
		</rule>
		<rule context="*[@onclick]">
			<assert test="@onkeypress">(6.4) If you specify an "onclick" 
			event on a <name /> element,
			you should also specify an "onkeypress"</assert> 
		</rule>
		<rule context="*[local-name='marquee'] ">
			<assert test="*">(6.5) The marquee element is not good HTML</assert>
		</rule>
		<rule context="*[local-name='blink'] ">
			<assert test="*">(6.5) The blink element is not good HTML</assert>
		</rule>
		<rule context="h:frame ">
			<report test="contains(@src, '.gif')
				 or 	contains(string(@src), '.GIF')  
				 or  contains(string(@src), '.jpg')  or contains(string(@src), '.JPG') 
				 or  contains(string(@src), '.jpeg')  or contains(string(@src), '.JPEG') 
				 or  contains(string(@src), '.png')  or contains(string(@src), '.PNG') ">
				(6.2) A frame should not be a direct image</report>
			<assert test="../h:noframes">(6.5) If you specify a frame, also specify a
			noframes element.</assert>
		</rule>
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 7"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-movement">
		<rule context="h:meta  ">
			<report test="@http-equiv = 'refresh'">(7.1) The 
			user should control the refreshing of the page</report>
		</rule>
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline ?"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/">
		<rule context="h:fieldset ">
			<assert test="h:legend">(?) A fieldset should have a legend</assert>
	     	</rule>	
	</pattern>
	<pattern name="Web Content Accessibility Guidelines 1.0, Guideline 12"
		see="http://www.w3.org/TR/WAI-WEBCONTENT/#gl-complex-elements">
		<rule context="h:frameset ">
			<assert test="@title">(12.1) A frameset should have a title</assert>
	     	</rule>	
	</pattern>
</schema>
