Worked on the search. Decided to take a different approach from EMLS, and write the find operation (in find.xq) in such a way that it pulls back full documents in a corpus, for the XSLT to deal with. Got the basic find working -- documents are retrieved based on the criteria in the dropdowns combined with any text search. Searches for any word and all words use the eXist functionality (&=
and |=
), and therefore result in <exist:match> tags which can be used for highlighting, but searches on exact phrase use the xpath contains function and therefore can't be highlighted; I don't know a way around that.
In the process of working on this, I began to re-think the problem with innerHTML
, and it occurs to me that we could use the responseXML
property of XMLHttpRequest instead of the responseText
. The former is supposed to return a DOM document, so we could use standard DOM methods to move its children into the page DOM, thus avoiding innerHTML, which presumably means the operations should work on Safari even if the page is served as application/xhtml+xml. That would be grand. Additionally, I had a DOH moment when I realized that the display issues caused by that mime type are simply due to the CSS not having obvious properties set (such as display: block
for p
, ul
and li
tags). This opens the door to running the whole site as pure XHTML (served with the right mime type), which would be the best option by far, if we can make it work.