source: other-projects/trunk/gs3-webservices-democlient/src/GSearchInstaller/demoBrowseIndexToHtml.xslt@ 15736

Last change on this file since 15736 was 15736, checked in by ak19, 16 years ago

GSearchInstaller.jar executable, src code, docs

  • Property svn:executable set to *
File size: 5.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5<!-- This xslt stylesheet presents a browseIndex page.
6-->
7 <xsl:output method="html" indent="yes" encoding="UTF-8"/>
8
9 <xsl:param name="ERRORMESSAGE" select="''"/>
10
11 <xsl:variable name="FIELDNAME" select="/resultPage/browseIndex/@fieldName"/>
12 <xsl:variable name="INDEXNAME" select="/resultPage/@indexName"/>
13 <xsl:variable name="STARTTERM" select="/resultPage/browseIndex/@startTerm"/>
14 <xsl:variable name="TERMPAGESIZE" select="/resultPage/browseIndex/@termPageSize"/>
15 <xsl:variable name="TERMTOTAL" select="/resultPage/browseIndex/@termTotal"/>
16 <xsl:variable name="PAGELASTNO" select="/resultPage/browseIndex/terms/term[position()=last()]/@no"/>
17 <xsl:variable name="PAGELASTTERM" select="/resultPage/browseIndex/terms/term[position()=last()]/text()"/>
18
19 <xsl:include href="WEBSERVERPATH/webapps/fedoragsearch/WEB-INF/classes/config/rest/demoCommon.xslt"/>
20
21 <xsl:variable name="EQCHAR">
22 <xsl:choose>
23 <xsl:when test="$INDEXNAME = 'DemoOnZebra'">=</xsl:when>
24 <xsl:otherwise>:</xsl:otherwise>
25 </xsl:choose>
26 </xsl:variable>
27
28 <xsl:template name="opSpecifics">
29
30 <h2>browseIndex</h2>
31 <form method="get" action="rest">
32 <table border="3" cellpadding="5" cellspacing="0">
33 <tr>
34 <td>
35 <input type="hidden" name="operation" value="browseIndex"/>
36 Start term: <input type="text" name="startTerm" size="30" value="{$STARTTERM}"/>
37 Field name: <select name="fieldName">
38 <xsl:apply-templates select="browseIndex/fields"/>
39 </select>
40 <xsl:text> </xsl:text>Term page size: <input type="text" name="termPageSize" size="4" value="{$TERMPAGESIZE}"/>
41 <xsl:text> </xsl:text><input type="submit" value="Browse"/>
42 </td>
43 </tr>
44 <tr>
45 <td>
46 <xsl:text> </xsl:text>Index name:
47 <select name="indexName">
48 <xsl:choose>
49 <xsl:when test="$INDEXNAME='INDEX_NAME'">
50 <option value="INDEX_NAME" selected="true">INDEX_NAME</option>
51 </xsl:when>
52 <xsl:otherwise>
53 <option value="INDEX_NAME" selected="true">INDEX_NAME</option>
54 </xsl:otherwise>
55 </xsl:choose>
56 </select>
57 <xsl:text> </xsl:text>restXslt:
58 <select name="restXslt">
59 <option value="demoBrowseIndexToHtml">demoBrowseIndexToHtml</option>
60 <option value="copyXml">no transformation</option>
61 </select>
62 <xsl:text> </xsl:text>resultPageXslt:
63 <select name="resultPageXslt">
64 <option value="browseIndexToResultPage">browseIndexToResultPage</option>
65 <option value="copyXml">no transformation</option>
66 </select>
67 <xsl:text> </xsl:text>
68 </td>
69 </tr>
70 </table>
71 </form>
72 <p/>
73 <xsl:if test="$TERMTOTAL = 0 and $STARTTERM and $STARTTERM != '' ">
74 <p>No terms!</p>
75 </xsl:if>
76 <xsl:if test="$TERMTOTAL > 0">
77 <table border="0" cellpadding="5" cellspacing="0">
78 <tr>
79 <xsl:if test="99999999 > $TERMTOTAL">
80 <td><xsl:value-of select="$TERMTOTAL"/> terms found.
81 </td>
82 </xsl:if>
83 <xsl:if test="$PAGELASTNO='' or $PAGELASTNO=' ' or $TERMTOTAL > $PAGELASTNO">
84 <td>
85 <form method="get" action="rest">
86 <input type="hidden" name="operation" value="browseIndex"/>
87 <input type="hidden" name="fieldName" value="{$FIELDNAME}"/>
88 <input type="hidden" name="indexName" value="{$INDEXNAME}"/>
89 <input type="hidden" name="startTerm" value="{$PAGELASTTERM}"/>
90 <input type="hidden" name="termPageSize" value="{$TERMPAGESIZE}"/>
91 <input type="submit" value="Next term page"/>
92 </form>
93 </td>
94 </xsl:if>
95 </tr>
96 </table>
97 <table border="3" cellpadding="5" cellspacing="0" bgcolor="silver">
98 <xsl:apply-templates select="browseIndex/terms"/>
99 </table>
100 </xsl:if>
101 </xsl:template>
102
103 <xsl:template match="field">
104 <xsl:variable name="THISFIELDNAME" select="text()"/>
105 <xsl:choose>
106 <xsl:when test="$FIELDNAME=$THISFIELDNAME">
107 <option selected="true">
108 <xsl:attribute name="value">
109 <xsl:value-of select="$THISFIELDNAME"/>
110 </xsl:attribute>
111 <xsl:value-of select="$THISFIELDNAME"/>
112 </option>
113 </xsl:when>
114 <xsl:otherwise>
115 <option>
116 <xsl:attribute name="value">
117 <xsl:value-of select="$THISFIELDNAME"/>
118 </xsl:attribute>
119 <xsl:value-of select="$THISFIELDNAME"/>
120 </option>
121 </xsl:otherwise>
122 </xsl:choose>
123 </xsl:template>
124
125 <xsl:template match="term">
126 <tr>
127 <td>
128 <xsl:value-of select="@no"/>.
129 <a>
130 <xsl:variable name="TERM" select="text()"/>
131 <xsl:variable name="QUERYSTRING" select="concat('?operation=gfindObjects', '&amp;', 'indexName=', $INDEXNAME, '&amp;', 'query=', $FIELDNAME, $EQCHAR, '&#034;', $TERM, '&#034;')"/>
132 <xsl:attribute name="href"><xsl:value-of select="$QUERYSTRING"/>
133 </xsl:attribute>
134 <xsl:value-of select="$TERM"/>
135 [<xsl:value-of select="@fieldtermhittotal"/>]
136 </a>
137 </td>
138 </tr>
139 </xsl:template>
140
141</xsl:stylesheet>
142
143
144
145
146
147
148
149
150
151
Note: See TracBrowser for help on using the repository browser.