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="default"/>
|
---|
35 | <xsl:choose>
|
---|
36 | <xsl:when test="count(option) = 1">
|
---|
37 | <xsl:value-of select="option/displayItem[@name='name']"/>
|
---|
38 | <input type='hidden' name='{$ns}{@name}'><xsl:attribute name='value'><xsl:value-of select='option/@name'/></xsl:attribute></input>
|
---|
39 | </xsl:when>
|
---|
40 | <xsl:otherwise>
|
---|
41 | <select name="{$ns}{@name}">
|
---|
42 | <xsl:for-each select="option">
|
---|
43 | <option value="{@name}"><xsl:if test="@name=$default"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
|
---|
44 | </xsl:for-each>
|
---|
45 | </select>
|
---|
46 | </xsl:otherwise>
|
---|
47 | </xsl:choose>
|
---|
48 | </xsl:template>
|
---|
49 |
|
---|
50 | <xsl:template match="param[@type='string']">
|
---|
51 | <xsl:param name="ns">s1.</xsl:param>
|
---|
52 | <xsl:param name="default"/>
|
---|
53 | <input type="text" name="{$ns}{@name}" size="30" value="{$default}"/>
|
---|
54 | </xsl:template>
|
---|
55 | </xsl:stylesheet> |
---|