The Free XSL parser used in the previous sections provides a very simple example of how to boost all of the documents in a specified source. One down-side of this simple example is that the simple parser discards all of the Watson™ Explorer Engine nodes except for document nodes. The Watson Explorer Engine passes a good deal of information via other XML nodes and their attributes in the content that it returns, including debugging information, the number of results that are being returned (which is used in many internal tests), and so on.
An easy example of the information that is lost when using a minimal parser such as this is detailed Watson Explorer Engine debugging information. Normally, adding the v:debug=1 parameter to the end of any search results URL displays the parser debugging screen. Unfortunately, results using the parser that we have written to date lose some of this information, as shown in Figure 1.
Standard Watson Explorer Engine debugging queries provide a Debug section below each search result that gives summary information about that result such as the Score, Relevance Score, Link Analysis Score, and Matching Passages information used to determine how to prioritize that result.
Unfortunately, when using the minimal Free XSL parser shown in the previous section, adding this parameter doesn't change the output from what is shown in Figure 1, aside from the fact that the screen displays a message stating that it is in debugging mode. This is due to the fact that debugging information is actually passed as a special attribute of each node when debugging is activated via the debugging CGI parameter, and we are not explicitly copying the attributes of the document nodes.
In order to pass through other XML node attributes and nodes beyond the standard <document> nodes and the attributes used for boosting, you'll need to write a Free XSL parser that doesn't discard any attribute or sub-element of the document node. The following parser boosts all of the document nodes in your output, but preserves existing attributes of those nodes:
<xsl:template match="/"> <boost name="df" /> <xsl:apply-templates select="//document" /> </xsl:template> <xsl:template match="document"> <document boost-name="df" boost-display="boost-and-list"> <xsl:copy-of select="@*" /> <xsl:copy-of select="*" /> </document> </xsl:template>
As you can see, the only difference between this parser and the previous initial one is the addition of the xsl:copy-of line that copies existing attributes (@*) to the new nodes.
Retrying the existing query for the term car now displays debugging information.
Though the end-users of the applications that you create will probably not be authorized to view Watson Explorer Engine-based applications in debug mode, the important point here is that any parser that you write should not unintentionally drop any information that other aspects of the Watson Explorer Engine application may depend on.
To proceed with this tutorial, click Creating a New Display.