well am stuck again I am trying to group xml data based on the attribute 'name' value
XML Feed Return Data
<Sport sport_code="FOOT" name="Football" disporder="-1000">
<SBClass sb_class_id="12430" disporder="-999" name="France">
<SBType sb_type_id="26463" name="France - Coupe de France" disporder="52">
<Ev inplay_allowed="Y" status="A" name="Gazélec Fco Ajaccio v Sainte Marienne" start_time="2016-01-02T12:30:00" virtual="N" ev_timezone="Europe/London" inplay_now="Y" mkt_count="37" ev_id="3400770" disporder="-9996">
<EvDetail br_match_id="8548770"/>
<Inplay inplay_period_num="1" clock_status="TICKING" correct_at="2016-01-02T12:50:11" inplay_period="first_half" score_string="0-0" last_change="2016-01-01T09:45:07" inplay_secs="1209"/>
<Teams>
<Team team_id="3411" team_order="0" name="Gazélec Fco Ajaccio" short_name="Gazélec Fco Ajaccio"/>
<Team team_id="172231" team_order="1" name="Sainte Marienne" short_name="Sainte Marienne"/>
</Teams>
</Ev>
</SBType>
</SBClass>
<SBClass sb_class_id="12430" disporder="-999" name="UK">
<SBType sb_type_id="26463" name="France - Coupe de France" disporder="52">
<Ev inplay_allowed="Y" status="A" name="Gazélec Fco Ajaccio v Sainte Marienne" start_time="2016-01-02T12:30:00" virtual="N" ev_timezone="Europe/London" inplay_now="Y" mkt_count="37" ev_id="3400770" disporder="-9996">
<EvDetail br_match_id="8548770"/>
<Inplay inplay_period_num="1" clock_status="TICKING" correct_at="2016-01-02T12:50:11" inplay_period="first_half" score_string="0-0" last_change="2016-01-01T09:45:07" inplay_secs="1209"/>
<Teams>
<Team team_id="3411" team_order="0" name="Gazélec Fco Ajaccio" short_name="Gazélec Fco Ajaccio"/>
<Team team_id="172231" team_order="1" name="Sainte Marienne" short_name="Sainte Marienne"/>
</Teams>
</Ev>
</SBType>
</SBClass>
</Sport>
I want it to group ALL data based on SBClass attribute 'name' value e.g. France, UK ( this value is dynamic btw so cant add fixed string values )
Am really struggling with this. have tried other examples but they only work if the data to group by is inside the node eg <node>DATA</node>
Hope someone can help with this
** Edit **
I have tried most of the grouping suggestions that are here on S.O.
$xmlData = 'http://feeds-sports.winner.com/odds_feed?key=get_events_for_sport&sport_code=FOOT&on_date=2016-01-02';
$xml = simplexml_load_file($xmlData);
$leagues = $xml->xpath('/Sport/SBClass[@name="United Kingdom"]');
var_dump($leagues); // var_dump #1
Its not even dumping anything at all
I want it to display the data like this Category : France ( or relevant value from SBClass attribute 'name' ) SBType name value : e.g France - Coupe de France Ev name value : e.g Gazélec Fco Ajaccio v Sainte Marienne
Then display all data for "France"
Then all data for Category : UK etc
** 2ND EDIT ** Here is the XML feed showing ALL data http://feeds-sports.winner.com/odds_feed?key=get_match_markets_for_sport&lang=en&sb_class_id=12430&sport_code=FOOT&mkt_sort=MRES
I want to group it by the value of SBType->attributes()->{'name'}