Index: trunk/gsdl/collect/demo/etc/mags.txt
===================================================================
--- trunk/gsdl/collect/demo/etc/mags.txt	(revision 679)
+++ trunk/gsdl/collect/demo/etc/mags.txt	(revision 679)
@@ -0,0 +1,15 @@
+CERES                                                              1  CERES
+"Food and Nutrition Bulletin"                                      2  "Food and Nutrition Bulletin"
+"The Courier"                                                      3  "The Courier"
+"SPORE Bulletin"                                                   4  "SPORE Bulletin"
+"Boiling Point"                                                    5  "Boiling Point"
+"Developing Ideas"                                                 6  "Developing Ideas"
+"GATE Magazine"                                                    7  "GATE Magazine"
+"Go Between"                                                       8  "Go Between"
+"Basin - News"                                                     9  "Basin - News"
+"HDD-(PHN)FLASH, newsletter on Population, Health and Nutrition"  10  "HDD-(PHN)FLASH, newsletter on Population, Health and Nutrition"
+"IDRC Reports"                                                    11  "IDRC Reports"
+"New and Noteworthy in Nutrition"                                 12  "New and Noteworthy in Nutrition"
+Seedling                                                          13  Seedling
+"Soft Energy Worldwide"                                           14  "Soft Energy Worldwide"
+"Sustainable energy News"                                         15  "Sustainable energy News"
Index: trunk/gsdl/collect/demo/etc/org.txt
===================================================================
--- trunk/gsdl/collect/demo/etc/org.txt	(revision 679)
+++ trunk/gsdl/collect/demo/etc/org.txt	(revision 679)
@@ -0,0 +1,60 @@
+accu	1	ACCU
+ag21	2	"Agenda 21"
+bgz	3	"BASIN - GTZ - SKAT"
+bostid	4	BOSTID
+cps	5	CPS
+cpas	6	"CTA Spore"
+cf	7	"Commonwealth Foundation"
+csu	8	"Computer Science Unplugged"
+dcs	9	"Development Consultancy Services"
+1echo	0	E.C.H.O
+ecc	11	"EC Courier"
+ecdg8	12	"EC DG8"
+echo	13	"Educational Concerns for Hunger Organization"
+fao	14	FAO
+faobfs	15	"FAO Better Farming series"
+ceres	16	"FAO Ceres"
+ff	17	"Food First"
+ghp	18	GHP
+grain	19	GRAIN
+gret	20	GRET
+gtz	21	GTZ
+gate	22	"GTZ GATE Magazine"
+habitat	23	Habitat
+idrc	24	IDRC
+iisd	25	IISD
+irma	26	IRMA
+bp	27	"ITDG Boiling Point"
+itdg	28	"ITDG Food Chain"
+iis	29	"Indian Institute of Sciences"
+chandra	30	"Individual Contributor Chandrakant"
+alkire	31	"Individual Contributor S. Alkire"
+inforse	32	Inforse
+iirr	33	"International Institute for Rural Reconstruction (IIRR)"
+msf	34	MSF
+ngls	35	NGLS
+norad	36	NORAD
+nri	37	NRI
+nsc	38	"North South Centre"
+op	39	"Orbi Pharma"
+oxfam	40	Oxfam
+pace	41	PACE
+paho	42	PAHO
+pc	43	"Peace Corps"
+pelum	44	Pelum
+sida	45	SIDA
+skat	46	SKAT
+tool	47	Tool
+un	48	UN
+unesco	49	UNESCO
+unicef	50	UNICEF
+fnb	51	"UNU Food and Nutrition Bulletin"
+unu	52	"UNU United Nations University"
+vso	53	VSO
+who	54	WHO
+wwf	55	WWF
+wwsf	56	WWSF
+wa	57	"Water Aid"
+winrock	58	Winrock
+ws	59	Workshop
+wb	60	"World Bank"
Index: trunk/gsdl/collect/demo/etc/sub.txt
===================================================================
--- trunk/gsdl/collect/demo/etc/sub.txt	(revision 679)
+++ trunk/gsdl/collect/demo/etc/sub.txt	(revision 679)
@@ -0,0 +1,245 @@
+1        1        "General reference"
+1.2      1.2      "Dictionaries, glossaries, language courses, terminology (all languages)"
+2        2        "Sustainable Development, International cooperation, Projects; NGO, Organizations, Poverty and Hunger Alleviation, Basic Human Needs"
+2.1      2.1      "Development policy and theory, international cooperation, national planning, national plans"
+2.2      2.2      "Development, national planning, national plans"
+2.3      2.3      "Project planning and evaluation (incl. project management and dissemination strategies)"
+2.4      2.4      "Regional development and planning incl. regional profiles"
+2.5      2.5      "Nongovernmental organizations (NGOs) in general, self- help organizations (their role in development). For specific organizations such as women's or peasants' see respective class within 06."
+2.6      2.6      "Organizations, institutions, United Nations (general, directories, yearbooks, annual reports, etc.)"
+2.6.1    2.6.1    "United Nations"
+2.6.2    2.6.2    "International organizations"
+2.6.3    2.6.3    "Regional organizations"
+2.6.5    2.6.5    "European Community - European Union"
+2.7      2.7      "Sustainable Development, Development models and examples; Best practices (general)"
+2.8      2.8      "Basic Human Needs"
+2.9      2.9      "Hunger and Poverty Alleviation"
+3        3        "Economics, Economic policies, Finance, Trade, Structural Adjustment"
+3.2      3.2      "Economic and social situation, economic policy, country reports (incl. national statistical yearbooks)"
+3.4      3.4      "Industrial economics, industrial development, foreign investment (incl. investment policy, investment promotion) incl.multinational corporations"
+3.6     3.6       "Trade and commerce, Export policy and reglementations"
+3.7     3.7       "Tourism (economic and social aspects)"
+3.8     3.8       "Labour economics"
+3.8.1   3.8.1     "Employment policy"
+3.10    3.10      "Structural Adjustment"
+4       4         "Business, Micro-entreprises, Management, Marketing, Finance, Microfinance, Cooperatives"
+4.1     4.1       "Business economics (general works, textbooks)"
+4.2     4.2       "Microeconomic planning techniques, Micro-entreprises"
+4.3     4.3       "Management and personnel management"
+4.4     4.4       "Business organization and administration, office management"
+4.5     4.5       "Marketing and commercialisation, export (from businesses viewpoint)"
+4.6     4.6       "Accounting"
+4.7     4.7       "Finance and microfinance / microcredit"
+4.8     4.8       "Cooperatives, cooperative movement"
+4.8.1   4.8.1     "Agricultural cooperatives"
+4.8.4   4.8.4     "Housing cooperatives"
+4.8.5   4.8.5     "Other specific cooperatives"
+5       5         "Politics, Public administration, Law and Legislation, Peace, Human Rights"
+5.2     5.2       "Public administration, Tasks of councillors"
+5.4     5.4       "Human rights, humanitarian law"
+5.4     5.5       "Disarmament, Peace, Conflict and Conflict Resolutions"
+6       6         "Society, Culture, Community, Woman, Youth, Population"
+6.1     6.1       "Social sciences, sociology (works comprising several subgroups) incl. participatory research and training"
+6.2     6.2       "Society, social structure, social change, social services, social movements, social groups, Minorities"
+6.3     6.3       "Community development, community organizing"
+6.4     6.4       "Women, gender and development, women's organizations"
+6.5     6.5       "Children and youth (youth centres)"
+6.6     6.6       "Demography and population"
+6.7     6.7       "Philosophy"
+6.8     6.8       "History, Cultural Heritage and Language"
+6.9     6.9       "Psychology"
+6.10    6.10      "Anthropology, ethnology"
+6.11    6.11      "Religion - Spirituality - Yoga"
+6.12    6.12      "Art, Literature, Creativity, Traditional Cultures, Fashion"
+7       7         "Education and Training"
+7.1     7.1       "Education and training (general works, theories, methods)"
+7.3     7.3       "Teaching methods and aids"
+7.4     7.4       "Adult education, Literacy training"
+7.5     7.5       "Early education, Primary education, Secondary education"
+7.6     7.6       "Specific courses or subjects, educational games"
+7.7     7.7       "Higher education"
+7.8     7.8       "Vocational, professional and practical training - for specific training- curricula, textbooks- see specific subject."
+7.9     7.9       "Health Education and Training (see under health and Nutrition)"
+7.10    7.10      "Environmental education, Global education, Psychological and assertiveness education, Non-formal education etc"
+7.11    7.11      "Language education"
+7.12    7.12      "Specialised education: see also under the subject"
+7.13    7.13      "Teacher Training"
+8       8         "Communication, Information and Documentation"
+8.1     8.1       "Communication, telecommunication, mass communication, mass media, film-making"
+8.2     8.2       "Information for development, Information transfer, Information policy"
+8.3     8.3       "Documentation, Library science and management, see also RAMP studies under 08.06"
+8.4     8.4       "Information technology, Computer science, Computer use, Use of computers for developing countries"
+8.5     8.5       "Internet, e-mail"
+8.6     8.6       "Records and Archives Management Programme (RAMP) of  UNESCO, Archive Management"
+9       9         "Transport"
+9.1     9.1       "Transport (rural and urban) (general works)"
+9.2     9.2       "Land transport"
+10      10        "Science, Research and Technology"
+10.1    10.1      "Natural science, technology, engineering, research and development, research methods and theory (general works, directories, encyclopedias)"
+10.2    10.2      "Transfer of technology and scientific cooperation"
+10.2.1  10.2.1    "Technology transfer and scientific cooperation for developing countries"
+10.3    10.3      "Appropriate/ Alternative/ Applied technology (AT), traditional, intermediate technology,  economic and social aspect, directories"
+10.8    10.8      "Biology"
+10.9    10.9      "Biotechnology, genetic engineering"
+10.10   10.10     "Medicine and Health : science and research"
+11      11        "Ecology, Biodiversity, Natural resources, Environment, Waste Disposal"
+11.1    11.1      "Natural resources, geography"
+11.1.1  11.1.1    "Climate, weather, meteorology . Climatologic Changes. Global warming"
+11.2    11.2      "Ecology, environmental policy, eco- development studies"
+11.3    11.3      "Resources conservation, environmental protection, biodiversity"
+11.3.1  11.3.1    "Arid zones, desertification"
+11.3.2  11.3.2    "Nature reserve, game reserve"
+11.3.3  11.3.3    "Rainforests and rainforest conservation"
+11.3.4  11.3.4    "Biodiversity conservation"
+11.4    11.4      "Erosion and erosion control - for techniques see agriculture and forestry."
+11.5    11.5      "Pollution, Pollution control, Pesticides, Biological monitoring, Asbestos"
+11.5.2  11.5.2    "Water pollution"
+11.5.4  11.5.4    "Pesticide pollution"
+11.5.5  11.5.5    "Asbestos"
+11.6    11.6      "Solid waste disposal"
+11.7    11.7      "Environmental Handbook of GTZ-BMZ"
+12      12        "Water, Sanitation and Sewage Disposal"
+12.1    12.1      "Water and sanitation, hydrology"
+12.2    12.2      "Water resources (surface water, groundwater)"
+12.3    12.3      "Hydraulic structures (dams, intakes, wells, ponds, cisterns)"
+12.4    12.4      "Pumps and other water- lifting devices"
+12.5    12.5      "Water supply and storage"
+12.6    12.6      "Water treatment and purification (biological, chemical, physical)"
+12.7    12.7      "Sanitation. Waste water and sewage disposal"
+13      13        "Health, Nutrition, Medicine"
+13.1    13.1      "Health (general works, incl. health economics and sociology, health statistics, health and community development)"
+13.1.1  13.1.1    "Health planning and policy"
+13.1.6  13.1.6    "Disasters, medicine in humanitarian emergencies"
+13.2    13.2      "Food, Nutrition and Malnutrition"
+13.3    13.3      "Family health,  Mother and Child care, Family planning, Pregnancy and Childbirth"
+13.4    13.4      "Community Health, Health Care Delivery, Extension workers and training"
+13.5    13.5      "Medicine, Clinical Care, Diseases, Hygiene, Emergencies (treatment of specific diseases, injuries, accidents)"
+13.6    13.6      "Health Education, Promotion, Prevention, AIDS Prevention, Safety, Books covering multiple health dimensions"
+13.7    13.7      "Production and use of medicines, essential drugs"
+13.7.1  13.7.1    "Pharmaceuticals and essential drugs"
+13.7.2  13.7.2"   "Herbal medicines, medicinal plants"
+13.8    13.8      "Health material and equipment; aids for disabled people"
+13.9    13.9      "Medical an nutrition research papers, medical and nutrition scientific studies, specialised tropical medicine publications"
+14      14        "Agriculture and Food Processing"
+14.1    14.1      "Agriculture (general works), Economics,  Policies, Development, Research, Management"
+14.1.1  14.1.1    "Land reform, Settlements, Rural Development and related topics"
+14.1.2  14.1.2    "Agricultural training and education"
+14.1.3  14.1.3    "Agricultural Science and Research"
+14.1.4  14.1.4    "Rural and Farm management"
+14.1.5  14.1.5    "Policies and Planning in agriculture"
+14.1.6  14.1.6    "Biotechnology and agriculture"
+14.1.7  14.1.7    "Agricultural finance systems"
+14.2    14.2      "Agricultural production systems (shifting cultivation, wet- land farming, dry- land farming, agroforestry), Sustainable Agriculture"
+14.3    14.3      "Organic farming, Eco-farming"
+14.4    14.4      "Agricultural implements, tools and machinery (incl. mechanization, agricultural transport) - for implements specific to particular plants see respective plant."
+14.5    14.5      "Soil and land management, improvement and treatment (incl. terracing, erosion control techniques, rangeland improvement)"
+14.6    14.6      "Irrigation and drainage - for hydraulic structures see 12.03."
+14.7    14.7      "Fertilization and composting"
+14.8    14.8      "Storage and packaging of agricultural products, Post-Harvest management"
+14.9    14.9      "Agricultural waste processing - for energy use see 20.06."
+14.10   14.10     "Food processing and preservation"
+14.10.2 14.10.2   "Food drying (all kinds)"
+14.10.3 14.10.3   "Fermented Foods"
+14.10.4 14.10.4   "Oil production and processing"
+14.12   14.12     "Better Farming series of FAO and INADES"
+15      15        "Plant and Crop Production, Protection, and Processing"
+15.1    15.1      "Plant/crop production and processing, vegetable gardening, botany (general works, publications comprising several plants and practical how to books, intercropping)"
+15.2    15.2      "Plant protection (incl. insecticidinal plants), Pests and Pest Control, Integrated Pest Management"
+15.4    15.4      "Cereals (rice, corn/maize, millet, sorghum, wheat, etc.)"
+15.5    15.5      "Starchy crops and root crops (cassava, potatoes, etc.)"
+15.6    15.6      "Oil- producing plants, vegetable oil, nuts"
+15.7    15.7      "Garden vegetables, legumes, mushrooms"
+15.8    15.8      "Fruits and wine (bananas, mango's, apple's etc)"
+15.10   15.10     "Coffee, Tea, Cocoa, Coca and other stimulants"
+15.12   15.12     "Rubber, resin, wax plants"
+15.14   15.14     "Fodder and pasture plants"
+15.15   15.15     "Other plants/crops, intercropping (for intercropping, see also under 15.01)"
+16      16        "Animal Husbandry and Animal Product Processing"
+16.1    16.1      "Animal husbandry (general,works) incl. animal feed, works covering several aspects and animals, zoology, see also other animals 6.11"
+16.2    16.2      "Veterinary medicine, animal diseases"
+16.3    16.3      "Animal traction (excl. implements), animal training"
+16.5    16.5      "Cattle"
+16.6    16.6      "Goats, sheep, camels"
+16.8    16.8      "Rabbits and guinea pigs"
+16.9    16.9      "Poultry, ducks and other birds"
+16.10   16.10     "Beekeeping and honey extraction"
+16.11   16.11     "Other animals (micro-livestock, little known animals, silkworms, reptiles, frogs, snails, game, etc.)"
+16.12   16.12     "Animal product processing - for processing of wool and silk see 19.08 - for processing of leather see 19.09"
+16.12.2 16.12.2   "Milk and egg processing (dairy, cheese)"
+17      17        "Fishery and Aquaculture"
+17.1    17.1      "Fishery and aquaculture (general works), fishery resources"
+17.2    17.2      "Fishing techniques and equipment"
+17.3    17.3      "Aquaculture, fish farming, fish production (fish ponds, feeding, etc.)"
+17.6    17.6      "Fishery product processing, storage, and marketing"
+18      18        "Forestry and Agroforestry"
+18.1    18.1      "Forestry, general works, Forest conservation"
+18.2    18.2      "Reforestation - for erosion control see 11.04 and 14.05."
+18.3    18.3      "Cultivation and conservation (nurseries), protection and pest resistance"
+18.4    18.4      "Forests, Cloud Forests"
+18.5    18.5      "Specific trees and other forestry plants (incl. bamboo)"
+18.6    18.6      "Agroforestry"
+18.7    18.7      "Sustainable exploitation and commercialisation of forest products"
+19      19        "Industry, Manufacture and Services"
+19.1    19.1      "Industry (general works, textbooks, directories) incl. industrial planning"
+19.2    19.2      "Industrial training, consulting - for vocational training see 07.08."
+19.3    19.3      "Small- scale industry, handicraft, home industry"
+19.4    19.4      "Industrial profiles and studies covering several sectors"
+19.5    19.5      "Recycling and solid waste services"
+19.7    19.7      "Mining and quarrying"
+19.8    19.8      "Textile industry, manufacture of wearing apparel (incl. processing of natural fibres)"
+19.11   19.11     "Pulp and paper products (incl. printing and bookbinding)"
+19.12   19.12     "Chemical and chemical products industry incl. soap and candle production, salt"
+19.13   19.13     "Pottery, ceramics, glass and glass products (incl. jewellery, buttons, chalk)"
+19.14   19.14     "Metal industry"
+19.14.1 19.14.1   "Forging and blacksmithing"
+19.17   19.17     "Packing Industry"
+20      20        "Energy , Renewable energies, Household energy"
+20.1    20.1      "Energy and power (general works) incl. energy per country, energy savings, and publications covering several sources of energy, rural energy"
+20.2    20.2      "Transformation, distribution and storage of energy and electricity"
+20.2.1  20.2.1    "Rural electrification"
+20.3    20.3      "Conventional energy resources (oil, petroleum, coal, natural gas, peat, nuclear energy)"
+20.4    20.4      "Renewable energy resources"
+20.4.1  20.4.1    "Bio-mass (general works)"
+20.5    20.5      "Wood and charcoal (incl. kilns and activated charcoal)"
+20.6    20.6      "Solid fuels from agricultural wastes and other organic material (pellets, eco- bricks, briquets)"
+20.7    20.7      "Biogas (incl. biogas equipment)"
+20.8    20.8      "Cookstoves, Fuel-saving cookstoves, Household Energy"
+20.10   20.10     "Alcohol and other liquid fuels"
+20.11   20.11     "Solar energy, photovoltaic energy"
+20.12   20.12     "Wind energy"
+20.13   20.13     "Hydropower"
+20.14   20.14     "New Energy technology and research, Planetary Association for Clean Energy publications"
+21      21        "Settlements, Housing, Building -  Infrastructure Construction (Roads etc)"
+21.1    21.1      "Settlements and housing: general works incl. low- cost housing, planning techniques, surveying, etc."
+21.2    21.2      "Urban settlements (urban housing programmes, urbanization, squatters, slums, slum improvement)"
+21.3    21.3      "Rural settlements"
+21.4    21.4      "Architecture and Building design"
+21.4.2  21.4.2    "Solar and climate responsive architecture"
+21.5    21.5      "Construction materials"
+21.6    21.6      "Building machinery and equipment"
+21.7    21.7      "Building and construction (building components, construction techniques)"
+21.7.1  21.7.1    "Roofing"
+21.9    21.9      "Civil engineering (roads, bridges, etc.) - Road Construction"
+22      22        "Disasters, Disaster Mitigation, Humanitarian and Food Aid, Humanitarian Interventions, Refugees"
+22.1    22.1      "Disasters and Disaster Mitigation, Organisation"
+22.2    22.2      "Humanitarian Aid, Food Aid"
+22.3    22.3      "Humanitarian Interventions and Conflicts"
+22.5    22.5      "Refugees"
+23      23        "Development Periodicals and Magazines"
+23.1    23.1      "BASIN-NEWS - Building Advisory Service and Information Network by GTZ- GATE, SKAT,  ITDG and CRATerre"
+23.2    23.2      "Boiling Point Newsletters on Household Energy of Intermediate Technology Development Group.and GTZ"
+23.3    23.3      "CERES - FAO Review on Agriculture and Development: 1976 - 1997"
+23.4    23.4      "Developing Ideas - Bi-monthly Digests by the International Institute for Sustainable Development"
+23.5    23.5      "ECHO's Human Development Notes by the Educational Concerns for Hunger network"
+23.6    23.6      "Food and Nutrition Bulletins 1978-1996 - United Nations University"
+23.7    23.7      "Food Chain, newsletters on Food Processing of Intermediate Technology Development Group."
+23.8    23.8      "GATE Development magazine of GTZ"
+23.9    23.9      "HDD-FLASH, newsletter on Population, Health and Nutrition of the Worldbank Human Development Department"
+23.10   23.10     "IDRC monthly and weekly reports 1993 - 1997"
+23.11   23.11     "New and Noteworthy in Nutrition - World Bank"
+23.12   23.12     "SEEDLING: bi-montly publication of GRAIN - Genetic Resources International - Spain"
+23.13   23.13     "SPORE Bulletins 1986-1996 of the CTA - Technical and Agricultural Centre of the European Union"
+23.14   23.14     "Sustainable Energy Newsletters of the INFORSE network"
+23.15   23.15     "The Courier ACP 1990 - 1996 Africa-Caribbean-Pacific - European Union"
+23.16   23.16     "The NGLS Magazine Go Between"
+24      24        "Resources, Product Lists, Catalogues, Internet Sites"
Index: trunk/gsdl/collect/demo/perllib/classify/HDLList.pm
===================================================================
--- trunk/gsdl/collect/demo/perllib/classify/HDLList.pm	(revision 679)
+++ trunk/gsdl/collect/demo/perllib/classify/HDLList.pm	(revision 679)
@@ -0,0 +1,253 @@
+###########################################################################
+#
+# HDLList.pm --
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+
+# this is kind of a mutated version of AZList, written
+# specifically for the hdl collection. It's the same as
+# an AZList classification except it contains a Hierarcical
+# 'Magazines' classification as well as the standard 
+# alphabetical ones
+
+# There's also no need to provide a metadata element
+# to sort by - it always uses Title
+
+# magazines are sorted by filename
+
+package HDLList;
+
+use sorttools;
+
+sub new {
+    my ($class) = @_;
+
+    return bless {
+	'list'=>{},
+	'magclassifier'=>""
+	}, $class;
+}
+
+sub init {
+    my $self = shift (@_);
+
+    $self->{'list'} = {};
+
+    # load up a Hierarchy classifier for the 'magazines' sub-section
+    my $hrname = &util::filename_cat($ENV{'GSDLHOME'},"perllib/classify/Hierarchy.pm"); 
+    if (-e $hrname) { require $hrname; }
+    else { die "HDLList ERROR - couldn't find classifier \"$hrname\"\n"; }
+
+    # create the Hierarchy classifier object
+    my ($hrclassobj);
+    eval ("\$hrclassobj = new Hierarchy(\"hfile=mags.txt\", \"metadata=Magazine\", \"sort=Filename\", \"title=_magazines_\")");
+    die "$@" if $@;
+
+    $hrclassobj->init();
+    $self->{'magclassifier'} = $hrclassobj;
+}
+
+sub classify {
+    my $self = shift (@_);
+    my ($doc_obj) = @_;
+
+    my $doc_OID = $doc_obj->get_OID();
+
+    my $magazine = $doc_obj->get_metadata_element ($doc_obj->get_top_section(),
+						   'Magazine');
+
+    my $title = $doc_obj->get_metadata_element ($doc_obj->get_top_section(),
+						'Title');
+
+    # if this document contains <Magazine> metadata we want to shove it into
+    # the Hierarchical magazine classification (and not include it in the
+    # alphabetical list), otherwise shove it in the AZList bit (as long as
+    # it has a <Title>
+    if (defined $magazine && $magazine =~ /\w/) {
+	$self->{'magclassifier'}->classify ($doc_obj);
+
+    } elsif (defined $title && $title =~ /\w/) {
+	&sorttools::format_string_english (\$title);
+	
+	if (defined $self->{'list'}->{$doc_OID}) {
+	    print STDERR "WARNING: HDLList::classify called multiple times for $doc_OID\n";
+	} 
+	$self->{'list'}->{$doc_OID} = $title;
+    }
+}
+
+
+sub get_classify_info {
+    my $self = shift (@_);
+
+    my @classlist = sort {$self->{'list'}->{$a} cmp $self->{'list'}->{$b};} keys %{$self->{'list'}};
+
+    my $classifyinfo = $self->splitlist (\@classlist);
+
+    # shove in the magazine bit
+    push (@{$classifyinfo->{'contains'}}, $self->{'magclassifier'}->get_classify_info());
+    
+    return $classifyinfo;
+}
+
+
+sub get_entry {
+    my $self = shift (@_);
+    my ($title, $childtype, $thistype) = @_;
+    
+    # organise into classification structure
+    my %classifyinfo = ('childtype'=>$childtype,
+			'Title'=>$title,
+			'contains'=>[]);
+    $classifyinfo{'thistype'} = $thistype 
+	if defined $thistype && $thistype =~ /\w/;
+
+    return \%classifyinfo;
+}
+
+# splitlist takes an ordered list of classifications (@$classlistref) and splits it
+# up into alphabetical sub-sections.
+sub splitlist {
+    my $self = shift (@_);
+    my ($classlistref) = @_;
+    my $classhash = {};
+
+    # top level
+    my $classifyinfo = $self->get_entry ("Title", "HList", "Invisible");
+
+    # don't need to do any splitting if there are less than 20 classifications
+    # we have a A-Z section containing everything if there aren't many 
+    # classifications (since we've already got a 'Magazines' section)
+    if ((scalar @$classlistref) <= 20) {
+	my $allinfo = $self->get_entry ("A-Z", "VList");
+	foreach $subOID (@$classlistref) {
+	    push (@{$allinfo->{'contains'}}, {'OID'=>$subOID});
+	}
+	push (@{$classifyinfo->{'contains'}}, $allinfo);
+	return $classifyinfo;
+    }
+	
+    # first split up the list into separate A-Z and 0-9 classifications
+    foreach $classification (@$classlistref) {
+	my $title = $self->{'list'}->{$classification};
+	$title =~ s/^(.).*$/$1/;
+	$title =~ tr/[a-z]/[A-Z]/;
+	if ($title =~ /^[0-9]$/) {$title = '0-9';}
+	elsif ($title !~ /^[A-Z]$/) {
+	    print STDERR "HDLList: WARNING $classification has badly formatted title ($title)\n";
+	}
+	$classhash->{$title} = [] unless defined $classhash->{$title};
+	push (@{$classhash->{$title}}, $classification);
+    }
+    $classhash = $self->compactlist ($classhash);
+
+    my @tmparr = ();
+    foreach $subsection (sort keys (%$classhash)) {
+	push (@tmparr, $subsection);
+    }
+    
+    # if there's a 0-9 section it will have been sorted to the beginning
+    # but we want it at the end
+    if ($tmparr[0] eq '0-9') {
+	shift @tmparr;
+	push (@tmparr, '0-9');
+    }
+
+    foreach $subclass (@tmparr) {
+	my $tempclassify = $self->get_entry($subclass, "VList");
+	foreach $subsubOID (@{$classhash->{$subclass}}) {
+	    push (@{$tempclassify->{'contains'}}, {'OID'=>$subsubOID});
+	}
+	push (@{$classifyinfo->{'contains'}}, $tempclassify);
+    }
+
+    return $classifyinfo;
+}
+
+sub compactlist {
+    my $self = shift (@_);
+    my ($classhashref) = @_;
+    my $compactedhash = {};
+    my @currentOIDs = ();
+    my $currentfirstletter = "";
+    my $currentlastletter = "";
+    my $lastkey = "";
+
+    # minimum and maximum documents to be displayed per page.
+    # the actual maximum will be max + (min-1).
+    # the smallest sub-section is a single letter at present
+    # so in this case there may be many times max documents
+    # displayed on a page.
+    my $min = 10; 
+    my $max = 30;
+
+    foreach $subsection (sort keys %$classhashref) {
+	if ($subsection eq '0-9') {
+	    @{$compactedhash->{$subsection}} = @{$classhashref->{$subsection}};
+	    next;
+	}
+	$currentfirstletter = $subsection if $currentfirstletter eq "";
+	if ((scalar (@currentOIDs) < $min) ||
+	    ((scalar (@currentOIDs) + scalar (@{$classhashref->{$subsection}})) <= $max)) {
+	    push (@currentOIDs, @{$classhashref->{$subsection}});
+	    $currentlastletter = $subsection;
+	} else {
+
+	    if ($currentfirstletter eq $currentlastletter) {
+		@{$compactedhash->{$currentfirstletter}} = @currentOIDs;
+		$lastkey = $currentfirstletter;
+	    } else {
+		@{$compactedhash->{"$currentfirstletter-$currentlastletter"}} = @currentOIDs;
+		$lastkey = "$currentfirstletter-$currentlastletter";
+	    } 
+	    if (scalar (@{$classhashref->{$subsection}}) >= $max) {
+		$compactedhash->{$subsection} = $classhashref->{$subsection};
+		@currentOIDs = ();
+		$currentfirstletter = "";
+	    } else {
+		@currentOIDs = @{$classhashref->{$subsection}};
+		$currentfirstletter = $subsection;
+		$currentlastletter = $subsection;
+	    }
+	}
+    }
+
+    # add final OIDs to last sub-classification if there aren't many otherwise
+    # add final sub-classification
+    if (scalar (@currentOIDs) < $min) {
+	my ($newkey) = $lastkey =~ /^(.)/;
+	@currentOIDs = (@{$compactedhash->{$lastkey}}, @currentOIDs);
+	delete $compactedhash->{$lastkey};
+	@{$compactedhash->{"$newkey-$currentlastletter"}} = @currentOIDs;	
+    } else {
+	if ($currentfirstletter eq $currentlastletter) {
+	    @{$compactedhash->{$currentfirstletter}} = @currentOIDs;
+	} else {
+	    @{$compactedhash->{"$currentfirstletter-$currentlastletter"}} = @currentOIDs;
+	} 
+    }
+
+    return $compactedhash;
+}
+
+1;
