Index: src/perl/register-dataset.cgi
===================================================================
--- src/perl/register-dataset.cgi	(revision 2027)
+++ src/perl/register-dataset.cgi	(revision 2028)
@@ -439,36 +439,23 @@
 	    $$templateVars{'origNamelast10'} = $FORM::origNamelast10;
 	    $$templateVars{'origRole10'} = $FORM::origRole10;
 	    $$templateVars{'abstract'} = $FORM::abstract;
-	    $$templateVars{'keyword0'} = $FORM::keyword0;
-	    $$templateVars{'kwType0'} = $FORM::kwType0;
-	    $$templateVars{'kwTh0'} = $FORM::kwTh0;
-	    $$templateVars{'kwType1'} = $FORM::kwType1;
-	    $$templateVars{'keyword1'} = $FORM::keyword1;
-	    $$templateVars{'kwTh1'} = $FORM::kwTh1;
-	    $$templateVars{'kwType2'} = $FORM::kwType2;
-	    $$templateVars{'keyword2'} = $FORM::keyword2;
-	    $$templateVars{'kwTh2'} = $FORM::kwTh2;
-	    $$templateVars{'kwType3'} = $FORM::kwType3;
-	    $$templateVars{'keyword3'} = $FORM::keyword3;
-	    $$templateVars{'kwTh3'} = $FORM::kwTh3;
-	    $$templateVars{'kwType4'} = $FORM::kwType4;
-	    $$templateVars{'keyword4'} = $FORM::keyword4;
-	    $$templateVars{'kwTh4'} = $FORM::kwTh4;
-	    $$templateVars{'kwType5'} = $FORM::kwType5;
-	    $$templateVars{'keyword5'} = $FORM::keyword5;
-	    $$templateVars{'kwTh5'} = $FORM::kwTh5;
-	    $$templateVars{'kwType6'} = $FORM::kwType6;
-	    $$templateVars{'keyword6'} = $FORM::keyword6;
-	    $$templateVars{'kwTh6'} = $FORM::kwTh6;
-	    $$templateVars{'kwType7'} = $FORM::kwType7;
-	    $$templateVars{'keyword7'} = $FORM::keyword7;
-	    $$templateVars{'kwTh7'} = $FORM::kwTh7;
-	    $$templateVars{'kwType8'} = $FORM::kwType8;
-	    $$templateVars{'keyword8'} = $FORM::keyword8;
-	    $$templateVars{'kwTh8'} = $FORM::kwTh8;
-	    $$templateVars{'kwType9'} = $FORM::kwType9;
-	    $$templateVars{'keyword9'} = $FORM::keyword9;
-	    $$templateVars{'kwTh9'} = $FORM::kwTh9;
+	    $$templateVars{'keyCount'} = $FORM::keyCount;
+	    foreach my $kyd (param()) {
+		if ($kyd =~ /keyword/) {
+		    my $keyIndex = $kyd;
+		    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
+		    my $keyType = "kwType".$keyIndex;
+		    my $keyTh = "kwTh".$keyIndex;
+		    if ( $keyIndex =~ /[0-9]/ ){
+			if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
+			    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
+			    $$templateVars{$kyd} = param($kyd);
+			    $$templateVars{$keyType} = param($keyType);
+			    $$templateVars{$keyTh} = param($keyTh);
+			}
+		    }
+		}
+	    }
 	    $$templateVars{'addComments'} = $FORM::addComments;
 	    $$templateVars{'useConstraints'} = $FORM::useConstraints;
 	    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
@@ -618,36 +605,23 @@
     $$templateVars{'origNamelast10'} = $FORM::origNamelast10;
     $$templateVars{'origRole10'} = $FORM::origRole10;
     $$templateVars{'abstract'} = $FORM::abstract;
-    $$templateVars{'keyword0'} = $FORM::keyword0;
-    $$templateVars{'kwType0'} = $FORM::kwType0;
-    $$templateVars{'kwTh0'} = $FORM::kwTh0;
-    $$templateVars{'kwType1'} = $FORM::kwType1;
-    $$templateVars{'keyword1'} = $FORM::keyword1;
-    $$templateVars{'kwTh1'} = $FORM::kwTh1;
-    $$templateVars{'kwType2'} = $FORM::kwType2;
-    $$templateVars{'keyword2'} = $FORM::keyword2;
-    $$templateVars{'kwTh2'} = $FORM::kwTh2;
-    $$templateVars{'kwType3'} = $FORM::kwType3;
-    $$templateVars{'keyword3'} = $FORM::keyword3;
-    $$templateVars{'kwTh3'} = $FORM::kwTh3;
-    $$templateVars{'kwType4'} = $FORM::kwType4;
-    $$templateVars{'keyword4'} = $FORM::keyword4;
-    $$templateVars{'kwTh4'} = $FORM::kwTh4;
-    $$templateVars{'kwType5'} = $FORM::kwType5;
-    $$templateVars{'keyword5'} = $FORM::keyword5;
-    $$templateVars{'kwTh5'} = $FORM::kwTh5;
-    $$templateVars{'kwType6'} = $FORM::kwType6;
-    $$templateVars{'keyword6'} = $FORM::keyword6;
-    $$templateVars{'kwTh6'} = $FORM::kwTh6;
-    $$templateVars{'kwType7'} = $FORM::kwType7;
-    $$templateVars{'keyword7'} = $FORM::keyword7;
-    $$templateVars{'kwTh7'} = $FORM::kwTh7;
-    $$templateVars{'kwType8'} = $FORM::kwType8;
-    $$templateVars{'keyword8'} = $FORM::keyword8;
-    $$templateVars{'kwTh8'} = $FORM::kwTh8;
-    $$templateVars{'kwType9'} = $FORM::kwType9;
-    $$templateVars{'keyword9'} = $FORM::keyword9;
-    $$templateVars{'kwTh9'} = $FORM::kwTh9;
+    $$templateVars{'keyCount'} = $FORM::keyCount;
+    foreach my $kyd (param()) {
+	if ($kyd =~ /keyword/) {
+	    my $keyIndex = $kyd;
+	    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
+	    my $keyType = "kwType".$keyIndex;
+	    my $keyTh = "kwTh".$keyIndex;
+	    if ( $keyIndex =~ /[0-9]/ ){
+		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
+		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
+		    $$templateVars{$kyd} = param($kyd);
+		    $$templateVars{$keyType} = param($keyType);
+		    $$templateVars{$keyTh} = param($keyTh);
+		}
+	    }
+	}
+    }
     $$templateVars{'addComments'} = $FORM::addComments;
     $$templateVars{'useConstraints'} = $FORM::useConstraints;
     $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
@@ -1919,33 +1893,25 @@
     }
 
     $results = $doc->findnodes('//dataset/keywordSet');
-    if ($results->size() > 10) {
-        errMoreThanN("keywordSet");
-    } else {
-        my $count = 0;
-        foreach $node ($results->get_nodelist) {
-            $tempResult = $node->findnodes('./keyword');
-            if ($tempResult->size() > 1) {
-                errMoreThanOne("keyword");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    $$templateVars{"keyword$count"} = $tempNode->textContent();
-                    if ($tempNode->hasAttributes()) {
-                        my @attlist = $tempNode->attributes();
-                        $$templateVars{"kwType$count"} = $attlist[0]->value;
-                    }  
-                 } 
-            }
-            $$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
-            $count++;
-        }
+
+    my $count = 0;
+    foreach $node ($results->get_nodelist) {
+	$tempResult = $node->findnodes('./keyword');
+	if ($tempResult->size() > 1) {
+	    errMoreThanOne("keyword");
+	} else {
+	    foreach $tempNode ($tempResult->get_nodelist) {
+		$$templateVars{"keyword$count"} = $tempNode->textContent();
+		if ($tempNode->hasAttributes()) {
+		    my @attlist = $tempNode->attributes();
+		    $$templateVars{"kwType$count"} = $attlist[0]->value;
+		}  
+	    } 
+	}
+	$$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
+	$count++;
+    }
     
-        while ($count<11) {
-            $$templateVars{"kwType$count"} = "none";
-            $$templateVars{"kwTh$count"} = "none";
-            $count++;
-        }
-    }
 
     $results = $doc->findnodes('//dataset/additionalInfo');
     if ($results->size() > 1) {
@@ -2553,36 +2519,23 @@
         $$templateVars{'origRole10'} = $FORM::origRole10;
     }
     $$templateVars{'abstract'} = $FORM::abstract;
-    $$templateVars{'keyword0'} = $FORM::keyword0;
-    $$templateVars{'kwType0'} = $FORM::kwType0;
-    $$templateVars{'kwTh0'} = $FORM::kwTh0;
-    $$templateVars{'kwType1'} = $FORM::kwType1;
-    $$templateVars{'keyword1'} = $FORM::keyword1;
-    $$templateVars{'kwTh1'} = $FORM::kwTh1;
-    $$templateVars{'kwType2'} = $FORM::kwType2;
-    $$templateVars{'keyword2'} = $FORM::keyword2;
-    $$templateVars{'kwTh2'} = $FORM::kwTh2;
-    $$templateVars{'kwType3'} = $FORM::kwType3;
-    $$templateVars{'keyword3'} = $FORM::keyword3;
-    $$templateVars{'kwTh3'} = $FORM::kwTh3;
-    $$templateVars{'kwType4'} = $FORM::kwType4;
-    $$templateVars{'keyword4'} = $FORM::keyword4;
-    $$templateVars{'kwTh4'} = $FORM::kwTh4;
-    $$templateVars{'kwType5'} = $FORM::kwType5;
-    $$templateVars{'keyword5'} = $FORM::keyword5;
-    $$templateVars{'kwTh5'} = $FORM::kwTh5;
-    $$templateVars{'kwType6'} = $FORM::kwType6;
-    $$templateVars{'keyword6'} = $FORM::keyword6;
-    $$templateVars{'kwTh6'} = $FORM::kwTh6;
-    $$templateVars{'kwType7'} = $FORM::kwType7;
-    $$templateVars{'keyword7'} = $FORM::keyword7;
-    $$templateVars{'kwTh7'} = $FORM::kwTh7;
-    $$templateVars{'kwType8'} = $FORM::kwType8;
-    $$templateVars{'keyword8'} = $FORM::keyword8;
-    $$templateVars{'kwTh8'} = $FORM::kwTh8;
-    $$templateVars{'kwType9'} = $FORM::kwType9;
-    $$templateVars{'keyword9'} = $FORM::keyword9;
-    $$templateVars{'kwTh9'} = $FORM::kwTh9;
+    $$templateVars{'keyCount'} = $FORM::keyCount;
+    foreach my $kyd (param()) {
+	if ($kyd =~ /keyword/) {
+	    my $keyIndex = $kyd;
+	    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
+	    my $keyType = "kwType".$keyIndex;
+	    my $keyTh = "kwTh".$keyIndex;
+	    if ( $keyIndex =~ /[0-9]/ ){
+		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
+		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
+		    $$templateVars{$kyd} = param($kyd);
+		    $$templateVars{$keyType} = param($keyType);
+		    $$templateVars{$keyTh} = param($keyTh);
+		}
+	    }
+	}
+    }
     $$templateVars{'addComments'} = $FORM::addComments;
     $$templateVars{'useConstraints'} = $FORM::useConstraints;
     $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
@@ -2747,36 +2700,24 @@
     $$templateVars{'origNamelast10'} = $FORM::origNamelast10;
     $$templateVars{'origRole10'} = $FORM::origRole10;
     $$templateVars{'abstract'} = $FORM::abstract;
-    $$templateVars{'keyword0'} = $FORM::keyword0;
-    $$templateVars{'kwType0'} = $FORM::kwType0;
-    $$templateVars{'kwTh0'} = $FORM::kwTh0;
-    $$templateVars{'kwType1'} = $FORM::kwType1;
-    $$templateVars{'keyword1'} = $FORM::keyword1;
-    $$templateVars{'kwTh1'} = $FORM::kwTh1;
-    $$templateVars{'kwType2'} = $FORM::kwType2;
-    $$templateVars{'keyword2'} = $FORM::keyword2;
-    $$templateVars{'kwTh2'} = $FORM::kwTh2;
-    $$templateVars{'kwType3'} = $FORM::kwType3;
-    $$templateVars{'keyword3'} = $FORM::keyword3;
-    $$templateVars{'kwTh3'} = $FORM::kwTh3;
-    $$templateVars{'kwType4'} = $FORM::kwType4;
-    $$templateVars{'keyword4'} = $FORM::keyword4;
-    $$templateVars{'kwTh4'} = $FORM::kwTh4;
-    $$templateVars{'kwType5'} = $FORM::kwType5;
-    $$templateVars{'keyword5'} = $FORM::keyword5;
-    $$templateVars{'kwTh5'} = $FORM::kwTh5;
-    $$templateVars{'kwType6'} = $FORM::kwType6;
-    $$templateVars{'keyword6'} = $FORM::keyword6;
-    $$templateVars{'kwTh6'} = $FORM::kwTh6;
-    $$templateVars{'kwType7'} = $FORM::kwType7;
-    $$templateVars{'keyword7'} = $FORM::keyword7;
-    $$templateVars{'kwTh7'} = $FORM::kwTh7;
-    $$templateVars{'kwType8'} = $FORM::kwType8;
-    $$templateVars{'keyword8'} = $FORM::keyword8;
-    $$templateVars{'kwTh8'} = $FORM::kwTh8;
-    $$templateVars{'kwType9'} = $FORM::kwType9;
-    $$templateVars{'keyword9'} = $FORM::keyword9;
-    $$templateVars{'kwTh9'} = $FORM::kwTh9;
+    $$templateVars{'keyCount'} = $FORM::keyCount;
+    foreach my $kyd (param()) {
+	if ($kyd =~ /keyword/) {
+	    my $keyIndex = $kyd;
+	    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
+	    my $keyType = "kwType".$keyIndex;
+	    my $keyTh = "kwTh".$keyIndex;
+	    if ( $keyIndex =~ /[0-9]/ ){
+		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
+		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
+		    $$templateVars{$kyd} = param($kyd);
+		    $$templateVars{$keyType} = param($keyType);
+		    $$templateVars{$keyTh} = param($keyTh);
+		}
+	    }
+	}
+    }
+
     $$templateVars{'addComments'} = $FORM::addComments;
     $$templateVars{'useConstraints'} = $FORM::useConstraints;
     $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
