5.8.3 Usage
5.8.3.1 Faceted browser initialisation
You can define different initialisations for the faceted browser in the faceted navigation definition file. This can be done using an optionsList element.
<facetedNavigationDefinition xmlns="http://outerx.org/daisy/1.0#facetednavdef">
<optionsList defaultOptions="standard">
<options id="standard">
<limitToSiteCollection>false</limitToSiteCollection>
<limitToSiteVariant>true</limitToSiteVariant>
<defaultConditions>true</defaultConditions>
</options>
<options id="doctype">
<limitToSiteCollection>false</limitToSiteCollection>
<limitToSiteVariant>true</limitToSiteVariant>
<defaultConditions>documentType='{request-param:docType|SimpleDocument}'</defaultConditions>
<defaultOrder>documentType ASC</defaultOrder>
</options>
</optionsList>
<facets>
<facet expression="documentType"/>
<facet expression="collections"/>
<facet expression="lastModifierLogin"/>
</facets>
</facetedNavigationDefinition>
If you wish to be able to choose from a range of different options without having to make different definition files you can use optionsList element. It contains a list of different options definitions which must be identified using the id attribute on the options element. In order to know which set of options should be used by default you must set the defaultOptions attribute to the id of one of the options elements.
After having defined your optionsList you will probably want to specify one of the options there. This can be done by adding a request parameter in the url. It would look something like this :
http://localhost:8888/daisy/yoursite/facetedBrowser/test?options=doctype
In the definition you will also find this
{request-param:docType|SimpleDocument} --> {request-param:request-parameter-name|default-request-parameter-value}
If the specified request parameter exists the {...} will be substituted by the parameter value. In case that no such parameter exists the default value will be used. In the url our example will look a bit like this :
http://localhost:8888/daisy/yoursite/facetedBrowser/test?options=doctype&docType=SomeDocumentType
5.8.3.2 Showing the navigation tree
If you wish to have the navigation tree displayed in the faceted browser you can specify the navigation path as a request parameter (activeNavPath). Here is an example :
http://localhost:8888/daisy/yoursite/facetedBrowser/test?activeNavPath=/path/to/facetedBrowser
The presence of the parameter will convey your wish to see the navigation tree and set the active navigation node to the specified path.
5.8.3.3 Using an alternative stylesheet
If you wish to use a different stylesheet for the faceted browser than the one found in <skin-dir>/xslt/faceted_browser.xsl, then you can specify this in faceted navigation definition file. Your file might look something like this
<facetedNavigationDefinition xmlns="http://outerx.org/daisy/1.0#facetednavdef"> <stylesheet src="daisyskin:facetednav-styling/myfaceted_browser.xsl"/> <options> ...
Lets follow the example above. First create a directory in your skins directory with the name 'facetednav-styling'. Create a file with the name 'myfaceted_browser.xsl' in your freshly created directory. The contents of the file could be something like this
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d="http://outerx.org/daisy/1.0"
xmlns:p="http://outerx.org/daisy/1.0#publisher"
xmlns:n="http://outerx.org/daisy/1.0#navigation"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:daisyutil="xalan://org.outerj.daisy.frontend.util.XslUtil"
xmlns:urlencoder="xalan://java.net.URLEncoder">
<!-- Import the original stylesheet -->
<xsl:import href="daisyskin:xslt/faceted_browser.xsl"/>
<!-- The customization -->
<xsl:template name="content">
<h1>My own faceted browser</h1>
<div class="facetbrowser-resultcount"><xsl:value-of select="d:facetedQueryResult/d:searchResult/d:resultInfo/@size"/> document(s) found.</div>
<br/>
<xsl:call-template name="options"/>
<br/>
<br/>
<xsl:call-template name="results"/>
<xsl:call-template name="javascript"/>
</xsl:template>
</xsl:stylesheet>
In the simple example above the title on the faceted browser page was changed and the link to query page was removed. See how the original faceted browser styling was used as a base stylesheet. This stylesheet can be found here :
<daisy_home>/daisywiki/webapp/daisy/resources/skins/default/xslt/faceted_browser.xsl
Have a look in there to get an idea of what you can customize.
5.8.3.4 Defining discrete facets
If you fear that your facet has too many values to be displayed in an fashionable manner you can define discrete facets. These facets will place values in a series of ranges. There are 3 types of discrete facets :
-
STRING
Used for string type values. Words are sampled by the sequence of letters they have in common.
Properties : - This type accepts one property, threshold. This is the minimum amount of values for the facet before values start to be grouped. The amount of groups that will then be available are then maximum threshold+1 .
-
DATE
Used for date type values. The dates are sampled based on the specified spread.
Properties : - threshold (same as above)
- spread. How the ranges are spread out. Ranges are spread out on a logarithmic scale. This property allows specification of the magnitude of the spread. By default this is a magnitude of 1.0 which is a linear spread.
-
NUMBER
Used for number types.
Properties : - threshold (same as above)
- spread (same as above)
When you use the type attribute you tell Daisy that values from this facet
can be discrete.
Here is an example :
<facets>
<!-- A date discrete facet with a parabolic spread. -->
<facet expression="$SomeDate" type="DATE" threshold="7" spread="2.0">
<properties>
<property name="threshold" value="7"/>
<property name="spread" value="2.0"/>
</properties>
</facet>
<!-- Number discrete facet with a linear spread -->
<facet expression="$SomeNumber" type="NUMBER">
<properties>
<property name="threshold" value="7"/>
</properties>
</facet>
<facet expression="$SomeString" type="STRING">
<properties>
<property name="threshold" value="7"/>
</properties>
</facet>
</facets>
Previous