I am using XMLUI (Mirage) on DSpace 6.2 and am trying to insert the "Most Downloaded Items" into the home page.
I have figured out the SOLR query for this, namely (in page-structure.xsl):
<xsl:variable name="statsURL">
<xsl:text>http://localhost/solr/statistics</xsl:text>
</xsl:variable>
<xsl:apply-templates select="document(concat($statsURL,'/select?q=type:0+-isBot:true+statistics_type:view&wt=xml&indent=true&facet=true&facet.field=id&facet.sort=count&facet.limit=10'))" mode="mostdownloaded"/>
This query returns an xml document:
<response>
+<result name="response" numFound="8" start="0"></result>
-<lst name="facet_counts">
<lst name="facet_queries"/>
-<lst name="facet_fields">
-<lst name="id">
<int name="49b63c98-122c-40d4-9181-2ad4db8853c9">8</int>
<int name="061c72a0-3edc-4e17-8f33-4e7f6ce4573a">0</int>
<int name="0e124f85-4636-4eb5-85cb-2e4afd3e3ed0">0</int>
<int name="19095190-9074-4a4a-bb59-abcb539c8c38">0</int>
<int name="1e5350e0-83d9-4f26-bd76-e5d660254ee6">0</int>
<int name="432038ee-a7d7-4c69-80c1-02641e105286">0</int>
<int name="6b70eeea-be33-4489-8370-189ef041ba93">0</int>
<int name="9a8cd24e-3d88-43fc-8e92-b4e2c6142fbc">0</int>
<int name="bba37b59-7edc-453c-87d2-4039e432217b">0</int>
<int name="cc78e683-9563-49df-b5cf-35d506b4a27d">0</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
<lst name="facet_intervals"/>
</lst>
</response>
I then match this to a template as in:
<xsl:template match="/response/lst/lst/lst/int" mode="most-downloaded">
<div class="most_downloaded">
<xsl:value-of select="./@name"/>
</div>
<div class="downloaded_count">
<xsl:value-of select="text()"/>
</div>
</xsl:template>
I expect to see 8 divs of class "most_downloaded", each containing the id of the item, interspersed with another 8 divs of class "downloaded_count" containing the actual value. I do see these divs, but above them, I get a dump of all of the XML text nodes. I think that this is happening due to my poor understanding of template matching.
My questions are:
i) Is my query to get the list of most downloaded items correct? I have tried to test this but did not receive positive results.
ii) What is the correct way to match the template? /response/lst/lst/lst/int just sounds wrong.
iii) How can I use the id (which I believe is the item uuid in the database) to get the mets.xml data via cocoon?
iv) Is there an easier way to do all of this?
Thanks for any help.