xpath - if else structure

Gliliaden

New Member
i am experimenting with xpath. Here is the xml I am using for experimenting:\[code\]<moves> <roll player="1">6</roll> <piece nr="1" player="1" field="1"/> <roll player="2">4</roll> <roll player="2">6</roll> <piece nr="5" player="2" field="11"/> <roll player="1">4</roll> <piece nr="1" player="1" field="5"/> <roll player="2">6</roll> <piece nr="5" player="2" field="17"/> <roll player="1">6</roll> <piece nr="2" player="1" field="1"/> <roll player="2">6</roll> <piece nr="6" player="2" field="11"/></moves>\[/code\]So how to implement an if else in xpath?Like if the second action is from player one, then do f.ex.: give it back...UPDATE 1:Ok here is what i mean:\[code\]boolean(/game/moves/roll[2]/@player=1\[/code\]That gives me back if the second element is player 1 or not ,so now I want to add an else-Path like if it would be? So how to add that?
 
Back
Top