This is quite an interesting approach (I didn't know about AngularJS before). . In the end it looks like AngularJS does exactly what XForms was created for. However, I see your point of no existing 100% satisfying XForms implementation as well. But there is one problem with this approach in comparison to pure XForms I'd like to mention, though.
Well, I've actually opted for a completely different solution - AngularJS & RESTXQ & JsonML. Very cool so far! It actually makes BaseX only a service layer and moves all UI composition and teplating to the client.
Originally I wanted to make a pure XRX solution but I don't see any easily embeddable and widely supported XForms implementation on the market (XSLTForms comes close but I see too many "buts" and "ifs").
Daniel
--
danielkvasnicka.net
On Nov 19, 2012, at 9:47 , Michael Seiferle <ms@basex.org> wrote:
> Hi Daniel,
>
> thanks a lot for your observations, I know moustache.{xq,js} as well, and I'd be thrilled if we eventually come up with our own BaseX compatible implementation :-)
>
> Anyway, until then, I'd like to let you know how we handle this at the moment:
> We introduce a template module that accepts a map of options and some content.
> Inside the template wrapping function, we wire our page elements with the map’s contents.
> This proved to be rather flexible while still being lightweight enough to be out of the way most of the time.
>
> Please excuse the messed up highlighting: https://gist.github.com/e053068a41eb35e727bb
>
> We chose maps, as they make it especially easy to provide default values that can be easily overridden from calling functions by combining a map:
>> let $defaults := map {"Foo" := "Bar", "foo" := "bar", "Bar" := "Foo"}
>> let $options := map {"Foo" := "Override"}
>> let $options := map:new(($defaults, $options))
>> return string-join(map:keys($options) ! (. || " := "|| $options(.)), " ")
>
> I hope this helps feel free to discuss this issue more :)
>
> Michael
>
>
>
> Am 17.11.2012 um 19:27 schrieb Daniel Kvasnička <daniel.kvasnicka@me.com>:
>
>> Hi folks,
>>
>> another thing I'm trying to solve while working on a XQuery web app. What kind of templating system do you use to separate HTML templates from the rest of your code?
>>
>> - XSLT - the only problem I have with this is performance. I tested the XSLT Module with Saxon 9 and a primitive page and it was more than 3x slower compared to pure XQuery templates (XQuery fn taking $model). Other than that I think it's the best built-in option. I actually don't have any users-per-second expectations and those templates will be quite small... do I overemphasize the perf. question?
>>
>> - pure XQuery - not aimed at templating at all and it shows I'm afraid... just can't come up with a solution that would be clean enough (plus HTML, JS & CSS highlighting withing xq files is not good at all, at least in Vim)
>>
>> - I looked at Mustache.xq and quite liked it - depends on MarkLogic though :(
>>
>> - Any hidden gem I haven't googled yet?
>>
>> Leaning towards XSLT right now...
>> Daniel
>>
>> --
>> danielkvasnicka.net
>>
>> _______________________________________________
>> BaseX-Talk mailing list
>> BaseX-Talk@mailman.uni-konstanz.de
>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk