Search page: more significant progress
A pretty good search page is now online here. However, it only works properly in Firefox and IE. These are the good things about it, most of which represent significant steps forward over previous projects:
- It uses proper DOM methods instead of relying on innerHTML (except when running on IE, which can't handle importNode, among other things).
- It has a working implementation of "keyword-in-context" (KWIC) displays of the search results, written in pure XSLT, rather than relying on the problematic (and proprietary) extension functions in eXist. My XSLT seems to work better than anything that can be achieved using the eXist functions (which we used in the EMLS project).
- Where asearch finds a hit inside a tag with an xml:id attribute, it makes a hash link to that element id in the Web page; in the case of image markup pages, this pops up the annotation containing the hit. This will eventually be extended to include highlighting on the page.
- It does "any word", "all words" and "exact phrase" searching. The first two use eXist's shortcut functions; the last uses xpath contains(), and it isn't appreciably slower.
There are two classes of remaining problem. The first is browser support:
- Opera appears not to insert the results into the page. Although it claims to support importNode, I suspect this may be the root of the problem with Opera. In order to confirm this, I'll need to try using cloneNode instead; that's not the "proper" way to do it, but has been used in the past. If that works, we know the problem is with DOM implementation, and we can try to find a workaround. At worst, we demote Opera to the same status as IE and use innerHTML.
- Safari displays the results OK, but the links inside the results do not function as links. This may be because the imported nodes are not construed as XHTML for some reason. I don't have an angle on this yet, but the problem does not occur with WebKit (the development version of Safari), so it may just go away in time. Nevertheless, we need a workaround.
- The progress bar doesn't seem to show up on any browser (although it may be going by too fast to see).
The second class of problem may be a significant factor in the issues above. I'm still doggedly trying to serve my XHTML 1.1 documents as application/xml+xhtml
instead of as text/html
(although I just noticed that I'm specifying a text/html
in a meta tag, which might override the server settings on some browsers). It may be the case that, even using proper DOM methods, we still don't inherit enough useful functionality from HTML (events and behaviours such as linking) when the pages are served as application/xml+xhtml
, so that making a complex interactive site may be impossible, or horribly difficult, unless we go back to text/html
. To test this, I need to do this:
- Remove the meta tag to get a "pure"
application/xml+xhtml
site, and test on various browsers. Make notes of what works and what doesn't. - Replace the meta tags, and change the sitemap to serve pages as
xhtml11_compat
for all browsers (not just IE, as is currently the case). (xhtml11_compat
is my serializer for XHTML 1.1 served astext/html
.) Test again, and note the results. - If we find that things generally work (especially if they work in Safari and Opera), we should probably give up on the use of
application/xml+xhtml
for the moment, unfortunate though this would be. We can always change this later when browsers become more reliable in this regard. Meanwhile, we need a working site. The site can still make use of proper DOM methods (where they're supported) instead of innerHTML.