|
From: Jean-Christophe K. <jc...@ba...> - 2005-05-27 10:07:30
|
Hi
I agree it's not a very common use, and certainly a misuse, but here is=20
the whole story.
I did that only because I don't want to use util:eval that takes too=20
much time. Maybe I'm wrong.
I just want to build a xquery with a few parameters :
(::pragma exist:serialize omit-xml-declaration=3Dno::)
xquery version "1.0";
declare namespace f=3D"http://bluexml.org/xquery/local-functions";
declare namespace fn=3D"http://www.w3.org/2003/05/xpath-functions";
declare namespace util=3D"http://exist-db.org/xquery/util";
declare namespace fd=3D"http://apache.org/cocoon/forms/1.0#definitio=
n";
declare function f:main() as element()* {
(: We should use util:eval to make thing more parametrizable
but it's 20 times slower :)
let $xpath :=3D '/document'
let $path :=3D 'meta/author'
for $doc in $xpath
return (
<fd:item>
<fd:value>{util:document-name($doc)}</fd:value>
(: If I use util:eval, I notice performances are very bad, because of=20
string manipulation ? no caching ? I don't know... To circumvent this=20
problem, I so decided to generate thrgouh xml+xsl my xquery. :)
<fd:label>{util:eval(concat($doc,$path)}</fd:label>
(: I can't do this :)
<fd:label>{$doc/$path}</fd:label>
</fd:item>
)
};
<fd:selection-list>
{f:main()}
</fd:selection-list>
Any ideas to do that ?
Michael Beddow a =E9crit :
> Jean-Christophe Kermagoret wrote:
>=20
>=20
>>I completely forgot that {} are interpreted by cocoon so I put %7B and
>>%7D instead and all is fine now...
>=20
>=20
> Ah well, it's good to have an environment where people are encouraged t=
o
> scrutinise their own questions and discover the answers in the process
> (though Socrates thought of that idea first).
>=20
> Glad to hear that your problem is now solved. I do, however, have a sen=
se
> that the way you're approaching things may be making your use of eXist =
a
> little more complicated (=3D among other things, harder to debug) than =
it
> needs to be. But obviously that's just my personal hunch based on a sma=
ll
> glimpse of your coding, and I'm no Cocoon expert anyway. But if you can=
find
> another Cocoon user locally, it might be helpful for you to do a joint
> walk-through of your current use of Cocoon to wrap eXist, and see if an=
y
> suggestions emerge.
>=20
> Michael Beddow
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=3Doffad-ysdn-ostg-q=
22005
> _______________________________________________
> Exist-open mailing list
> Exi...@li...
> https://lists.sourceforge.net/lists/listinfo/exist-open
--=20
Jean-Christophe Kermagoret
jc...@Ba...
|