Hi Libelah,
You could use an xpath to create a distinct list of the vehicle types, using something like this:
/vehicles/vehicle[not(type=preceding-sibling::vehicle/type)]/type
If you use that in an outer repeat, then put the value of "type" into a variable, you can then use an inner repeat with a path like:
/vehicles/vehicle[type=$currentType]
To loop through all of the vehicles in the list with the correct type and add them as rows to your table.
Regards,
Erica
-----Original Message-----
From: Libelah [mailto:
[hidden email]]
Sent: Thursday, December 17, 2009 2:27 AM
To:
[hidden email]
Subject: [ops-users] grouping nodes in repeat-Element
Hi,
my "problem" is a little hard to describe i think - lets try it anyway:-)
lets say you got an xml like the following <vehicles>
<vehicle>
<type>car</type>
<size>4</size>
<cost>11.000</cost>
</vehicle>
<vehicle>
<type>plane</type>
<size>10</size>
<cost>189.000</cost>
</vehicle>
<vehicle>
<type>car</type>
<size>5</size>
<cost>17.300</cost>
</vehicle>
<and so on...>
</vehicles>
Now what i would like to do with this xml is to go through all vehicle-Elements by using xforms:repeat and list them down. But there should be a table as result where there is only one row per vehicle/type and perhabs the total amount of vehicles belonging to this type or something like that. I'd also like to offer a button in this row then, where the user can click on "Open Details" and all the vehicles of the same type are listed then in an expanded row.
The Problem is: I don't know the possible types before. So I am searching for a good solution to kinda group the nodes by their element "type" or to check in every repeat if the type of the node already came up and if so, leaving it out.
I could then use a nested repeat when the first of a type occurs and list all the nodes with the same type (hiding/showing via CSS).
I hope this is understandable %-|
My only possible solution until now would be to save the types in a special node and to check if its already saved in there. But i wonder if there would be a better solution ? :confused:
Thanks in advance and regards!
--
View this message in context:
http://n4.nabble.com/grouping-nodes-in-repeat-Element-tp965281p965281.htmlSent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws