Changes between Initial Version and Version 1 of HTMLFixes


Ignore:
Timestamp:
Jul 20, 2008, 11:46:06 PM (16 years ago)
Author:
simonp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HTMLFixes

    v1 v1  
     1= Proposal number : ? Proposal title Standardizing the HTML produced by GeoNetwork =
     2
     3|| '''Date''' || 2008/07/21 ||
     4|| '''Contact(s)''' || simonp ||
     5|| '''Last edited''' || [[Timestamp]] ||
     6|| '''Status''' || draft, being discussed, in progress ||
     7|| '''Assigned to release''' || Release number, to be determined ||
     8|| '''Resources''' || Simon Pigot, Grant Mckenzie and ? ||
     9
     10== Overview ==
     11
     12GeoNetwork currently produces HTML that conforms to a variety of standards eg 4.01 and earlier, xhtml and a number of personal interpretations of these :-). A single html standard needs to be adopted, a document type inserted in our html and, most importantly, a testing framework needs to be adopted which will allow developers to validate the html they produce to ensure that it conforms with the html standard we adopt.
     13
     14Why is this important? If you don't give guidance to a browser on what type of html to expect and provide correct html then strange problems can occur which are both difficult and time consuming to find and fix. An example is the height="100%" attribute on some html tables. Internet exploder will (occasionally) fail to render tables with this attribute, whilst Firefox ignores it.
     15
     16Bolsena meeting agreed top adopt HTML 4.01 strict but did not find a testing framework for developers to use (manual methods were suggested which are too time consuming).
     17...
     18
     19=== Proposal Type ===
     20 * '''Type''': changes in GUI, configuration and testing
     21 * '''App''': !GeoNetwork and !Intermap
     22 * '''Module''': XSLT presentation layer, configuration layer
     23
     24=== Links ===
     25 * '''Documents''':
     26 * '''Email discussions''':
     27 * '''Other wiki discussions''': None as yet.
     28
     29=== Voting History ===
     30 * Not submitted for voting yet.
     31
     32----
     33
     34== Motivations ==
     35See overview above. Motivation of this proposal is to find a validation framework that developers can easily use to ensure compliance.
     36
     37== Proposal ==
     38Implement [JTidyServletFilter http://jtidy.sourceforge.net/multiproject/jtidyservlet/filter.html] and [JTidyServlet http://jtidy.sourceforge.net/multiproject/jtidyservlet/] to provide a simple mechanism for developers to validate the html their functions produce.
     39
     40The proposal will add the following:
     41
     421. The following lines to main.xsl (and later to edit.xsl and modal.xsl):
     43
     44{{{
     45<xsl:output method="html" omit-xml-declaration="yes" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" indent="yes"/>
     46}}}
     47
     48and in the footer (next to the unicode and browse happy images), displayed (not surprisingly) at the foot of the page:
     49
     50{{{
     51<xsl:comment>jtidy:validationImage</xsl:comment>
     52}}}
     53
     542. The following configuration lines to (web/geonetwork/WEB-INF/web.xml and web/intermap/WEB-INF/web.xml) support the filter as follows:
     55
     56
     57{{{
     58  <filter>
     59    <filter-name>JTidyFilter</filter-name>
     60    <filter-class>org.w3c.tidy.servlet.filter.JTidyFilter</filter-class>
     61    <init-param>
     62      <param-name>commentsSubst</param-name>
     63      <param-value>true</param-value>
     64    </init-param>
     65  </filter>
     66
     67  <servlet>
     68    <servlet-name>JTidyServlet</servlet-name>
     69    <servlet-class>org.w3c.tidy.servlet.TidyServlet</servlet-class>
     70  </servlet>
     71
     72  <servlet-mapping>
     73    <servlet-name>JTidyServlet</servlet-name>
     74    <url-pattern>/JTidy</url-pattern>
     75  </servlet-mapping>
     76
     77}}}
     78
     79and the following jars to web/geonetwork/WEB-INF/lib and web/intermap/WEB-INF/lib:
     80
     81{{{
     82
     83}}}
     84
     85
     86The filter and servlet need only be active during development. The lines in the web.xml files should be disabled/removed and the jars removed when building the installer.
     87
     883. To add a service to the filter the following steps need to be taken add a mapping to apply the filter to the service you are testing (in the appropriate web.xml file):
     89
     90{{{
     91
     92  <filter-mapping>
     93    <filter-name>JTidyFilter</filter-name>
     94    <url-pattern>*.home</url-pattern>
     95  </filter-mapping>
     96
     97}}}
     98
     99This example mapping will apply the filter to the geonetwork service ending in .home (eg. /geonetwork/srv/en/main.home which is the geonetwork main page if this filter mapping was added to web/geonetwork/WEB-INF/web.xml).
     100
     101When you run the service that renders this page, an icon will appear at this place which can be clicked on to get the report output showing the problems with this page. An example for the main page in geonetwork is as follows:
     102
     103{{{
     104#!html
     105<center>
     106<img src="/geonetwork/wiki/mainpagevalidation.png?format=raw">
     107</center>
     108}}}
     109
     110Clicking on this icon will bring up a report on the validity of the html produced by your xslt which might look something like this:
     111
     112{{{
     113JTidy Messages for request:1 processed in 1475 milliseconds
     114Validation Errors 0
     115Validation Warnings 26
     116Line 291,       column 31       WARNING:        <td> attribute "width" has invalid value "224px"
     117Line 292,       column 34       WARNING:        <table> attribute "width" has invalid value "224px"
     118Line 297,       column 46       WARNING:        <table> attribute "width" has invalid value "211px"
     119Line 299,       column 100      WARNING:        <img> attribute "height" has invalid value "246px"
     120Line 299,       column 100      WARNING:        <img> attribute "width" has invalid value "9px"
     121Line 299,       column 100      WARNING:        <img> lacks "alt" attribute
     122Line 313,       column 52       WARNING:        <td> attribute "width" has invalid value "202px"
     123Line 317,       column 61       WARNING:        <td> attribute "width" has invalid value "122px"
     124Line 326,       column 154      WARNING:        <img> attribute "height" has invalid value "100px"
     125Line 326,       column 154      WARNING:        <img> attribute "width" has invalid value "200px"
     126Line 326,       column 154      WARNING:        <img> lacks "alt" attribute
     127Line 331,       column 156      WARNING:        <img> lacks "alt" attribute
     128Line 631,       column 55       WARNING:        <table> attribute "width" has invalid value "211px"
     129Line 633,       column 61       WARNING:        <td> attribute "width" has invalid value "30%"
     130Line 633,       column 61       WARNING:        <td> attribute "height" has invalid value "29px"
     131Line 634,       column 61       WARNING:        <td> attribute "width" has invalid value "36px"
     132Line 634,       column 111      WARNING:        <img> attribute "width" has invalid value "36px"
     133Line 634,       column 111      WARNING:        <img> lacks "alt" attribute
     134Line 635,       column 61       WARNING:        <td> attribute "width" has invalid value "13px"
     135Line 635,       column 111      WARNING:        <img> attribute "width" has invalid value "13px"
     136Line 635,       column 111      WARNING:        <img> lacks "alt" attribute
     137Line 637,       column 61       WARNING:        <td> attribute "width" has invalid value "12px"
     138Line 637,       column 111      WARNING:        <img> attribute "width" has invalid value "12px"
     139Line 637,       column 111      WARNING:        <img> lacks "alt" attribute
     140Line 645,       column 288      WARNING:        <img> lacks "alt" attribute
     141Line 686,       column 31       WARNING:        <td> attribute "width" has invalid value "100%"
     142
     143Below is the source used for this validation:
     144
     145   1 <!DOCTYPE html
     146   2   PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     147   3 <html>
     148   4    <head>
     149   5       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     150   6       <title>BlueNet MEST Version 1.1 (10/06/08)</title>
     151
     152......................
     153(and so on)
     154}}}
     155
     156It's up to you to then fix the problems with your html and don't forget these immortal words:
     157
     158"You should see our html producing xslts!" - a GeoNetwork developer at the Bolsena meeting :-)
     159
     160
     161=== Backwards Compatibility Issues ===
     162
     163None known.
     164
     165== Risks ==
     166
     167None known?
     168
     169== Participants ==
     170Simon Pigot - developed validation report process described above.
     171Grant Mckenzie - has volunteered to do some work on making the existing pages conformant.
     172