You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Isidro Vila Verde <jv...@serprest.pt> on 2004/05/01 20:45:43 UTC
Xpath expression with a variable predicate in binding cforms
Sorry if this is a FAQ, but I am in my first steps into cocoon and cforms
and all (almost) is new to me.
I have this XML data
<root>
<hab tipo="QD" quant="2"/>
<hab tipo="QS" quant="3"/>
<precos>
<elem hab="QD" val="30" unit="Euro"/>
<elem hab="QS" val="25" unit="Euro"/>
</precos>
</root>
That I wanto to bind with something like this
<fb:repeater id="hab" parent-path="." row-path="hab">
<fb:identity>
<fb:value id="id" path="@id"></fb:value>
</fb:identity>
<fb:on-bind>
<fb:value id="tipo" path="@tipo"/>
<fb:value id="n" path="@quant">
<fd:convertor datatype="integer"/>
</fb:value>
<fb:value id="preco"
path="../precos/elem[@hab=VARIABLE]/@val">
<fd:convertor datatype="integer"/>
</fb:value>
</fb:on-bind>
</fb:repeater>
Where VARIABLE must be the value of @tipo from current node (hab).
How can I do this. Are there any possibility to refer to value o 'tipo'?
Something like we do with xsl:variable in XSL?
Thanks in advance.
Isidro Vila Verde
email:jvv@serprest.pt
web: http://serprest.pt/
tel: 223743701
tel: 969103006
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.672 / Virus Database: 434 - Release Date: 28-04-2004
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Xpath expression with a variable predicate in binding cforms
Posted by Joerg Heinicke <jo...@gmx.de>.
On 01.05.2004 20:45, Isidro Vila Verde wrote:
> Sorry if this is a FAQ, but I am in my first steps into cocoon and cforms
> and all (almost) is new to me.
No, it is not a FAQ, I read it the first time.
> I have this XML data
>
> <root>
> <hab tipo="QD" quant="2"/>
> <hab tipo="QS" quant="3"/>
> <precos>
> <elem hab="QD" val="30" unit="Euro"/>
> <elem hab="QS" val="25" unit="Euro"/>
> </precos>
> </root>
>
> That I wanto to bind with something like this
>
> <fb:repeater id="hab" parent-path="." row-path="hab">
> <fb:identity>
> <fb:value id="id" path="@id"></fb:value>
> </fb:identity>
> <fb:on-bind>
> <fb:value id="tipo" path="@tipo"/>
> <fb:value id="n" path="@quant">
> <fd:convertor datatype="integer"/>
> </fb:value>
> <fb:value id="preco"
> path="../precos/elem[@hab=VARIABLE]/@val">
> <fd:convertor datatype="integer"/>
> </fb:value>
> </fb:on-bind>
> </fb:repeater>
>
> Where VARIABLE must be the value of @tipo from current node (hab).
> How can I do this. Are there any possibility to refer to value o 'tipo'?
> Something like we do with xsl:variable in XSL?
I know that the underlying framework JXPath supports variables and so it
may be possible to add such functionality, but I don't see how you can
do it at the moment. I guess you have to preprocess your XML structure
with an XSLT.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org