Apache Lucene open-source search software
a few minor improvements: multi-val fields as lists, and DHTML reveal of score explanation if available
Chris M. Hostetter48cc7c255d69
diff --git a/example/solr/conf/xslt/example.xsl b/example/solr/conf/xslt/example.xslindex 312fede1b0d..75178f29d27 100644--- a/example/solr/conf/xslt/example.xsl+++ b/example/solr/conf/xslt/example.xsl@@ -37,8 +37,8 @@<body><h1><xsl:value-of select="$title"/></h1><div class="note">- This has been formatted by the default query-to-html.xsl transform - use your own XSLT- to get a nicer page+ This has been formatted by the sample "example.xsl" transform -+ use your own XSLT to get a nicer page</div><xsl:apply-templates select="response/result/doc"/></body>@@ -46,13 +46,58 @@</xsl:template><xsl:template match="doc">+ <xsl:variable name="pos" select="position()"/><div class="doc"><table width="100%">- <xsl:apply-templates/>+ <xsl:apply-templates>+ <xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param>+ </xsl:apply-templates></table></div></xsl:template>+ <xsl:template match="doc/*[@name='score']" priority="100">+ <xsl:param name="pos"></xsl:param>+ <tr>+ <td class="name">+ <xsl:value-of select="@name"/>+ </td>+ <td class="value">+ <xsl:value-of select="."/>++ <xsl:if test="boolean(//lst[@name='explain'])">+ <xsl:element name="a">+ <!-- can't allow whitespace here -->+ <xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element>+ <br/>+ <xsl:element name="div">+ <xsl:attribute name="class">exp</xsl:attribute>+ <xsl:attribute name="id">+ <xsl:value-of select="concat('exp-',$pos)" />+ </xsl:attribute>+ <xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/>+ </xsl:element>+ </xsl:if>+ </td>+ </tr>+ </xsl:template>++ <xsl:template match="doc/arr" priority="100">+ <tr>+ <td class="name">+ <xsl:value-of select="@name"/>+ </td>+ <td class="value">+ <ul>+ <xsl:for-each select="*">+ <li><xsl:value-of select="."/></li>+ </xsl:for-each>+ </ul>+ </td>+ </tr>+ </xsl:template>++<xsl:template match="doc/*"><tr><td class="name">@@ -67,12 +112,20 @@<xsl:template match="*"/><xsl:template name="css">+ <script>+ function toggle(id) {+ var obj = document.getElementById(id);+ obj.style.display = (obj.style.display != 'block') ? 'block' : 'none';+ }+ </script><style type="text/css">body { font-family: "Lucida Grande", sans-serif }- .doc { margin-top: 1em; border-top: solid grey 1px; }td.name { font-style: italic; font-size:80%; }td { vertical-align: top; }+ ul { margin: 0px; margin-left: 1em; padding: 0px; }.note { font-size:80%; }+ .doc { margin-top: 1em; border-top: solid grey 1px; }+ .exp { display: none; font-family: monospace; white-space: pre; }</style></xsl:template>