Index: /MDService2/trunk/MDService2/src/mdservice.properties
===================================================================
--- /MDService2/trunk/MDService2/src/mdservice.properties	(revision 1478)
+++ /MDService2/trunk/MDService2/src/mdservice.properties	(revision 1479)
@@ -17,8 +17,8 @@
 //cache.path = /srv/tomcat6/webapps/MDService2_cache/
 //workspaceprofile.path = /srv/tomcat6/webapps/MDService2_profiles/
-//cache.path = C:/apps/apache-tomcat/webapps/MDService2_cache/
-//workspaceprofile.path = C:/apps/apache-tomcat/webapps/MDService2_profiles/
-cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/
-workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_profiles/
+cache.path = C:/apps/apache-tomcat/webapps/MDService2_cache/
+workspaceprofile.path = C:/apps/apache-tomcat/webapps/MDService2_profiles/
+//cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/
+//workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_profiles/
 workspace.file = WorkspaceProfile.xml
 
@@ -33,6 +33,7 @@
 xsl.sru2htmlpage = sru2view.xsl
 xsl.sru2htmltable = sru2view.xsl
-xsl.pazpar22htmlpage = pazpar2view.xsl
-xsl.pazpar22htmltable = pazpar2view.xsl
+xsl.pazpar22htmlpage = mdset_pazpar2view.xsl
+xsl.pazpar22htmlpagelist = mdset_pazpar2view.xsl
+xsl.pazpar22htmltable = mdset_pazpar2view.xsl
 xsl.record2htmldetail = mdinst2view.xsl
 xsl.record2htmlpage = mdinst2view.xsl
Index: /MDService2/trunk/MDService2/src/xsl/cmd_commons.xsl
===================================================================
--- /MDService2/trunk/MDService2/src/xsl/cmd_commons.xsl	(revision 1478)
+++ /MDService2/trunk/MDService2/src/xsl/cmd_commons.xsl	(revision 1479)
@@ -38,5 +38,5 @@
 
 <xsl:template match="/">
-		<xsl:message>root_document-uri:<xsl:value-of select="$root_uri" /></xsl:message>		
+	<!--	<xsl:message>root_document-uri:<xsl:value-of select="$root_uri" /></xsl:message>-->		
 	  	<xsl:choose>    		
     	 	<xsl:when test="contains($format,'htmlpage')" >
Index: /MDService2/trunk/MDService2/src/xsl/mdset_pazpar2view.xsl
===================================================================
--- /MDService2/trunk/MDService2/src/xsl/mdset_pazpar2view.xsl	(revision 1479)
+++ /MDService2/trunk/MDService2/src/xsl/mdset_pazpar2view.xsl	(revision 1479)
@@ -0,0 +1,431 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet
+  version="2.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:saxon="http://saxon.sf.net/"
+  xmlns:my="myFunctions" 
+>
+<!-- 
+<purpose> generate html view (probably various formats of a MDRepository response.</purpose>
+<params>
+<param name=""></param>
+</params>
+<history>	
+	<change on="2010-03-26" type="created" by="vr">based on cmdi/scripts/cmdinst2view.xsl</change>	
+</history>
+-->
+ <xsl:import href="model2matrix.xsl"/>
+<xsl:import href="terms2view.xsl"/> 
+	<xsl:import href="cmd_commons.xsl"/>
+	<xsl:import href="util_xml_ay.xsl"/>
+
+<xsl:output method="html" />
+
+<xsl:param name="startItem">1</xsl:param>
+<xsl:param name="maximumItems">50</xsl:param>
+
+<!-- <xsl:param name="format" select="'table'" /> table|list|detail -->
+<xsl:param name="cols" >auto
+	<!--  Id,Title,Location
+<col label="id">Id</col>
+<col label="id">idno</col>
+<col label="name">Name</col>
+<col label="title">Title</col>
+<col label="title">title</col>
+<col label="loc" >Location</col>
+<col label="loc" >pubPlace</col>
+<col label="lang" >language</col>
+
+ -->
+</xsl:param>
+
+<xsl:param name="mode" select="'html'" />
+<xsl:param name="title" >
+	<xsl:text>MDRecordSet </xsl:text>
+</xsl:param>
+
+	<xsl:param name="numberOfRecords" >
+		<xsl:value-of select="/searchRetrieveResponse/numberOfRecords | /show/total"></xsl:value-of>
+	</xsl:param>
+	
+	<xsl:variable name="records" >
+		<xsl:choose>
+			<xsl:when test="exists(/show/hit)">
+				<xsl:copy-of select="/show/hit"  />
+			</xsl:when>				
+			<xsl:otherwise>
+				<xsl:copy-of select="/searchRetrieveResponse/records/record"  />
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+
+<xsl:variable name="columns" >
+<!-- <xsl:message>COLUMNS: <xsl:value-of select="$cols" /><xsl:value-of select="string-length($cols)" /></xsl:message>  -->
+	<xsl:variable name="colarray" select="tokenize($cols,',')"/>
+	<xsl:for-each select="$colarray" >
+		<col key="{.}" label="{replace(.,'^.*\.([^.]+)$','$1')}" xpath_osbolete="{replace(.,'\.','/')}" xpath="{my:index2xpath(.)}" />
+		<!-- if (contains(.,'.')) then reverse(.) else . -->
+	</xsl:for-each>
+	<xsl:if test="count($colarray)=0" >	
+		<xsl:copy-of select="$autocolumns"></xsl:copy-of>
+		 <xsl:message>AUTOCOLUMNS: <xsl:copy-of select="$autocolumns" /><xsl:value-of select="count($autocolumns)" /></xsl:message> 
+	</xsl:if>
+	
+</xsl:variable>
+
+<xsl:variable name="autocolumns" >
+	<xsl:variable name="precompute">
+		<xsl:for-each-group select="//Components//*[not(*)][exists(text())]" group-by="name()" >			
+			<xsl:sort select="sum(current-group()/string-length(string-join(text(),';')))" order="descending" />
+			<!-- <xsl:message>precomputing: <xsl:value-of select="name()" />
+				count: <xsl:value-of select="count(current-group())" /> sum:<xsl:value-of select="sum(current-group()/string-length(string-join(text(),';')))" /></xsl:message> -->
+			<col key="{name()}" label="{name()}" xpath="{name()}" />
+		</xsl:for-each-group>
+	</xsl:variable>
+	 <!-- <xsl:message>precompute: <xsl:copy-of select="$precompute" /><xsl:value-of select="count($precompute)" /></xsl:message>-->
+	<xsl:copy-of select="$precompute/*[position() &lt; $autocolumns_limit]"></xsl:copy-of> 
+</xsl:variable>
+
+<xsl:template name="continue-root" >
+
+<xsl:for-each select="searchRetrieveResponse | show" >
+	<xsl:if test="not(contains($format, 'htmlsimple'))">
+		<xsl:call-template name="header" />
+	</xsl:if>
+	
+	<!--DEBUG:<code><xsl:copy-of select="$records" /></code>
+	;format=<xsl:value-of select="$format"/> (<xsl:value-of select="contains($format, 'htmlpagelist')" />)-->
+	<xsl:choose>
+				<xsl:when test="contains($format,'htmltable')">
+					<xsl:apply-templates select="records" mode="table" />
+				</xsl:when>				
+				<xsl:when test="contains($format,'htmllist')">
+					<xsl:apply-templates select="records" mode="list" />
+				</xsl:when>				
+				<xsl:when test="contains($format, 'htmldetail')">
+					<xsl:apply-templates select="records" mode="detail" />
+				</xsl:when>
+				<xsl:when test="contains($format, 'htmlpagelist')">
+					<xsl:call-template name="record-list" />
+					<!-- <xsl:apply-templates select="$records" mode="list" />-->
+				</xsl:when>		
+				<xsl:when test="contains($format, 'htmlpage')">
+<!--					<xsl:apply-templates select="records" mode="table" />-->
+						<xsl:call-template name="record-list" />
+				</xsl:when>
+				<xsl:when test="contains($format, 'htmlsimple')">
+					<xsl:apply-templates select="records" mode="simple" />
+				</xsl:when>		
+				<xsl:otherwise>mdset_pazpar2view: unrecognized format: <xsl:value-of select="$format" /></xsl:otherwise>
+	</xsl:choose>
+</xsl:for-each>	
+	
+</xsl:template>	
+	
+	
+<xsl:template match="*" >
+	<!-- <xsl:param name="lv" select="1" />-->
+	<!--<xsl:variable name="lv" select="count(ancestor::d)" /> -->
+	<!-- <xsl:if test="string-length(string-join(.//text(),'')) &gt; 1" > -->		 
+		<xsl:variable name="has_text" >
+			<xsl:choose>
+			<!-- FIXME: text()[1] ? is that safe?-->
+				<xsl:when test="normalize-space(text()[1])='Unspecified'">unspecified</xsl:when>
+				<xsl:when test="not(normalize-space(text()[1])='')">text</xsl:when>				
+				<xsl:otherwise>empty</xsl:otherwise>
+			</xsl:choose>
+			
+		</xsl:variable>
+		<div class="elem {$has_text}" ><span class="elem_name"><xsl:value-of select="name()" />:</span>
+		<span class="elem_value"><xsl:value-of select="text()" /></span>
+			<xsl:apply-templates select="*" />					
+		</div>
+	
+</xsl:template>	
+	
+	<!--
+sample header:	
+<numberOfRecords>524</numberOfRecords>
+    <echoedSearchRetrieveRequest>//Title[contains(.,'an')] /db/cmdi-mirror/silang_data 1 50</echoedSearchRetrieveRequest>
+    <diagnostics>50</diagnostics>
+    -->
+<xsl:template name="header">
+	<div class="result-header" >
+	<xsl:attribute name="max_value"><xsl:value-of select="$numberOfRecords" /></xsl:attribute>
+	<xsl:variable name="cnt_hits" select="number(diagnostics|/show/num)" />
+	
+	<span class="label" >hits: </span><span class="value hilight"><xsl:value-of select="$numberOfRecords" /></span>;
+	<span class="label" >from:</span><span><input type="text" class="value start_record paging-input"><xsl:attribute name="value">
+    <xsl:value-of select="$startItem"/>
+  </xsl:attribute>
+	</input></span>
+	<span class="label" >max:</span><span><input type="text" class="value maximum_records paging-input" ><xsl:attribute name="value">
+    <xsl:value-of select="if(number($cnt_hits) &lt; number($maximumItems)) then $cnt_hits else $maximumItems"/>    
+	</xsl:attribute></input></span>
+		<!--
+  <span class="cmd cmd_reload" />  
+<!-\-	<button class="reload">reload</button>-\->
+	<span class="cmd cmd_prev">	
+	<xsl:choose>
+		<xsl:when test="$startItem = '1'">
+			<xsl:attribute name="disabled">disabled</xsl:attribute>
+		</xsl:when>
+		</xsl:choose>
+	</span>
+	<span class="cmd cmd_next">	
+	<xsl:choose>
+		<xsl:when test="$maximumItems &gt;= $numberOfRecords">
+			<xsl:attribute name="disabled">disabled</xsl:attribute>
+		</xsl:when>
+		</xsl:choose>
+	</span>
+	<span class="cmd cmd_detail" />	
+	<!-\-  <div class='ui-context-dialog ui-widget-content columns-wrapper'>  -\->
+		<div class='ui-widget-content columns-wrapper'>
+			<div class='cmds'><span class="cmd cmd_reload" /><span class="cmd cmd_save" /><span class="cmd cmd_savenew" /></div>
+			<div class='query-columns'>
+			<label>Columns</label>
+				<xsl:call-template name="columns" />
+			</div>
+		</div>
+		-->
+		
+		<label>Columns</label>
+			<xsl:call-template name="columns" />		
+    </div>
+    <div class="note" ><span class="label" >echo: </span><span class="value"><xsl:value-of select="echoedSearchRetrieveRequest" /></span>;<span class="label" >duration: </span><span class="value"><xsl:value-of select="extraResponseData/duration" /></span>;</div>
+</xsl:template>	
+
+<xsl:template name="columns">
+	<table>
+	<tr><td valign="top">
+	<div class="columns-selected" >	
+	<!-- 
+		<span class="label">selected columns</span>
+		<ul class="query-columnslist">
+			<xsl:for-each select="$columns/*">
+  				<li><xsl:value-of select="@label"/><span class='cmd cmd_del'/></li>
+  			</xsl:for-each>
+  		</ul>
+	 -->
+  	</div>
+  	</td><td valign="top">
+  		<div>
+  		  	<span class="label" >format:</span>
+			<select class="value-format">
+			
+			<option value="htmltable">
+				<xsl:choose>
+				<xsl:when test="contains($format, 'htmltable')">
+					<xsl:attribute name="selected">selected</xsl:attribute>
+				</xsl:when>
+				</xsl:choose><xsl:text>table</xsl:text>		
+			</option>
+			<option value="htmllist">
+				<xsl:choose>
+				<xsl:when test="contains($format, 'htmllist')">
+					<xsl:attribute name="selected">selected</xsl:attribute>
+				</xsl:when>
+				</xsl:choose><xsl:text>list</xsl:text>
+			</option>
+			</select>
+		</div>
+  	<xsl:if test="extraResponseData/usedProfiles" >
+  		<div class="used-profiles">
+	  		<span class="label">used profiles in whole result</span>
+			<ul>
+				<xsl:for-each select="extraResponseData/usedProfiles/profile" >
+					<li><a href="{@id}" ><xsl:value-of select="@name"/></a><span class="note">|<xsl:value-of select="@count"/>|</span></li>
+				</xsl:for-each>
+			</ul>
+		</div>
+	</xsl:if>
+	</td></tr>	
+	<xsl:variable name="resultSummary" >		
+		<!-- wrap in <Terms> to make digestible for model2matrix -->
+		<xsl:variable name="terms" >
+			<Terms>
+			<!-- TODO: if already provided by mdrepo, use that, otherwise DIY -->		
+			<xsl:choose>
+				<xsl:when test="extraResponseData/resultSummary"><xsl:copy-of select="extraResponseData/resultSummary/Term" /></xsl:when>
+				<xsl:otherwise>
+					<xsl:call-template name="xml-ay">
+						<xsl:with-param name="dataset" select="$records"></xsl:with-param>
+					</xsl:call-template>
+				</xsl:otherwise>
+			</xsl:choose>
+			</Terms>
+		</xsl:variable>
+		<!-- <xsl:apply-templates select="$terms" mode="matrix" />-->
+		<xsl:copy-of select="$terms"></xsl:copy-of>
+	</xsl:variable> 	
+		<!--<xsl:message><xsl:copy-of select="$resultSummary"></xsl:copy-of></xsl:message>-->
+	
+	<tr><td colspan="2">	
+	<div class="result-summary">	
+		<span class="label">structure summary of shown result</span>	
+		<!--  calling template in terms2view.xsl -->		
+		<xsl:apply-templates select="$resultSummary" mode="terms-tree" />		
+	</div>	
+	</td></tr>
+	</table>
+</xsl:template>
+
+
+<xsl:template match="records" mode="table">
+    
+	<table class="show">		
+		<thead><tr><th>pos</th>		
+			<xsl:for-each select="$columns/*">
+  				<th title="{@key}" ><xsl:value-of select="@label"/></th>
+  			</xsl:for-each>  			
+		</tr></thead>
+		<tbody>		
+			<xsl:apply-templates select="CMD" mode="table" />			
+		</tbody>
+	</table>
+
+</xsl:template>
+
+
+<xsl:template name="record-list" >
+    
+	<table class="show">		
+		<thead><tr><th>pos</th><th>record</th>			  			
+		</tr></thead>
+		<tbody>		
+			<xsl:apply-templates select="$records" mode="listitem" />			
+		</tbody>
+	</table>
+
+</xsl:template>
+	
+	
+
+<!-- FIXME:   there should be a @match=`record` template to make it SRU-compatible -->
+
+<xsl:template match="*" mode="tablerow">
+
+	<xsl:variable name="curr_record" select="." />
+	<xsl:variable name="fields" >
+		<xsl:for-each select="$columns/*">
+	  			<!-- <td ><xsl:value-of select="$curr_cmd//*[name()=current()]" /></td> -->
+	<!--  	<xsl:message><xsl:copy-of select="."></xsl:copy-of> </xsl:message> -->
+	 				 <xsl:variable name="curr_col_xpath" select="@xpath" />
+	  			<td> 			
+	  				<xsl:for-each select="$curr_record">
+	  					<xsl:call-template name="format-field" >
+	  						<xsl:with-param name="elems" select="saxon:evaluate(concat('.//', $curr_col_xpath))" />
+	  					</xsl:call-template> 					
+	  				
+	  				</xsl:for-each>
+	  			</td>
+	  			</xsl:for-each>
+	  </xsl:variable>
+
+	<xsl:call-template name="record-table-row" >
+		<xsl:with-param name="fields" select="$fields" />
+	</xsl:call-template>
+	
+</xsl:template>
+
+<xsl:template match="hit" mode="listitem">
+
+		<xsl:variable name="curr_record" select="." />			
+		<xsl:variable name="cmd_sel_fields" >			
+			<xsl:for-each select="$columns/*">
+ 				<xsl:variable name="curr_col_xpath" select="@xpath" />  			 			
+  				<xsl:for-each select="$curr_record">  				
+  					<xsl:copy-of select="saxon:evaluate(concat('.//', $curr_col_xpath))" />
+  				</xsl:for-each>  			
+  			</xsl:for-each>
+  		</xsl:variable>
+		<xsl:variable name="fields" >
+			<div>
+				<xsl:apply-templates select="$cmd_sel_fields" mode="format-xmlelem" />
+			</div>
+		</xsl:variable>
+
+	<xsl:call-template name="record-table-row" >
+		<xsl:with-param name="fields" select="$fields" />
+	</xsl:call-template>
+											
+</xsl:template>
+
+
+<xsl:template name="record-table-row">
+<xsl:param name="fields" />
+<!-- @field absolute_position compute records position over whole recordset, ie add `startItem` (important when paging)
+ -->
+	<xsl:variable name="absolute_position" select="if (number($startItem)=number($startItem)) then number($startItem) + position() - 1 else  position()" />
+	
+		<tr>
+		<td rowspan="2">
+			<xsl:choose>
+				<xsl:when test="exists(.//MdSelfLink)" >
+					<xsl:choose>
+						<xsl:when test="contains($format, 'htmlsimple')" >
+						<a class="internal" href="{concat('../../record/htmldetail/', my:encodePID(.//MdSelfLink), '?repository=', $repository_name)}" >
+								<xsl:value-of select="$absolute_position" />
+						</a>						
+						</xsl:when>
+						<xsl:otherwise>
+						<a class="internal" href="{concat('record/htmldetail/', my:encodePID(.//MdSelfLink), '?repository=', $repository_name)}" >
+								<xsl:value-of select="$absolute_position" />
+						</a>
+						</xsl:otherwise>
+					</xsl:choose>
+					<span class="cmd cmd_detail" ></span>				
+					<span class="cmd cmd_save" ></span>						
+				</xsl:when>
+				<xsl:otherwise><xsl:value-of select="$absolute_position" /></xsl:otherwise>
+			</xsl:choose>
+		</td>		
+		<td colspan="{count($columns/*)}" >
+				<xsl:call-template name="getContext" />
+			<div class="title" ><xsl:call-template name="getName" /></div>			
+		</td>
+		</tr>
+		<tr>
+			<xsl:copy-of select="$fields" />						
+		</tr>									
+</xsl:template>
+
+
+<xsl:template match="records" mode="simple">
+    
+    <form action="" method="get">
+				<input type="text" name="q" ><xsl:attribute name="value"><xsl:value-of select="$q"/></xsl:attribute> </input>
+				
+				<input type="submit" value="Submit" > </input><br/>
+				<label>startItem: </label><input type="text" name="startItem" ><xsl:attribute name="value"><xsl:value-of select="$startItem"/></xsl:attribute> </input><br/>
+				<label> maxItems: </label><input type="text" name="maximumItems" ><xsl:attribute name="value"><xsl:value-of select="$maximumItems"/></xsl:attribute> </input>
+	</form>
+	<table class="show">		
+		<thead><tr><th>pos</th>		
+			<xsl:for-each select="$columns/*">
+  				<th title="{@key}" ><xsl:value-of select="@label"/></th>
+  			</xsl:for-each>  			
+		</tr></thead>
+		<tbody>	
+			<xsl:apply-templates select="CMD" mode="table" />	 			
+		</tbody>
+	</table>
+
+</xsl:template>
+
+<xsl:template name="getContext" >
+		<!--	<div class="is-part-of collections" ><xsl:value-of select=".//IsPartOf" /> </div>-->
+	<div class="ispartof-list"><span class="label">in: </span>
+		<xsl:apply-templates select="location" /> >
+	</div>
+</xsl:template>	
+	
+<xsl:template match="location" >
+		<!-- <a class="internal" href="{concat($default_prefix, my:encodePID(.))}"><xsl:value-of select="." /></a> >-->
+		<a class="external" href="{@id}"><xsl:value-of select="@name" /></a> +
+</xsl:template>
+
+
+</xsl:stylesheet>
Index: /MDService2/trunk/MDService2/src/xsl/params.xsl
===================================================================
--- /MDService2/trunk/MDService2/src/xsl/params.xsl	(revision 1478)
+++ /MDService2/trunk/MDService2/src/xsl/params.xsl	(revision 1479)
@@ -5,5 +5,5 @@
 	
 <!-- 	<xsl:param name="title" select="'Default Title'" />  -->
-	<xsl:param name="format"  select="'htmlpage'"/> <!-- table|list -->
+	<xsl:param name="format"  select="'htmlpagelist'"/> <!-- table|list -->
 	<xsl:param name="display_values_limit" select="10" />
 	<xsl:param name="max_depth" select="0" />
@@ -62,5 +62,5 @@
 	<xsl:param name="cache_cols" select="tokenize($cache_cols_,'\s+')"  />
 	
-	<xsl:param name="name_element" select="('title', 'name', 'resourcename')"  />
+	<xsl:param name="name_element" select="('title', 'name', 'resourcename', 'md-title')"  />
 		
 	
