paolo,
apparently you make wrong use of the instance function. this is not
really obvious, but the spec states that the instance function always
has to return the *root node* of the specified instance instead of the
instance itself. therefore you should write
<xforms:bind
id="bind_count_items"
xforms:nodeset="xforms:instance('instance_2')"
xforms:calculate="count(xforms:instance('instance_1')/item)"/>
and it should work. this is not very intentionally. in my eyes this is
even a flaw of the spec.
regards, uli.
Paolo C. wrote:
Hi,
The attached form works well, except the item count
functionnality : the first line should display the
number of items in the list formatted as follows : "**
N ** items".
I can't get it to work. The number of items doesn't
appear.
Does someone see why ?
Thank you in advance.
Paolo Crisafulli
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
xml:base="http://localhost:8080/chiba-dev/"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<title>Simple item list</title>
<xforms:model id="model_1">
<!-- Instance data -->
<xforms:instance id="instance_1">
<items>
<item>it</item>
</items>
</xforms:instance>
<xforms:instance id="instance_2">
<count_items></count_items>
</xforms:instance>
<!-- Bindings -->
<xforms:bind id="bind_items"
xforms:nodeset="/items">
<!--xforms:bind id="count_item"
xforms:calculate="count(item)"/-->
<xforms:bind id="bind_item"
xforms:nodeset="item"/>
</xforms:bind>
<xforms:bind id="bind_count_items"
xforms:nodeset="xforms:instance('instance_2')/count_items"
xforms:calculate="count(xforms:instance('instance_1')/items/item)"/>
<xforms:submission id="submission_0"
xforms:action="jsp/debug-instance.jsp"
xforms:method="post" />
</xforms:model>
</head>
<body>
<!-- Group -->
<xforms:group id="group_1" appearance="minimal">
<xforms:label id="label_2">Item list - **
<xforms:output bind="bind_count_items"/> **
item(s)</xforms:label>
<!-- Add one item -->
<xforms:trigger id="trigger_2">
<xforms:label id="C-17"
xlink:href="images/add_new.gif">Insert after
selected</xforms:label>
<xforms:action id="action_2">
<xforms:insert id="insert_1"
xforms:at="xforms:index('repeat_1')"
xforms:bind="bind_item" xforms:position="after" />
</xforms:action>
</xforms:trigger>
<!-- Delete one item -->
<xforms:trigger id="trigger_3">
<xforms:label id="C-19"
xlink:href="images/delete.gif">Delete
selected</xforms:label>
<xforms:action id="action_3">
<xforms:delete id="delete_1"
xforms:at="xforms:index('repeat_1')"
xforms:bind="bind_item" />
</xforms:action>
</xforms:trigger>
<!-- Item list -->
<xforms:repeat id="repeat_1"
xforms:bind="bind_item" appearance="full">
<!-- Input Nom -->
<xforms:input id="input_1"
xforms:bind="bind_item">
<xforms:label id="label_3">Item
name</xforms:label>
</xforms:input>
</xforms:repeat>
</xforms:group>
<xforms:submit id="submit_0"
xforms:submission="submission_0">
<xforms:label id="label_7">Submit</xforms:label>
</xforms:submit>
</body>
</html>
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Chiba-developer mailing list
Chiba-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/chiba-developer
--
Ulrich Nicolas Lissé
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|