{source}<!– You can place html anywhere within the source tags –>

<script language=”javascript” type=”text/javascript”> // You can place JavaScript like this </script>

    function addParam($params, $param)
    global $params ;
    $p= trim($param);
    if( !array_key_exists((string)$p, $params))
     $params[$p]= new typeParam ($p);

    class typeParam
    var $name;
    var $records;
    var $count;

    function typeParam( $name)

    function addRecord($record)
// echo “Add record : “.$record->label.”<br>”;
function cite($record)
     foreach($record->contributors->authors->author as $author)
         $authors .= $author.”, “;
     $out= substr($authors,0,strlen($authors)-2);
     $out.= ” (“.$record->dates->year.”). “;
     $out.= $record->titles->title.”. “;
     if( isset ($record->titles->{‘secondary-title’}) )
         $out.= $record->titles->{‘secondary-title’}.”. “;
     if( isset ($record->volume) )
         if( isset ($record->issue) )
         $out.= $record->volume.”($record->issue), “.$record->pages.”. “;
         else $out.= $record->volume.”, “.$record->pages.”. “;
     if( isset ($record->{‘electronic-resource-num’}) )
         if( isset ($record->urls->{‘web-urls’}->url) )
         $out.= “doi: <a href=”.$record->urls->{‘web-urls’}->url.”>”.
                    $record->{‘electronic-resource-num’}.”</a>; “;
         else $out.= “doi: “.$record->{‘electronic-resource-num’}. “; “;
     return $out;

function cmp($a, $b)
    return strcasecmp($a, $b);

    function xml2html($xmlFile)
    global $params ;
    // Chargement du document XML
    if ( !($doc= simplexml_load_file($xmlFile) ) )
     return “Can’ot load or parse file “.$xmlFile;

    $params =array();
    // création de la table des parametres
    $labels = $doc->xpath(‘//*/label’);
    foreach ($labels as $label)
     foreach ($tab as $param) addParam( $params, $param);
    uksort ($params, “strnatcmp”);
    // association des record aux parametres
    $records = $doc->xpath(‘//record’);
    foreach ($params as $param)
     foreach($records as $record)
        if( strstr($record->label, $param->name) )

    // écriture de l’html produit
    $outHtml ='<p style=”text-align: justify;”><span style=”font-size: 10pt; font-family: arial, helvetica, sans-serif;”> Below is a list of publications, ordered by <a href=”/cruises/cruise-programme” target=”_blank”>GEOTRACES cruise</a> and parameter (view <a href=”/images/stories/documents/Parameter_Naming/Parameter_Naming_Conventions_14June.pdf” target=”_blank”>parameter naming conventions</a>), that data users will be requested to cite when using the IDP data.&nbsp;</span><strong><span style=”font-size: 10pt; font-family: arial, helvetica, sans-serif;”>HOWEVER, IF YOU HAVE REACHED THIS LINE FOLLOWING AN IDP DATA LINK, THIS MEANS THAT THESE DATA ARE UNPUBLISHED.</span></strong> </p> <p style=”text-align: justify;”>&nbsp;</p> <p style=”text-align: justify;”>&nbsp;</p> <p style=”text-align: justify;”>&nbsp;</p> <p style=”text-align: justify;”>&nbsp;</p>’;

    foreach ($params as $param)
// echo “<p><b><a href=“.$param->name.”>$param->name</a></b>: ($param->count )<br>”;
     $outHtml .= “<p><b><a NAME=”.$param->name.”>$param->name</a></b>: ($param->count )<br>”;
     $outHtml .= “<font size=-1>”;
     foreach($param->records as $record)
        $outHtml .=”<br>”.$param->cite($record).”<br>”;
     $outHtml .= “</font><br><br><br><br><br><br><br><br><br><br><br>”;
    return $outHtml;

// Main
    echo xml2html(“/home/wmgeotraces/GEOTRACES3/images/stories/idp/testGeotrace.xml”);