XUL Templates
Date : 2008 01 08 Category : Tech & DevelopmentMark Finkle has posted about new datasources for XUL templating which links to a nice tutorial.
I hope to see more XUL/like features finding their way into the Open Web.
Take a look at some of the examples:
Using vbox to use fun box model stuff and create a simple vertical box:
PLAIN TEXT XML:<vbox datasources="rdf:bookmarks" ref="NC:BookmarksRoot" flex="1"> <template> <button uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name"/> </template> </vbox>
The example below shows how we might set other attributes of a button using a datasource. Of course, this assumes that the datasource supplies the appropriate resources. If a particular one is not found, the value of the attribute will be set to an empty string:
PLAIN TEXT XML:<button class="rdf:http://www.example.com/rdf#class" uri="rdf:*" label="rdf:http://www.example.com/rdf#name" crop="rdf:http://www.example.com/rdf#crop"/>
Using rules:
PLAIN TEXT XML:<window id="example-window" title="Bookmarks List" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox datasources="rdf:bookmarks" ref="NC:BookmarksRoot" flex="1"> <template> <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"> <spacer uri="rdf:*" height="16"/> </rule> <rule> <button uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name"/> </rule> </template> </vbox> </window>