Re: [Dspace-tech] How to add last updated : mm-dd-aaaa date
So, it turns out to be pretty simple when you know what you're doing: 1) Add confman namespace and confman to exclude-result-prefixes. xsl:stylesheet ... xmlns:confman=org.dspace.core.ConfigurationManager exclude-result-prefixes=... confman 2) Add this simple template to process Solr result. More complex date formatting can be done easily in XSLT 2.0 http://www.w3.org/TR/xslt20/#format-date, however Cocoon still uses XSLT 1.0. It is currently also possible to call Java functions to do date formatting. xsl:template match=/response/result/doc/date mode=lastItem Last item was imported: xsl:value-of select=substring(text(), 1, 10)/ /xsl:template 3) Add the following code to the place where you want the resulting text to appear: xsl:variable name=solr-search-url select=confman:getProperty('discovery', 'search.server')/ xsl:apply-templates select=document(concat($solr-search-url, '/select?q=search.resourcetype:2amp;sort=dc.date.accessioned_dt%20descamp;rows=1amp;fl=dc.date.accessioned_dtamp;omitHeader=true')) mode=lastItem/ For example, to add it after the list of Recent items in Mirage, override its template like this: xsl:template match=dri:referenceSet[@type = 'summaryList' and @n='site-last-submitted'] priority=2 xsl:apply-templates select=dri:head/ !-- Here we decide whether we have a hierarchical list or a flat one -- xsl:choose xsl:when test=descendant-or-self::dri:referenceSet/@rend='hierarchy' or ancestor::dri:referenceSet/@rend='hierarchy' ul xsl:apply-templates select=*[not(name()='head')] mode=summaryList/ /ul /xsl:when xsl:otherwise ul class=ds-artifact-list xsl:apply-templates select=*[not(name()='head')] mode=summaryList/ /ul /xsl:otherwise /xsl:choose xsl:variable name=solr-search-url select=confman:getProperty('discovery', 'search.server')/ xsl:apply-templates select=document(concat($solr-search-url, '/select?q=search.resourcetype:2amp;sort=dc.date.accessioned_dt%20descamp;rows=1amp;fl=dc.date.accessioned_dtamp;omitHeader=true')) mode=lastItem/ /xsl:template Just remember that this requires Discovery. I tested it in DSpace 1.8, it may work in 1.7, too. While experimenting with this I also prepared a short DSpace Solr tutorial with examples. Hopefully, the page should appear here later today (someone has to create it for me first, I don't have the right): https://wiki.duraspace.org/display/DSPACE/Solr Regards, ~~helix84 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech
Re: [Dspace-tech] How to add last updated : mm-dd-aaaa date
On Thu, May 31, 2012 at 11:18 PM, Andrea Schweer schw...@waikato.ac.nz wrote: That is so cool -- thanks heaps for finding this out and documenting it, I had no idea this is possible! Thanks for the positive feedback. If you'll do something useful with it, don't forget to add your own applications as examples. Are you planning to add the XSLT snippets that you posted to the list to the wiki page too? I've actually been wondering for a little while now whether we should have some sort of XSLT snippets collection to capture all these little theme tweaks. Maybe in the DSpace Knowledge Base (though I always get confused by its structure)? What do you think? It seemed suitable to include it as an example of calling Solr from XMLUI, so I added it now and also enhanced the page a little. Regarding a more general XMLUI cookbook, it would surely be useful, a lot of specific questions get asked here. I may look into it When There's Time(TM). Regards, ~~helix84 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech
[Dspace-tech] How to add last updated : mm-dd-aaaa date
Hei all, Does anybody know how to add information in the home page like last modified or last updated date, using xsl or xml available facility features ? It should be useful to grab a system date anywhere. But in which way? Note that we have Dspace 1.7.0 Manakin (xmlui) release. Thanks a lot for any help. Bernard Torreilles INIST-CNRS -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech
Re: [Dspace-tech] How to add last updated : mm-dd-aaaa date
On Wed, May 30, 2012 at 1:17 PM, TORREILLES, Bernard bernard.torreil...@inist.fr wrote: Hei all, Does anybody know how to add information in the home page like last modified or last updated date, using xsl or xml available facility features ? It should be useful to grab a system date anywhere. But in which way? Note that we have Dspace 1.7.0 Manakin (xmlui) release. Thanks a lot for any help. Hi Bernard, I was actually thinking of doing the same thing in my repository. This information should be available via SOLR, which returns an XML document. This result in XML can be easily parsed by XSLT and the date displayed. But I have very little experience writing SOLR queries. If someone else on the list can help with that, I'll be happy to provide a complete solution. Regards, ~~helix84 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech