cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ulrich, Dominik" <Dominik.Ulr...@ids.de>
Subject AW: AW: [woody binding] insert attribute content into similar nodes
Date Fri, 14 Nov 2003 08:02:44 GMT
Hi
sorry I was a bit confused, what I really wanted to tell is:

my model:

<wd:booleanfield id="choose">
	<wd:label>I choose</wd:label>
</wd:booleanfield>
<wd:booleanfield id="choose1">
	<wd:label>I choose</wd:label>
</wd:booleanfield>

my binding:

<wb:value id="choose" path="choose[title='A']/@value">
	<wd:convertor datatype="boolean"/>
</wb:value>
<wb:value id="choose1" path="choose[title='B']/@value">
	<wd:convertor datatype="boolean"/>
</wb:value>

and my data file:

<choose title="A" value=""/>
<choose title="B" value=""/>

choose elements are child elements of <info> they are not inside a repeater.
there is an error message, when trying to save data to file:

uncaught JavaScript exception: at form2xml (file:/C:/Programme/Apache Group/Tomcat 4.1/webapps/cocoon/highage/woody/flow/binding_example.js,
Line 73) at (resource://org/apache/cocoon/woody/flow/javascript/woody2.js, Line 199): org.apache.cocoon.woody.binding.BindingException:
Problem binding field choose (parent = "") to xpath choose[title='A']/@value (context xpath
= "/data[1]/wrapper[1]/context[1]/info[1]")

Did I do everything right?

Thanky you very much for helping!

ciao
Dominik


-----Urspr√ľngliche Nachricht-----
Von: Bruno Dumon [mailto:bruno@outerthought.org]
Gesendet: Donnerstag, 13. November 2003 15:32
An: users@cocoon.apache.org
Betreff: Re: AW: [woody binding] insert attribute content into similar
nodes


On Thu, 2003-11-13 at 14:53, Ulrich, Dominik wrote:
> Hi
> thanks for your fast help!
> the problem is, that I have to declare a id in the template like

Confusing... binding and template have nothing at all to do with each
other, so these are clearly two different problems.

> <wt:widget id="mywidget1"/>
> <wt:widget id="mywidget2"/>
> 
> but when I try this there is a error message:
> 
> widget with id "choose1" does not exist in the container 
> 
> probably because the elements are identical

You mean the elements in the data XML file? No, there's really no
connection between both: the binding loads information from the XML file
into the form widgets. After this, there's no connection whatsoever
anymore between the XML file and the form instance, and certainly not
between the template and the XML file. The template connects to the form
instance, not to the XML file.

The error you have is either a typo in a widget id, or some other error
in your form template. Are your widgets (choose1 for example) direct
children of the form or are they inside a repeater?

> 
> 
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Bruno Dumon [mailto:bruno@outerthought.org]
> Gesendet: Donnerstag, 13. November 2003 14:41
> An: users@cocoon.apache.org
> Betreff: Re: [woody binding] insert attribute content into similar nodes
> 
> 
> On Thu, 2003-11-13 at 14:33, Ulrich, Dominik wrote:
> > Hi everybody
> > it's a rather complicated woody question I have, at least for me :)
> > 
> > I have a data xml file like this:
> > 
> > <context>
> > 	<element title="A" value="true"/>
> > 	<element title="B" value="false"/>
> > </context>
> > 
> > now I want to bind the value of a boolean widget to these elements in @value.
> > problem: the binding must insert one value to one element with attribute content
"A"
> >  and insert another value to the other element with "B" inside.
> > 
> > both nodes have the same names, so what should I do?
> > the binding file must choose the element based on his attribute, so how can I do
this?
> 
> I think this should work:
> 
> <wb:value id="mywidget1" path="element[@title='A']/@value"/>
> <wb:value id="mywidget2" path="element[@title='B']/@value"/>
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message