6
edits
Changes
→Comments Sean McMurray
=== Comments Sean McMurray ===
I have a small xbl that is fairly rough, but allows written an XBL to me use do inline xsl XSL templates.It is less than 100 lines of xblThe XBL has two bindings: one for datasources, one for templates.
<xsl:stylesheet ...../>
</myTemplatexslTemplate> Templates can be bound to one or more datasources. The datasources must be defined elsewhere within the document. '''Datasources''' You place an datasource in your document like this: <myElement id="myDS" href="uri://to/a/datasource" style="-moz-binding: url('myTemplateIdea.xbl#datasource');"/> The href attribute points to the location of the data. This href is used to post an XMLHttpRequest. Datasources can also have a "request" attribute, the contents of which are included in the HTTP Post. Datasource elements can also contain js code that is invoked before the HTTP Post. This is useful for manipulating the href or request attributes. For example: <myElement id="myDS" ...> <![CDATA[ if(document.getElementById("someotherelement").value=="Just what I want") this.request="someparam=whateverIwant"; ]]> </myElement> The datasource also acts as a cache. It stores the response to the HTTP Post in an xbl property. Whenever that property is changed, all templates bound to the datasource are re-transformed.
<xmlDataSource id="myDS" href="uri://to/a/datasource" />