[XQuery/XForms] Change state elements of milestone elements in a specific order

Questions about XML that are not covered by the other forums should go here.
Posts: 1
Joined: Wed Mar 08, 2017 11:29 am

[XQuery/XForms] Change state elements of milestone elements in a specific order

Post by felix0815 » Wed Mar 08, 2017 11:35 am

Hello there,

I want to realize the functionality of a milestone chain where the states of the milestones should be edited step by step in a chronological order. For that I use XML as data structure, XQuery for the functionality and XForms and HTML for the user interface. I use eXist-db as the platform for the implementation.

My aim described with an example: The possible states of the milestones could be 'not started yet' and 'successful'. For example the user should just be able to change the state of the second milestone in the chain when the first milestone is already successful. The other way around: First the user has to declare the milestone on positon 1 as 'successful' before he is able to declare the second milestone as 'successful'.

Don't really know how to realize that. My first thought was to build the data structure of a milestone chain like that:

Code: Select all

<milestone position="1">
<name>Milestone 1</name>
<state>not started yet</state>
<milestone position="2">
<name>Milestone 2</name>
<state>not started yet</state>
<milestone position="3">
<name>Milestone 3</name>
<state>not started yet</state>
My thought is that I can check if the content of the element 'currentMilestone' is equal to the 'position' attribute of one of the containing milestones. If yes, the user should be able to change the content of the state element of exactly that milestone. But how can I realize that exactly that state element can be changed where the position attribute is equal to currentMilestone?
currentMilestone should be increased by 1 after changing the state but I think this is the smaller problem.

Best regards,