Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java	(revision 25804)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java	(revision 25805)
@@ -106,11 +106,11 @@
 			Element elem = (Element) metadata_nodes.item(i);
 			StringBuffer metadata = new StringBuffer();
-			String all = elem.getAttribute("multiple");
+			String pos = elem.getAttribute("pos");
 			String name = elem.getAttribute("name");
 			String select = elem.getAttribute("select");
 			String sep = elem.getAttribute("separator");
-			if (all.equals("true"))
-			{
-				metadata.append("all");
+			if (!pos.equals(""))
+			{
+			    metadata.append("pos"+pos); // first, last or indexing number
 				metadata.append(GSConstants.META_RELATION_SEP);
 			}
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java	(revision 25804)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java	(revision 25805)
@@ -369,9 +369,9 @@
 	protected String getMetadata(String node_id, DBInfo info, String metadata, String lang)
 	{
-		boolean multiple = false;
+		String pos = "";
 		String relation = "";
 		String separator = ", ";
-		int pos = metadata.indexOf(GSConstants.META_RELATION_SEP);
-		if (pos == -1)
+		int index = metadata.indexOf(GSConstants.META_RELATION_SEP);
+		if (index == -1)
 		{
 			Vector<String> values = info.getMultiInfo(metadata);
@@ -402,12 +402,15 @@
 		}
 
-		String temp = metadata.substring(0, pos);
-		metadata = metadata.substring(pos + 1);
-		// check for all on the front
-		if (temp.equals("all"))
-		{
-			multiple = true;
-			pos = metadata.indexOf(GSConstants.META_RELATION_SEP);
-			if (pos == -1)
+		String temp = metadata.substring(0, index);		
+		metadata = metadata.substring(index + 1);
+		// check for pos on the front, indicating which piece of meta the user wants
+		// pos can be "first", "last" or the position value of the requested piece of metadata 
+		if (temp.startsWith(GSConstants.META_POS))
+		{
+			temp = temp.substring(GSConstants.META_POS.length());
+			pos = temp;
+			
+			index = metadata.indexOf(GSConstants.META_RELATION_SEP);
+			if (index == -1)
 			{
 				temp = "";
@@ -415,15 +418,17 @@
 			else
 			{
-				temp = metadata.substring(0, pos);
-				metadata = metadata.substring(pos + 1);
+				temp = metadata.substring(0, index);
+				metadata = metadata.substring(index + 1);
 			}
 		}
 
 		// now check for relational info
-		if (temp.equals("parent") || temp.equals("root") || temp.equals("ancestors"))
+		if (temp.equals("parent") || temp.equals("root") || temp.equals("ancestors")
+		     || temp.equals("siblings") || temp.equals("children") || temp.equals("descendants"))
 		{ // "current" "siblings" "children" "descendants"
+			// gets all siblings by default
 			relation = temp;
-			pos = metadata.indexOf(GSConstants.META_RELATION_SEP);
-			if (pos == -1)
+			index = metadata.indexOf(GSConstants.META_RELATION_SEP);
+			if (index == -1)
 			{
 				temp = "";
@@ -431,6 +436,6 @@
 			else
 			{
-				temp = metadata.substring(0, pos);
-				metadata = metadata.substring(pos + 1);
+				temp = metadata.substring(0, index);
+				metadata = metadata.substring(index + 1);
 			}
 		}
@@ -474,13 +479,27 @@
 
 		StringBuffer result = new StringBuffer();
-
-		if (!multiple)
-		{
-			result.append(this.macro_resolver.resolve(relation_info.getInfo(metadata), lang, MacroResolver.SCOPE_META, relation_id));
+		
+		Vector<String> values = relation_info.getMultiInfo(metadata);
+
+		if (!pos.equals("")) // if a particular position was specified, so not multiple values for the metadata
+		{
+			String meta = "";
+			if (values != null) {
+				if(pos.equals(GSConstants.META_FIRST)) {				
+					meta = values.firstElement();
+				} else if(pos.equals(GSConstants.META_LAST)) {
+					meta = values.lastElement();
+				} else {
+					int position = Integer.parseInt(pos);
+					if(position < values.size()) {			
+						meta = values.elementAt(position);
+					}
+				}				
+			} // else ""
+						
+			result.append(this.macro_resolver.resolve(meta, lang, MacroResolver.SCOPE_META, relation_id));			
 		}
 		else
 		{
-			// we have multiple meta
-			Vector<String> values = relation_info.getMultiInfo(metadata);
 			if (values != null)
 			{
@@ -515,12 +534,27 @@
 			if (relation_info == null)
 				return result.toString();
-			if (!multiple)
-			{
+			
+			values = relation_info.getMultiInfo(metadata);
+			if (!pos.equals("")) // if a particular position was specified, so not multiple values for the metadata
+			{
+				String meta = "";
+				if (values != null) {
+					if(pos.equals(GSConstants.META_FIRST)) {
+						meta = values.firstElement();
+					} else if(pos.equals(GSConstants.META_LAST)) {
+						meta = values.lastElement();
+					} else {
+						int position = Integer.parseInt(pos);
+						if(position < values.size()) {			
+							meta = values.elementAt(position);
+						}
+					}				
+				} // else ""
+				
 				result.insert(0, separator);
-				result.insert(0, this.macro_resolver.resolve(relation_info.getInfo(metadata), lang, MacroResolver.SCOPE_META, relation_id));
+				result.insert(0, this.macro_resolver.resolve(meta, lang, MacroResolver.SCOPE_META, relation_id));							
 			}
 			else
 			{
-				Vector<String> values = relation_info.getMultiInfo(metadata);
 				if (values != null)
 				{
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSConstants.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSConstants.java	(revision 25804)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSConstants.java	(revision 25805)
@@ -32,3 +32,6 @@
     public static final String META_RELATION_SEP = "_";
     public static final String META_SEPARATOR_SEP = "*";
+    public static final String META_FIRST = "first";
+    public static final String META_LAST = "last";
+    public static final String META_POS = "pos";
 }
Index: /main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl	(revision 25804)
+++ /main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl	(revision 25805)
@@ -183,6 +183,8 @@
 
 	<xsl:template match="gsf:metadata" mode="get-metadata-name">
-		<xsl:if test="@multiple='true'">
-			<xsl:text>all_</xsl:text>
+		<xsl:if test="@pos">
+			<xsl:text>pos</xsl:text>
+			<xsl:value-of select='@pos'/>
+			<xsl:text>_</xsl:text>
 		</xsl:if>
 		<xsl:if test='@select'>
@@ -191,5 +193,5 @@
 		</xsl:if>
 		<xsl:if test="@separator">
-			<xsl:text>*</xsl:text>
+		  	<xsl:text>*</xsl:text>
 			<xsl:value-of select='@separator'/>
 			<xsl:text>*_</xsl:text>
@@ -197,6 +199,22 @@
 		<xsl:value-of select="@name"/>
 	</xsl:template>
-  
-	<xsl:template match="gsf:metadata-old">
+
+	<xsl:template match="gsf:metadata-old" mode="get-metadata-name">
+		<xsl:if test="@multiple='true'">
+			<xsl:text>all_</xsl:text>
+		</xsl:if>
+		<xsl:if test='@select'>
+			<xsl:value-of select='@select'/>
+			<xsl:text>_</xsl:text>
+		</xsl:if>
+		<xsl:if test="@separator">
+		  	<xsl:text>*</xsl:text>
+			<xsl:value-of select='@separator'/>
+			<xsl:text>*_</xsl:text>
+		</xsl:if>
+		<xsl:value-of select="@name"/>
+	</xsl:template>
+  
+	<xsl:template match="gsf:metadata-older">
 		<xslt:value-of disable-output-escaping="yes">
 			<xsl:attribute name="select">
