newbies template question

P.van Kemenade <[email protected]>
Newsgroups gmane.comp.lang.xul.general
Message-ID <[email protected]>
Hi

I have this very plain RDF file for which I tried to write a XUL 
template,
I figured out several ways to do it but nothing works. I'm left with a
very complicated solution, and I feel I'm doing something wrong ....
could anyone hint me ?

The RDF is 1 single resource with a few plain properties.
No RDF:Seq in this file, just 1 resource with props
+ I dont want to change the rdf format just for mozilla :-)
<rdf:RDF  blah>
	<rss:item rdf:about="&rssbase;deaf/1996.rdf">
		<rss:title>DEAF 1996: Digital Territories</rss:title>
		<rss:description/>
		...
	</rss:item>
</rdf:RDF>

( i can read and parse the template with xul ok, there's one full 
example here
	http://v2archive.v2.nl/~portal2004/rsstest/_rss/test/deaf/1996.rdf )


The template should generate a textbox for each property
that is found, but _not_ generate a textbox if a certain
property is not found. I can (have to) hardcode all the
optional properties in the xul, but that's ok.

One way to go would be to have the props as ?bindings and set the
uri of each textbox to such a binding, but it doesnt work  (why?):
<template>
	<rule>
		<conditions>
			<content uri="?item"/>
			<!-- dummy condition -->
			<triple subject="?item"  
predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"  
object="?root"/>
		</conditions>
		<bindings>
			<binding subject="?item"  predicate="http://purl.org/rss/1.0/title"  
object="?title"/>
			<binding subject="?item"  
predicate="http://purl.org/rss/1.0/description" object="?description"/>
			....
		</bindings>
		<action>
			 <textbox  uri="?title" value="?title" />
			 <textbox  uri="?description" value="?description" />
		</action>
	</rule>
</template>

Another way to go would be "multiple rules", but it doesnt work (why?):

<template container="?item" member="?prop">
	<rule>
		<conditions>
			<content uri="?item"/>
			<triple subject="?item"  predicate="http://purl.org/rss/1.0/title" 
object="?prop"/>
		</conditions>
		<action> <textbox  uri="?prop" value="?prop" /></action>
	</rule>
	<rule>
		<conditions>
			<content uri="?item"/>
			<triple subject="?item"  
predicate="http://purl.org/rss/1.0/description" object="?prop"/>
		</conditions>
		<action> <textbox  uri="?prop" value="?prop" /></action>
	</rule>
	...
</template>

The last way to go would be multiple templates (one for each property), 
that works, but
it creates a whole bunch of datasources and builders to be updated  all 
the
time, it's heavy and slow and generally ugly.

How would you guys do this ?

thanks,
*pike

=============
"Nada does nothing for everybody"
http://www.bernardbelanger.com/computing/NaDa/



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.