Re: [greenstone-users] Formatting repeating metadata values

From Michael Dewsnip
DateWed, 26 May 2004 17:07:45 +1200
Subject Re: [greenstone-users] Formatting repeating metadata values
In-Reply-To (20040520181800J-tao-uchicago-edu)
Hi Tod,
Is there a syntax for formatting multiple metadata values?

In particular, suppose a document has metadata for several MIDI files:

    <Metadata name="MidiFile">and06.mid</Metadata>
    <Metadata name="MidiFile">ber22.mid</Metadata>

Is there a way, using the format strings, to format these as links to
the MIDI files, like:

    <a href="file:///data/midi/and06.mid">and06.mid</a>
    <a href="file:///data/midi/ber22.mid">ber22.mid</a>

(Notice that each metadata value is used twice, once in the href, once
in the text of the link.)

The sibling syntax is great for simply printing the metadata values,
but doesn't seem to go quite this far.

Yes, you're right, the sibling syntax is very limited. What we really need is a {ForEach} type operation, where you can specify a format string to apply to each element.
Alternately, is there a way to shove formatted hypertext links into
metadata values?  Maybe something like:

    <Metadata name="MidiLink">&lt;a
    href="file:///data/midi/and06.mid"&gt;and06.mid&lt;/a&gt;</Metadata>

Has anyone out there abused metadata values to this degree?

Yes, you can do this -- exactly as you describe.

(If you really want abuse, you can set the metadata elements to
    and06.mid">and06.mid

and use the sibling syntax like
    <a href="[sibling(All'</a><a href="'):MidiFile]</a> :-)

All the best,

Michael