Re: [greenstone-users] Displaying multiple metadata values individually?

From jens wille
DateThu, 18 Aug 2005 02:20:01 +0200
Subject Re: [greenstone-users] Displaying multiple metadata values individually?
In-Reply-To (4303AEF6-6060602-cs-waikato-ac-nz)
hi katherine!

Katherine Don wrote:
> What is the basic problem that you are having with the format
> statements that means you can't do it just using [sibling:]?? Is
> it that need to print out the value twice for each item? You
> could probably generate a series of links using sibling:, but you
> wouldn't be able to display the text that the link pertained to.
> Is that the main problem? Are there any others?
my understanding of this topic is that one might want to combine
several multi-valued metadata "pairwise". e.g.:

assume metadata 'foo': a, b, c (this could be href's)
'bar': x, y, z (this would then be the link texts)

=> aim: <a href="a">x</a><br><a href="b">y</a><br><a href="c">z</a>

> I have added sibling(first):, sibling(last), sibling(1),
> sibling(2) etc to the latest release, so if you knew how many
> items there would be, then you could do it just using format
> statements. If you don't know in advance, I guess you could do a
> series of if statements, if sibling(0), print sibling(0) if
> sibling(1), print sibling(1) etc a bit ugly but doesn't involve
> javascript.
these new sibling (and parent, and child) functionalities are great!
and you could now even achieve the above mentioned by saying:

<a href="[sibling(1):foo]">[sibling(1):bar]</a><br>
<a href="[sibling(2):foo]">[sibling(2):bar]</a><br>
<a href="[sibling(3):foo]">[sibling(3):bar]</a>

...but: in practice, you just can't put several hundreds of these
statements (maybe with if-clauses) into your collect.cfg. and what
if one of your documents has more instances of that metadata than
you precalculated?!

> Does this solve your problems? If not, it would be good to get a
> clear picture of what the main problem is, and we'll add it to
> our todo list :-)
i'm not sure if i was able to draw a sufficiently clear picture, but
what i'd think would be nice is some kind of a for-loop (actually
somehow more than just nice ;-):

{For}{[foo],[bar], <a href="_1_">_2_</a><br>}
| |
_1_ _2_ ...

it takes a list of metadata names and a format statement as
arguments. the _x_ parameters are then sequentially set to the
according metadata value.
(the single-metadata-case would be equivalent to our well-known
"[sibling(All:'xxx'):...]xxx". maybe one could even add another
argument for the delimiter: "{For}{..., <a .../a>, <br>}". thus it
would really be equivalent to the [sibling...] construct, and more
appropriate, too)

now, this picture might be a bit visionary, but your request was
quite an invitation ;-)

cheers
jens