Index: /gsdl/trunk/perllib/plugouts/FedoraMETSPlugout.pm
===================================================================
--- /gsdl/trunk/perllib/plugouts/FedoraMETSPlugout.pm	(revision 14969)
+++ /gsdl/trunk/perllib/plugouts/FedoraMETSPlugout.pm	(revision 14970)
@@ -84,5 +84,8 @@
     my $collection = $ENV{'GSDLCOLLECTION'};
 
-    my $extra_attr = "OBJID=\"$oid_namespace:$collection-$OID\" TYPE=\"FedoraObject\" LABEL=\"$doc_title\"";
+  # Might need the following in the schemeLocation attribute for Fedora3
+  #   http://www.fedora.info/definitions/1/0/mets-fedora-ext1-1.xsd
+
+    my $extra_attr = "OBJID=\"$oid_namespace:$collection-$OID\" TYPE=\"FedoraObject\" LABEL=\"$doc_title\" EXT_VERSION=\"1.1\"";
 
     $self->output_mets_xml_header_extra_attribute($handle,$extra_attr);
@@ -216,4 +219,44 @@
 
 
+sub buffer_mets_relsext_xml
+{
+    my $self = shift(@_);
+    my ($doc_obj) = @_;
+
+    my $OID = $doc_obj->get_OID();
+
+    my $fnamespace = $self->{'fedora_namespace'};
+    my $oid_namespace = (defined $fnamespace) ? $fnamespace : "test";
+    my $collection = $ENV{'GSDLCOLLECTION'};
+
+    my $fed_id = "$oid_namespace:$collection-$OID";
+
+    my $all_text = "";
+
+    my $top_section = $doc_obj->get_top_section();
+    my $plugin_type = $doc_obj->get_metadata_element($top_section,"Plugin");
+
+    if ((defined $plugin_type) && ($plugin_type eq "ImagePlug"))
+    {
+
+	$all_text .= "<mets:amdSec ID=\"RELS-EXT\">\n";
+	$all_text .= "  <mets:techMD ID=\"RELS-EXT1.0\" STATUS=\"A\">\n";
+	$all_text .= "    <mets:mdWrap LABEL=\"RELS-EXT - RDF formatted relationship metadata\" MDTYPE=\"OTHER\" MIMETYPE=\"text/xml\">\n";
+	$all_text .= "      <mets:xmlData>\n";
+	$all_text .= "        <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:fedora-model=\"info:fedora/fedora-system:def/model#\">\n";
+	$all_text .= "          <rdf:Description rdf:about=\"info:fedora/$fed_id\">\n";
+	$all_text .= "            <fedora-model:hasContentModel rdf:resource=\"info:fedora/demo:UVA_STD_IMAGE\"/>\n";
+	$all_text .= "          </rdf:Description>\n";
+	$all_text .= "        </rdf:RDF>\n";
+	$all_text .= "      </mets:xmlData>\n";
+	$all_text .= "    </mets:mdWrap>\n";
+	$all_text .= "  </mets:techMD>\n";
+	$all_text .= "</mets:amdSec>\n";
+    }
+
+    return $all_text;
+}
+
+
 #
 #  Print out docmets.xml file
@@ -226,4 +269,6 @@
     # print out the dmdSection
     print $handle $self->buffer_mets_dmdSection_section_xml($doc_obj,$section);
+
+    print $handle $self->buffer_mets_relsext_xml($doc_obj);
 
     print $handle "<mets:fileSec>\n";
@@ -453,5 +498,5 @@
     my $xlink_href;
 
-    my $fedora_prefix = $ENV{'FEDORA_PREFIX'};
+    my $fedora_prefix = $ENV{'FEDORA_HOME'};
     if (!defined $fedora_prefix) {
 	$xlink_href  = "file:$fname";
@@ -532,4 +577,6 @@
     my $opt_owner_id = "OWNERID=\"M\"";
 
+
+    my $first_assocfile = 1;
 
     foreach my $data (@{$section_ptr->{'metadata'}}){
@@ -542,6 +589,13 @@
 	   my $mime_type  = $2;
 	   my $assoc_dir  = $3;
-	   
-	   $id_root = $assoc_file;
+
+	   if ($first_assocfile) {
+	       $id_root = "url";
+	       $first_assocfile = 0;
+	   }
+	   else {
+	       $id_root = "FG$assoc_file";
+	   }
+
 	   $id_root =~ s/\//_/g;
 	   $all_text .= "  <mets:fileGrp ID=\"$id_root\">\n";
@@ -556,7 +610,7 @@
 	   my $xlink_href;
 
-	   $id_attr = "ID=\"$id_root.0\"";
-
-	   my $fedora_prefix = $ENV{'FEDORA_PREFIX'};
+	   $id_attr = "ID=\"F$id_root.0\"";
+
+	   my $fedora_prefix = $ENV{'FEDORA_HOME'};
 	   if (!defined $fedora_prefix) {
 	       $xlink_href  = "xlink:href=\"$assfilePath\"";
Index: /gsdl/trunk/perllib/plugouts/METSPlugout.pm
===================================================================
--- /gsdl/trunk/perllib/plugouts/METSPlugout.pm	(revision 14969)
+++ /gsdl/trunk/perllib/plugouts/METSPlugout.pm	(revision 14970)
@@ -198,5 +198,6 @@
     print $handle '           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
     print $handle '           xmlns:gsdl3="http://www.greenstone.org/namespace/gsdlmetadata/1.0/"' . "\n";
-    print $handle '           xmlns:xlink="http://www.w3.org/TR/xlink"' ."\n";
+##    print $handle '           xmlns:xlink="http://www.w3.org/TR/xlink"' ."\n";
+    print $handle '           xmlns:xlink="http://www.w3.org/1999/xlink"' ."\n";
     print $handle '           xsi:schemaLocation="http://www.loc.gov/METS/' . "\n";
     print $handle '           http://www.loc.gov/standards/mets/mets.xsd' . "\n";
