Re: xslt renderer: 2 questions

Martijn Faassen <[email protected]>
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Marc Petitmermet wrote:
> dear developers
> 
> - would it be possible to use the renderer for non-silva content? e.g. 
> for an uploaded silva file asset which is an xml file from a external 
> program. or should this xml file be included into a silva document using 
> external sources?

Neither way will work. Objects that want to participate in XSLT need to 
represent themselves as XML to the system in a very specific way, by 
sending SAX events. File objects do represent themselves as XML, but 
their *content* doesn't.

If we want an object that is in fact an XML file, we should make a 
special one dedicated to that. This can then send out SAX events based 
on its XML content and the XSLT renderer can work.

One limitation would be that you could have only one set of XSLT 
rendererers associated with such a "Silva XML Content". Instead, you'd 
like to associate a set of XSLT renderers with each possible type of *XML*.

The following sequence of possible future developments could help to 
lift this limitation:

* XSLT renderers won't be connected to meta_type (Silva File) anymore, 
but to interface.

* There's an XML content object. If you save XML to it, the 
structure/hints in the XML or, alternatively, some user specific action, 
determine what *type* of XML this is and set an interface on the object 
accordingly.

* Since you can specify an XSLT renderer by interface then, you could 
have one type of object that can be represented using XSLT in all kinds 
of way, depending on the content type.

This "future development" was actually worked out by Philipp von 
Weitershausen and myself in the context of Zope 3 early last year at a 
sprint.

A first step, the introduction of sophisticated interfaces into Silva, 
is hopefully not far off.

> - is it possible to let the user choose the renderer with a link in the 
> public view of a page? e.g. i have a standard listing with the default 
> renderer but i would like to have more views with more details of the 
> same data. for this task the user should be able to click on some links 
> on the page.

Right now this isn't possible, but it shouldn't be too hard to open up 
the other associated XSLT templates to URL-based selection, overriding 
whatever is selected. I think that if this is built, we should make sure 
that this isn't enabled by default, however.

Regards,

Martijn
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.