How nice would it be when we could obtain the results of a Domino free text search in an XML format so that we then can use xsl stylesheets to present and manipulate the results the way we like it. The problem face however is that Domino today does not allow us to use the 'treat document content as HTML' property for a $$SearchForm and thus makes it impossible for us to present the search results as clean xml-sources. This tip describes a way to use XML data islands to get around this problem (I tested with ie 5.5).
Code
I use a view with the 'treat body as HTML' turned on to display the documents in the wanted xml format (no headers, no categorized columns). In the corresponding $$SearchForm I place the following pass-through HTML code:
<xml id="xmlSource">
<?xml version="1.0"?>
<Entries>
-- here the $$ViewBody field displaying the records in XML --
</Entries>
<div id="DisplayArea"></div>
The clue is that the xml dataisland functions as an XMLDOM object and can be adressed as such. In the JS header section of the $$SeachForm, I place some code that applies an xsl styleheet to display the XML. For example:
var style ;
function showXML() {
// create dom object to hold xsl stylesheet and load it
style = new ActiveXObject("Microsoft.XMLDOM");
style.async = false;
style.load("./MyStyle.xsl");
// apply stylesheet to XML and display it in the <div> section at the end of the page
document.all.item("DisplayArea").innerHTML = xmlSource.transformNode(style) ;
}
Finally, in the onload event, I call the function to display the XML:
showXML()