Skip to main content.
home | support | download

Back to List Archive

Re: Display of XML Attributes

From: Bill Moseley <moseley(at)>
Date: Tue Apr 06 2004 - 23:55:45 GMT
On Tue, Apr 06, 2004 at 03:39:48PM -0700, Thoreau Lovell wrote:
> I'm new to Swish-e, so please forgive another newbe question. I'm indexing 
> a set of xml docs that have been generated by an XSLT stylesheet. Each doc 
> represents a record for an electronic journal. The problem I'm having is 
> that many of the records have multiple instances of a given element tag. 
> For instance, the <provider> tag. Instead of displaying each instance 
> separately, Swish-e concatenates them into a list when they are displayed 
> as part of a search result.

That's how it works[1].  I thought it was a config.h setting, but it turns
out to be a docprop.c setting:

    if ( add_a_space )
        p->propValue[p->propLen++] = ' ';

So you might be able to change that to a pipe, for example, and then
split on that pipe when displaying the property.  Hum, that actually
might not won't work because long properties might be added to the index
in chunks and have that pipe added to them, too.

> I'm using TemplateToolkit to generate the output. Any suggestions on how to 
> display each <provider> instance on a separate line? Or, should I 
> restructure the xml files? If so, how?

You could either pre-parse the files and add your own separator
character(s) that you can split on in the view, or rename the tags
on-the-fly by preparsing <providerA> <providerB> ... and then try and
pull them out one-by-one.  Not a very good solution, either.

[1] Swish used to internally create a linked-list of properties each
time a property of the same name was added to the index, but that caused
problems when using the SAX parser where data was added in chunks, and
also there was no way to print out those properties once in the index.

Bill Moseley
Received on Tue Apr 6 16:55:46 2004