Website Downloads Documentation Knowledgebase Wiki Issue tracker Commercial support

Query Styling

By default, query results are rendered as a table. It is however possible to customize the styling of these query results. This is done by supplying a style_hint option in the query, for example:

select name where true option style_hint = 'bullets'

The style hint 'bullets' is included as a sample with Daisy, it styles the results as a bulleted list, taking the first selected value (here name) as the text to put next to the bullet.

Style hints are implemented by adding appropriate XSLT templates.

The stylesheets for these are located in the following directory in the DaisyWiki webapp:

daisy/resources/query-styling

The stylesheets follow the following naming convention:

<skin_name>-<format>.xsl

Where skin_name is of course the name of the skin (eg default), and format is html or xslfo. Thus all style hints for a certain skin/format combination are implemented inside the same XSL file.

Here is how the above mentioned bullets hint is implemented (in default-html.xsl):

<xsl:template match="d:searchResult[@styleHint='bullets']">
  <ul>
    <xsl:for-each select="d:rows/d:row">
      <li>
        <a href="{$searchResultBasePath}{@documentId}.html?branch={@branchId}&amp;language={@languageId}">
          <xsl:value-of select="d:value[1]"/>
        </a>
      </li>
    </xsl:for-each>
  </ul>
</xsl:template>

Note: the variable searchResultBasePath was in pre-Daisy 1.2 releases called navigationPath.

Comments (2)
Advertisement

Daisy hosting, installation, support. Workshops and turnkey Daisy CMS projects. Get Daisy from its creators.

outerthought.org

Downloads provided by

SourceForge.net Logo

Open source stats