1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
xmlns:http="http://expath.org/ns/http-client" version="2.0">
|
4
|
|
5
|
|
6
|
<xsl:param name="query"/>
|
7
|
|
8
|
<!-- pass this in as a parameter? -->
|
9
|
<!--xsl:variable name="url_taxon">/taxon/findTaxaAndNames</xsl:variable-->
|
10
|
<xsl:variable name="url_taxon">../taxon/findByTitle</xsl:variable>
|
11
|
<xsl:variable name="url_webservice">../name/findTitleCache</xsl:variable>
|
12
|
<xsl:param name="matchMode"/>
|
13
|
<xsl:param name="url"/>
|
14
|
|
15
|
<xsl:variable name="vReps" select="document('')/xsl:param[@name='matchMode']"/>
|
16
|
|
17
|
<xsl:template match="/DefaultPagerImpl">
|
18
|
<HTML>
|
19
|
<HEAD>
|
20
|
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"/>
|
21
|
</HEAD>
|
22
|
<BODY>
|
23
|
|
24
|
<script type="text/javascript" language="javascript">
|
25
|
// Parse URL Queries Method
|
26
|
(function($){
|
27
|
$.getQuery = function( query ) {
|
28
|
query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
29
|
var expr = "[\\?&]"+query+"=([^&#]*)";
|
30
|
var regex = new RegExp( expr );
|
31
|
var results = regex.exec( window.location.href );
|
32
|
if( results !== null ) {
|
33
|
return results[1];
|
34
|
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
35
|
} else {
|
36
|
return false;
|
37
|
}
|
38
|
};
|
39
|
})(jQuery);
|
40
|
|
41
|
// Document load
|
42
|
$(document).ready(function() {
|
43
|
|
44
|
//$('#content').append('Showing page ' + parseInt($.getQuery('pageNumber') + 1) + ':');
|
45
|
var test_query = $.getQuery('query');
|
46
|
|
47
|
$('.source-url').each(function(index) {
|
48
|
//alert(test_query);
|
49
|
//$('#content').append(test_query);
|
50
|
var displayPage = parseInt($(this).attr('ref')) + 1;
|
51
|
|
52
|
$(this).html('<a href="../name/findTitleCache?query=' + test_query + '&matchMode=BEGINNING&pageNumber=' + $(this).attr('ref') + '">' + displayPage + '</a>');
|
53
|
|
54
|
});
|
55
|
});
|
56
|
|
57
|
</script>
|
58
|
|
59
|
<table cellpadding="1" width="100%">
|
60
|
<tr>
|
61
|
|
62
|
<td width="5%"/>
|
63
|
<td valign="top">
|
64
|
|
65
|
<h2>Names search</h2>
|
66
|
<strong>
|
67
|
<xsl:value-of select="$vReps"/>
|
68
|
</strong>
|
69
|
<BR></BR>
|
70
|
<H3>Search results:</H3>
|
71
|
<p><strong><xsl:value-of select="count"/></strong> unique names found.
|
72
|
Click on name for details of source.</p>
|
73
|
<TD><div id="content"> </div></TD>
|
74
|
<BR></BR>
|
75
|
|
76
|
<TABLE border="0">
|
77
|
<xsl:for-each select="records/e">
|
78
|
|
79
|
<TR>
|
80
|
<TD> </TD>
|
81
|
<TD>
|
82
|
<a>
|
83
|
<xsl:variable name="titleCacheString">
|
84
|
<xsl:value-of select="."/>
|
85
|
</xsl:variable>
|
86
|
|
87
|
<xsl:variable name="query_string">
|
88
|
<xsl:value-of
|
89
|
select="substring-before($titleCacheString,'sec')"/>
|
90
|
</xsl:variable>
|
91
|
|
92
|
<xsl:variable name="genus">
|
93
|
<xsl:value-of
|
94
|
select="substring-before($titleCacheString,' ')"/>
|
95
|
</xsl:variable>
|
96
|
<xsl:variable name="specificEpithet">
|
97
|
<xsl:value-of
|
98
|
select="substring-before(normalize-space(substring-after($titleCacheString, $genus)),' ')"
|
99
|
/>
|
100
|
</xsl:variable>
|
101
|
|
102
|
|
103
|
<!--xsl:variable name="query_string_taxon"
|
104
|
><xsl:value-of select="$url_taxon"
|
105
|
/>?query=<xsl:value-of select="$genus"
|
106
|
/>%20<xsl:value-of select="$specificEpithet"
|
107
|
/>&matchMode=BEGINNING&doSynonyms=1</xsl:variable-->
|
108
|
|
109
|
<xsl:variable name="query_string_taxon"
|
110
|
><xsl:value-of select="$url_taxon"
|
111
|
/>?query=<xsl:value-of select="$titleCacheString"
|
112
|
/>&matchMode=BEGINNING&doSynonyms=1</xsl:variable>
|
113
|
|
114
|
|
115
|
<xsl:attribute name="href">
|
116
|
<!--xsl:value-of select="$url_local"/>name/<xsl:value-of select="../uuid"/-->
|
117
|
<xsl:value-of select="$query_string_taxon"/>
|
118
|
</xsl:attribute>
|
119
|
<xsl:apply-templates select="."/>
|
120
|
</a>
|
121
|
</TD>
|
122
|
</TR>
|
123
|
</xsl:for-each>
|
124
|
<TR>
|
125
|
<TD/>
|
126
|
<TD>
|
127
|
<!--xsl:apply-templates select="pagesAvailable"/-->
|
128
|
<!--xsl:variable name="NumberpagesAvailable"><xsl:value-of select="pagesAvailable"/>
|
129
|
</xsl:variable>
|
130
|
<xsl:call-template name="pagesAvailable">
|
131
|
<xsl:with-param name="index" select="$NumberpagesAvailable"/>
|
132
|
|
133
|
</xsl:call-template-->
|
134
|
<xsl:apply-templates select="indices"/>
|
135
|
</TD>
|
136
|
|
137
|
</TR>
|
138
|
</TABLE>
|
139
|
|
140
|
</td>
|
141
|
</tr>
|
142
|
</table>
|
143
|
</BODY>
|
144
|
</HTML>
|
145
|
</xsl:template>
|
146
|
|
147
|
<!-- show page links with parameters -->
|
148
|
<xsl:template match="pagesAvailableold">
|
149
|
<xsl:variable name="pagesAvailable"><xsl:value-of select="."/></xsl:variable>
|
150
|
<xsl:variable name="currenctIndex"><xsl:value-of select="../currentIndex"/></xsl:variable>
|
151
|
<xsl:variable name="prevIndex"><xsl:value-of select="../prevIndex"/></xsl:variable>
|
152
|
<xsl:apply-templates select="pagesAvailable"/>
|
153
|
<a href="defaultPagertest.xml">Previous</a>  <a
|
154
|
href="http://160.45.63.151:8080/cichorieae/portal/taxon/find.xml?">Next</a>
|
155
|
</xsl:template>
|
156
|
|
157
|
<xsl:template match="indices">
|
158
|
|
159
|
<!--xsl:variable name="query_string"><xsl:value-of select="$url_webservice"/>?query=Lapsana&matchMode=ANYWHERE</xsl:variable-->
|
160
|
<table>
|
161
|
<tr>
|
162
|
|
163
|
<xsl:variable name="query_string"><xsl:value-of select="$url_webservice"/>?query=&matchMode=matchMode=BEGINNING</xsl:variable>
|
164
|
<!--pass in query strong instead of lapsana
|
165
|
only show next and previous if the pages exist-->
|
166
|
|
167
|
<!--a href="{$query_string}&pageNumber=0">First</a>   -->
|
168
|
|
169
|
<!-- If there is more than one page show links to other pages -->
|
170
|
<xsl:if test="count(e) > 1">
|
171
|
<xsl:for-each select="e">
|
172
|
<xsl:variable name="page_number"><xsl:value-of select="."/></xsl:variable>
|
173
|
|
174
|
<TD class="source-url" ref="{$page_number}">
|
175
|
</TD>
|
176
|
|
177
|
</xsl:for-each>
|
178
|
</xsl:if>
|
179
|
|
180
|
</tr>
|
181
|
</table>
|
182
|
</xsl:template>
|
183
|
|
184
|
|
185
|
|
186
|
<!--xsl:template name="pagesAvailable">
|
187
|
<xsl:param name="index" select="1"/>
|
188
|
<xsl:if test="$index > 0">
|
189
|
<xsl:value-of select="../currentIndex"/>
|
190
|
<xsl:value-of select="$index"/>
|
191
|
<xsl:text>.</xsl:text>
|
192
|
<xsl:call-template name="pagesAvailable">
|
193
|
<xsl:with-param name="index" select="$index - 1"/>
|
194
|
</xsl:call-template>
|
195
|
</xsl:if>
|
196
|
</xsl:template-->
|
197
|
|
198
|
</xsl:stylesheet>
|