eXist-db / shared-resources

An app package with shared resources used by several eXist-db applications
5 stars 16 forks source link

issue with templating #11

Closed dizzzz closed 10 years ago

dizzzz commented 10 years ago

https://github.com/eXist-db/exist/issues/203

lcahlander commented 10 years ago

I have my own 'each' that works:

declare function app:each($node as node(), $model as map(), $from as xs:string, $to as xs:string) { for $item in $model($from) return element { node-name($node) } { $node/@, templates:process($node/node(), map:new(($model, map:entry($to, $item)))) } };

I think that the %temlpates:wrap is the problem in this case.

wolfgangmm commented 10 years ago

I pushed your change in ccba1369009a97ad7b5a46884821d8a1d85b98aa

lcahlander commented 10 years ago

The templates:each is working properly now. The debug flag works as well!

The templates.xql should have documentation within it to tell people how to set things like the debug flag.

To turn on the debug, in view.xql in the modules collection of the app, change:

let $config := map { $templates:CONFIG_APP_ROOT := $config:app-root, $templates:CONFIG_STOP_ON_ERROR := true() }

to

let $config := map { $templates:CONFIG_APP_ROOT := $config:app-root, $templates:CONFIG_DEBUG := true(), $templates:CONFIG_STOP_ON_ERROR := true() }

Thank you Wolfgang.

dizzzz commented 10 years ago

fixed with https://github.com/eXist-db/shared-resources/commit/ccba1369009a97ad7b5a46884821d8a1d85b98aa