Drupal adding own css class in taxonomy terms links

Hi want to add some own css class in taxonomy terms links (depending on vocabulary), and change links order (depending on
vocabularies too).

"How?" is the question!

- link_alter hook doesn't seem to be the right place because I don't find any param to add css class, and it doesn't play with
links order.
- it's possible to modify $terms html string in the preprocess_node function (in template.php), but it's doesn't sound like a
clean way... 

It's possible to add a 'class' attribute to links, and taxonomy links come all together, so it's possible to reorder if wanted.

The value of $terms is generated in the theme layer so it's
appropriate to modify it there. Check out:
http://api.drupal.org/api/function/template_preprocess_node/6

First, a $taxonomy variable is created with: $variables['taxonomy'] =
taxonomy_link('taxonomy terms', $node);

The value of $terms is created with: $variables['terms'] =
theme('links', $variables['taxonomy'], array('class' => 'links
inline'));

Check out the theme_links doc
(http://api.drupal.org/api/function/theme_links/6). If you can't add
your CSS the way you want to using the $attributes parameter, you'll
need to create a custom function.


the solution I took :

function edulibre_link_alter(&$links, $node) {
 // we just want to alter taxonomy terms
 if (strpos(key($links), 'taxonomy_term_') !== FALSE) {
   // our vocabularies specific css classes
   $classes = array(
     VID_KEYWORDS => 'keywords',
     VID_TYPE => 'type',
     VID_LEVEL => 'level',
     VID_SUBJECT => 'subject',
   );
   foreach ($links as $key => &$link) {
       $link['attributes']['class'] = $classes[$node->taxonomy[substr($key, 14)]->vid];
   }
 }
}

I don't play with order here, because I saw it's enough to change vocabularies order in admin/content/taxonomy.