• HCMC Blogs
  • Moses
  • Maint
  • Mariage
  • Admin
  • Academic
  • Depts
  • ScanCan
  • HumsSites
  • Projects
  • Pro-D
  • ColDesp
  • CanMys
  • LondonMap
  • AdaptiveDB
  • MoM
  • Cascade
  • Landscapes
  • Linguistics
  • CGWP
  • Endings
  • LEMDO
  • DVPP
  • Wendat
  • Announcements

Contact Us on 0800 123 4567 or info@example.com

MyNDIR

  • Front Page
  • Contact
  • Log in
  • « finished vignettes in SKng
  • progress updating »

Keyword menu now working

Posted by mholmes on 26 May 2010 in Activity log

These were my steps for getting a keyword menu working:

  1. Wrote a Java class to create a custom collator, reproduced here in full:
    package ca.uvic.hcmc.myndir;
    
    import java.text.ParseException;
    import java.text.RuleBasedCollator;
    
    public class MyndirCollation extends RuleBasedCollator
    {
      public MyndirCollation() throws ParseException
      {
        super(myndirRules);
      }
    
      //This is the order we need:
      //AÁBCDÐEÉFGHIÍJKLMNOÓPQRSTUÚVWXYÝZÞÆÖ
    
      private static String ucAAcute = new String("\u00C1");
      private static String lcAAcute = new String("\u00E1");
    
      private static String ucEth = new String("\u00D0");
      private static String lcEth = new String("\u00F0");
    
      private static String ucEAcute = new String("\u00C9");
      private static String lcEAcute = new String("\u00E9");
    
      private static String ucIAcute = new String("\u00CD");
      private static String lcIAcute = new String("\u00ED");
    
      private static String ucOAcute = new String("\u00D3");
      private static String lcOAcute = new String("\u00F3");
    
      private static String ucUAcute = new String("\u00DA");
      private static String lcUAcute = new String("\u00FA");
    
      private static String ucYAcute = new String("\u00DD");
      private static String lcYAcute = new String("\u00FD");
    
      private static String ucThorn = new String("\u00DE");
      private static String lcThorn = new String("\u00FE");
    
      private static String ucAsh = new String("\u00C6");
      private static String lcAsh = new String("\u00E6");
    
      private static String ucOUml = new String("\u00D6");
      private static String lcOUml = new String("\u00F6");
      
      //This is the order we need:
      //AÁBCDÐEÉFGHIÍJKLMNOÓPQRSTUÚVWXYÝZÞÆÖ
    
      private static String myndirRules =
        ("< a,A < " + lcAAcute + "," + ucAAcute + " " + 
         "< b,B < c,C < d,D < " + lcEth + "," + ucEth + " " +
         "< e,E < " + lcEAcute + "," + ucEAcute + " " +
         "< f,F < g,G < h,H < i,I < " + lcIAcute + "," + ucIAcute + " " +
         "< j,J < k,K < l,L < m,M < n,N < o,O < " + lcOAcute + "," + ucOAcute + " " +
         "< p,P < q,Q < r,R < s,S < t,T < u,U < " + lcUAcute + "," + ucUAcute + " " +
         "< v,V < w,W < x,X < y,Y < " + lcYAcute + "," + ucYAcute + " " +
         "< z,Z < " + lcThorn + "," + ucThorn + " < " + lcAsh + "," + ucAsh + " " +
         "< " + lcOUml + "," + ucOUml);
    }
    
    This is based on this explanation, and it worked first time, out of the box. Used NetBeans to create it.
  2. Added it into WEB-INF/lib in Cocoon.
  3. Created a new XQuery function to pull out all the relevant items from names.xml and include them in the output to the main page rendering code.
  4. Wrote a new XSLT library to create the drop-down menu, using the custom collation like this:
     <xsl:sort collation="http://saxon.sf.net/collation?class=ca.uvic.hcmc.myndir.MyndirCollation"/>
    
  5. Set up the menu CSS so that it works with mouseovers. Since we have a search box into which you can type any of these items as well, I don't know whether we need keyboard access to this menu; that might be overkill. But I'll think about it.
  6. Tested and uploaded.
This entry was posted by Martin and filed under Activity log.

MyNDIR

  • Home
  • Recently
  • Archives
  • Categories
  • Latest comments

Search

Categories

  • All
  • Activity log
  • Tasks

XML Feeds

  • RSS 2.0: Posts
  • Atom: Posts
What is RSS?

Recent Posts

  • Finding an obscure issue
  • First steps in generating HTML5
  • Standalone XML now building; code reorganized
  • Jenkins job set up; schema and validation build reworked
  • PAB moved to svn
  • Beginning Endings work
  • Meeting, confirmation of plan
  • Project plan, Endings-style
  • Tweaks to captions
  • Finished diagnostics, sent results

Sidebar 2

This is the "Sidebar 2" container. You can place any widget you like in here. In the evo toolbar at the top of this page, select "Customize", then "Blog Widgets".

This collection ©2026 by admin • Help • Advanced CMS