From 271266c6e2dfeef76ba5724848e435c441d671e7 Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Thu, 8 Mar 2007 11:24:50 +0000 Subject: [PATCH] added example of MARCXML indexing with chopping of sort indexes cccording to 'ind2' field containing integer --- doc/recordmodel-domxml.xml | 108 ++++++++++++++++++++++++++++++++-- test/xslt/Makefile.am | 3 +- test/xslt/dom-config-one.xml | 13 ++-- test/xslt/dom-index-element-chop.xsl | 44 ++++++++++++++ test/xslt/zebra-dom.cfg | 6 +- 5 files changed, 160 insertions(+), 14 deletions(-) create mode 100644 test/xslt/dom-index-element-chop.xsl diff --git a/doc/recordmodel-domxml.xml b/doc/recordmodel-domxml.xml index a9b85db..1dd8559 100644 --- a/doc/recordmodel-domxml.xml +++ b/doc/recordmodel-domxml.xml @@ -1,7 +1,7 @@ - + &dom; &xml; Record Model and Filter Module - + The record model described in this chapter applies to the fundamental, structured &xml; @@ -602,9 +602,109 @@ ]]> + + + +
+ &dom; Indexing &marcxml; + + The &dom; filter allows indexing of both binary &marc; records + and &marcxml; records, depending on it's configuration. + A typical &marcxml; record might look like this: + + + 42 + 00366nam 22001698a 4500 + 11224466 + DLC + 00000000000000.0 + 910710c19910701nju 00010 eng + + 11224466 + + + DLC + DLC + + + 123-xyz + + + Jack Collins + + + How to program a computer + + + Penguin + + + 8710 + + + p. cm. + + + ]]> + + + + + It is easily possible to make string manipulation in the &dom; + filter. For example, if you want to drop some leading articles + in the indexing of sort fields, you might want to pick out the + &marcxml; indicator attributes to chop of leading substrings. If + the above &xml; example would have an indicator + ind2="8" in the title field + 245, i.e. + + + How to program a computer + + ]]> + + one could write a template taking into account this information + to chop the first 8 characters from the + sorting index title:s like this: + + + + + 0 + + + + + + + + + + + + + + ]]> + + The output of the above &marcxml; and &xslt; excerpt would then be: + + How to program a computer + program a computer + ]]> + + and the record would be sorted in the title index under 'P', not 'H'. + +
+ + +
+ &dom; Indexing Wizardry - Notice also, - that the names and types of the indexes can be defined in the + The names and types of the indexes can be defined in the indexing &xslt; stylesheet dynamically according to content in the original &xml; records, which has opportunities for great power and wizardry as well as grande diff --git a/test/xslt/Makefile.am b/test/xslt/Makefile.am index 95c1a95..afc0557 100644 --- a/test/xslt/Makefile.am +++ b/test/xslt/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.15 2007-03-06 09:24:34 marc Exp $ +# $Id: Makefile.am,v 1.16 2007-03-08 11:24:50 marc Exp $ check_PROGRAMS = xslt1 xslt2 xslt3 xslt4 xslt5 dom1 TESTS = $(check_PROGRAMS) @@ -9,6 +9,7 @@ EXTRA_DIST= \ dom-config-one.xml \ dom-config-skipped.xml \ dom-index-element.xsl \ + dom-index-element-chop.xsl \ dom-index-pi.xsl \ dom-index-skipped.xsl \ id.xsl \ diff --git a/test/xslt/dom-config-one.xml b/test/xslt/dom-config-one.xml index 5dde67c..c7bcaf3 100644 --- a/test/xslt/dom-config-one.xml +++ b/test/xslt/dom-config-one.xml @@ -1,15 +1,16 @@ - + + + + + - + + - - - - diff --git a/test/xslt/dom-index-element-chop.xsl b/test/xslt/dom-index-element-chop.xsl new file mode 100644 index 0000000..ec4ce64 --- /dev/null +++ b/test/xslt/dom-index-element-chop.xsl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + diff --git a/test/xslt/zebra-dom.cfg b/test/xslt/zebra-dom.cfg index a912991..fc73eda 100644 --- a/test/xslt/zebra-dom.cfg +++ b/test/xslt/zebra-dom.cfg @@ -2,9 +2,9 @@ profilePath: ${srcdir:-.}:${srcdir:-.}/../../tab modulePath: ../../index/.libs -recordType: dom.dom-config-skipped.xml -#recordType: dom.dom-config-col.xml +#recordType: dom.dom-config-skipped.xml +recordType: dom.dom-config-col.xml -perm.anonymous: rw +#perm.anonymous: rw -- 1.7.10.4