Altering main menu in drupal 7 I am new to drupal, and i am trying to alter the code generated by my main menu. I would like to replace this : 

&lt;span thmr="thmr_249"&gt;&lt;ul id="main-menu" class="links inline clearfix"&gt;
&lt;li class="menu-227 first active"&gt;&lt;span thmr="thmr_250"&gt;&lt;a href="/" title="" class="active"&gt;Link1&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="menu-377"&gt;&lt;span thmr="thmr_251"&gt;&lt;a href="/link2" title="Au détail"&gt;link2&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/span&gt;


By this : 

&lt;a class="act" href="/"&gt;&lt;em&gt;&lt;em&gt;Link1&lt;/em&gt;&lt;/em&gt;&lt;/a&gt; 
&lt;a href="link2"&gt;&lt;em&gt;&lt;em&gt;link2&lt;/em&gt;&lt;/em&gt;&lt;/a&gt; 


The code i have added on my page.tpl.php 

print theme('links__system_main_menu', array('links' =&gt; $main_menu, 'attributes' =&gt; array('id' =&gt; 'main-menu', 'class' =&gt; array('links', 'inline', 'clearfix'))));


I have been looking around and found that it could be achieved by using theme_menu_link &amp; theme_item_list in my templatye file....no success so far. 

Can anyone show me the proper way to do it ? 
Thanks
It's a bit unusual request, but if you want to clear main menu from ul anl li tags and print just links, you can do that in this way:

template.php

/**
 * Main menu
 * Implements theme__menu_tree().
 */
function YOURTHEME_menu_tree__main_menu($variables) {
  return $variables['tree'];
}

/**
 * Main menu
 * Implements theme__menu_link().
 */
function YOURTHEME_menu_link__main_menu(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $element['#localized_options']['html'] = TRUE;
  $output = l('&lt;em&gt;' . $element['#title'] . '&lt;/em&gt;', $element['#href'], $element['#localized_options']);
  return $output . $sub_menu . "\n";
}


go to admin/structure/block and place main menu in header region (or wherever you want)

Result

&lt;a class="active" href="/some-path"&gt;&lt;em&gt;Link1&lt;/em&gt;&lt;/a&gt; 
&lt;a href="/another-path"&gt;&lt;em&gt;link2&lt;/em&gt;&lt;/a&gt;