source: main/trunk/greenstone3/web/interfaces/default/transform/query-common.xsl@ 26277

Last change on this file since 26277 was 26277, checked in by sjm84, 12 years ago

When text query only has one index we don't need to display it

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1<xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:java="http://xml.apache.org/xslt/java"
4 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
5 xmlns:gslib="http://www.greenstone.org/skinning"
6 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <xsl:template match="param" mode="calculate-default">
10 <xsl:param name="ns">s1.</xsl:param>
11 <xsl:variable name="pname"><xsl:value-of select="$ns"/><xsl:value-of select="@name"/></xsl:variable>
12 <xsl:choose>
13 <xsl:when test="/page/pageRequest/paramList/param[@name=$pname]">
14 <xsl:choose>
15 <xsl:when test="@type='enum_multi'"><xsl:text>,</xsl:text>
16 <xsl:for-each select="/page/pageRequest/paramList/param[@name=$pname]">
17 <xsl:value-of select="@value"/>,
18 </xsl:for-each>
19 </xsl:when>
20 <xsl:otherwise>
21 <xsl:value-of select="/page/pageRequest/paramList/param[@name=$pname]/@value"/>
22 </xsl:otherwise>
23 </xsl:choose>
24 </xsl:when>
25 <xsl:otherwise>
26 <xsl:value-of select="@default"/>
27 </xsl:otherwise>
28 </xsl:choose>
29 </xsl:template>
30
31 <!-- single selection enum params -->
32 <xsl:template match="param[@type='enum_single']">
33 <xsl:param name="ns">s1.</xsl:param>
34 <xsl:param name="hideEmpty">false</xsl:param>
35 <xsl:param name="default"/>
36 <xsl:choose>
37 <xsl:when test="count(option) = 1">
38 <xsl:if test="$hideEmpty = 'false'">
39 <xsl:value-of select="option/displayItem[@name='name']"/>
40 </xsl:if>
41 <input type='hidden' name='{$ns}{@name}'><xsl:attribute name='value'><xsl:value-of select='option/@name'/></xsl:attribute></input>
42 </xsl:when>
43 <xsl:otherwise>
44 <select name="{$ns}{@name}">
45 <xsl:for-each select="option">
46 <option value="{@name}"><xsl:if test="@name=$default"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
47 </xsl:for-each>
48 </select>
49 </xsl:otherwise>
50 </xsl:choose>
51 </xsl:template>
52
53 <xsl:template match="param[@type='string']">
54 <xsl:param name="ns">s1.</xsl:param>
55 <xsl:param name="default"/>
56 <input type="text" name="{$ns}{@name}" size="30" value="{$default}"/>
57 </xsl:template>
58</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.