W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > February 2007

Re: Some draft code for mobileOK Basic Tests RI

From: Roland Gülle <roland@7val.com>
Date: Thu, 8 Feb 2007 14:57:24 +0100
Message-Id: <C816DC56-BD55-4747-ADB2-F48BB0E9D2C3@7val.com>
Cc: <public-mobileok-checker@w3.org>
To: "Jo Rabin" <jrabin@mtld.mobi>

> Purely as a recreational exercise this is along similar lines:
>
> http://rabin.mobi/r/format?uri=http://t-mobile.mobi
Very cool!
Here the beginning of a small XSLT that checks the output.
The complete page size is checked and if all links has an accesskey  
with a keypad number.

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
version="1.0">

   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="/">
     <result>
       <!-- page checks -->
       <xsl:call-template name="testCompletePageSize"/>

       <!-- element checks -->
       <xsl:apply-templates select="//tidiedPayload"/>
     </result>
   </xsl:template>


   <!--
       link validation
   -->
   <xsl:template match="*[local-name() = 'a']">
     <check name="linkAccessKey" value="{@accesskey}">
       <xsl:attribute name="linkAccessKey" >
	<xsl:choose>
	  <xsl:when test="number(@accesskey) &gt;= 0 and number(@accesskey)  
&lt;= 9">passed</xsl:when>
	  <xsl:otherwise>failed</xsl:otherwise>
	</xsl:choose>
       </xsl:attribute>
     </check>
     <xsl:apply-templates/>
   </xsl:template>

   <xsl:template match="node()">
     <xsl:apply-templates/>
   </xsl:template>


   <!--
       page size check
   -->
   <xsl:template name="testCompletePageSize">
     <xsl:variable name="completePageSize" select="sum(//payload/ 
@size)"/>
     <check name="completePageSize" value="{$completePageSize}">
       <xsl:attribute name="result">
	<xsl:choose>
	  <xsl:when test="$completePageSize &gt; 10000">failed</xsl:when>
	  <xsl:otherwise>passed</xsl:otherwise>
	</xsl:choose>
       </xsl:attribute>
     </check>
   </xsl:template>
</xsl:stylesheet>
Received on Thursday, 8 February 2007 13:57:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:02 GMT