Index: main/trunk/model-sites-dev/pei-jones/transform/pages/document.xsl
===================================================================
--- main/trunk/model-sites-dev/pei-jones/transform/pages/document.xsl	(revision 32124)
+++ main/trunk/model-sites-dev/pei-jones/transform/pages/document.xsl	(revision 32125)
@@ -96,5 +96,5 @@
 	<!-- The default template for displaying the document node text -->
 	<!-- equivalent to gsf:text -->
-	<xsl:template name="documentNodeText">
+	<xsl:template name="documentNodeTextOld">
 		<!-- Hides the "This document has no text." message -->
 		<xsl:variable name="noText">0</xsl:variable>
@@ -140,6 +140,19 @@
 	</xsl:template>
 
+	<xsl:template name="sectionContentForEditing">
+		<xsl:call-template name="wrappedSectionImage"/>
+		<xsl:call-template name="imageDownloadLink"/>
+		<xsl:call-template name="wrappedSectionTextForEditing"/>
+	</xsl:template>
+
 	<xsl:template name="imageDownloadLink">
-	  <gsf:link type="source" source_meta="Source">download tif image</gsf:link> 
+	  <xsl:if test="$collName = 'written-works'">
+	  <gsf:if-metadata-exists>
+	    <gsf:metadata name="Image" hidden="true"/>
+	    <gsf:if>
+	      <gsf:link type="source" source_meta="Source">download tif image</gsf:link> 
+	    </gsf:if>
+	  </gsf:if-metadata-exists>
+	  </xsl:if>
 	</xsl:template>
 
@@ -147,4 +160,229 @@
 	<table cellpadding="1" cellspacing="0" class="alternating" hspace="5" style="margin-top: 15px; border: 1px solid #000; border-collapse: collapse;" vspace="5">
 	  <gsf:switch>
+	    <gsf:metadata name="pj.Title"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Title</p>
+		</td>
+		<td>
+		  <p data="Title" rect="norect">
+		    <gsf:metadata name="pj.Title"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Date"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Date</p>
+		</td>
+		<td>
+		  <p data="Date" rect="norect">
+		    <gsf:metadata name="pj.Date" format="formatDate"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Author"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Author</p>
+		</td>
+		<td>
+		  <p data="Author" rect="norect">
+		    <gsf:metadata name="pj.Author"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Correspondent"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Correspondent</p>
+		</td>
+		<td>
+		  <p data="Correspondent" rect="norect">
+		    <gsf:metadata name="pj.Correspondent"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Description"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Description</p>
+		</td>
+		<td>
+		  <p data="Description" rect="norect">
+		    <gsf:metadata name="pj.Description"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Subject"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Subject</p>
+		</td>
+		<td>
+		  <p data="Subject" rect="norect">
+		    <gsf:metadata name="pj.Subject"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.PersonOfInterest"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Person of Interest</p>
+		</td>
+		<td>
+		  <p data="PersonOfInterest" rect="norect">
+		    <gsf:metadata name="pj.PersonOfInterest"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Event"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Event</p>
+		</td>
+		<td>
+		  <p data="Event" rect="norect">
+		    <gsf:metadata name="pj.Event"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Location"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Location</p>
+		</td>
+		<td>
+		  <p data="Location" rect="norect">
+		    <gsf:metadata name="pj.Location"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Access"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Access</p>
+		</td>
+		<td>
+		  <p data="MSAccess" rect="norect">
+		    <gsf:metadata name="pj.Access"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.MSHeading"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Maori Subject Heading</p>
+		</td>
+		<td>
+		  <p data="MSHeading" rect="norect">
+		    <gsf:metadata name="pj.MSHeading"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Document-Type"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Document-Type</p>
+		</td>
+		<td>
+		  <p data="Document-Type" rect="norect">
+		    <gsf:metadata name="pj.Document-Type"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Notes"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Notes</p>
+		</td>
+		<td>
+		  <p data="Notes" rect="norect">
+		    <gsf:metadata name="pj.Notes"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Provenance"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight:bold;">Provenance</p>
+		</td>
+		<td>
+		  <p data="Provenance" rect="norect">
+		    <gsf:metadata name="pj.Provenance"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Tags"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect" style="font-weight: bold;">Tags</p>
+		</td>
+		<td>
+		  <p data="Tags" rect="norect">
+		    <gsf:metadata name="pj.Tags"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
 	    <gsf:metadata name="pj.Catalogue-Number"/>
 	    <gsf:when test="exists">
@@ -161,5 +399,5 @@
 	    </gsf:when>
 	  </gsf:switch>
-	  <gsf:switch>
+<!--	  <gsf:switch>
 	    <gsf:metadata name="pj.Catalogue-Short"/>
 	    <gsf:when test="exists">
@@ -175,30 +413,30 @@
 	      </tr>
 	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Title"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect">Title</p>
-		</td>
-		<td>
-		  <p data="Title" rect="norect">
-		    <gsf:metadata name="pj.Title"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Date"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect">Date</p>
-		</td>
-		<td>
-		  <p data="Date" rect="norect">
-		    <gsf:metadata name="pj.Date"/>
+	  </gsf:switch>-->
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Physical-Location"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Physical Location</p>
+		</td>
+		<td>
+		  <p data="Physical-Location" rect="norect">
+		    <gsf:metadata name="pj.Physical-Location"/>
+		  </p>
+		</td>
+	      </tr>
+	    </gsf:when>
+	  </gsf:switch>
+	  <gsf:switch>
+	    <gsf:metadata name="pj.Physical-Description"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Physical Description</p>
+		</td>
+		<td>
+		  <p data="Physical-Location" rect="norect">
+		    <gsf:metadata name="pj.Physical-Description"/>
 		  </p>
 		</td>
@@ -222,163 +460,13 @@
 	  </gsf:switch>
 	  <gsf:switch>
-	    <gsf:metadata name="pj.Author"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect">Author</p>
-		</td>
-		<td>
-		  <p data="Author" rect="norect">
-		    <gsf:metadata name="pj.Author"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Physical-Location"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect">Physical Location</p>
-		</td>
-		<td>
-		  <p data="Physical-Location" rect="norect">
-		    <gsf:metadata name="pj.Physical-Location"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Location"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect">Location</p>
-		</td>
-		<td>
-		  <p data="Location" rect="norect">
-		    <gsf:metadata name="pj.Location"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Provenance"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight:bold;">Provenance</p>
-		</td>
-		<td>
-		  <p data="Provenance" rect="norect">
-		    <gsf:metadata name="pj.Provenance"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Description"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Description</p>
-		</td>
-		<td>
-		  <p data="Description" rect="norect">
-		    <gsf:metadata name="pj.Description"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Document-Type"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Document-Type</p>
-		</td>
-		<td>
-		  <p data="Document-Type" rect="norect">
-		    <gsf:metadata name="pj.Document-Type"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Subject"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Subject</p>
-		</td>
-		<td>
-		  <p data="Subject" rect="norect">
-		    <gsf:metadata name="pj.Subject"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Tags"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Tags</p>
-		</td>
-		<td>
-		  <p data="Tags" rect="norect">
-		    <gsf:metadata name="pj.Tags"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Notes"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Notes</p>
-		</td>
-		<td>
-		  <p data="Notes" rect="norect">
-		    <gsf:metadata name="pj.Notes"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.MSHeading"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Maori Subject Heading</p>
-		</td>
-		<td>
-		  <p data="MSHeading" rect="norect">
-		    <gsf:metadata name="pj.MSHeading"/>
-		  </p>
-		</td>
-	      </tr>
-	    </gsf:when>
-	  </gsf:switch>
-	  <gsf:switch>
-	    <gsf:metadata name="pj.Access"/>
-	    <gsf:when test="exists">
-	      <tr>
-		<td class="heading">
-		  <p rect="norect" style="font-weight: bold;">Access</p>
-		</td>
-		<td>
-		  <p data="MSAccess" rect="norect">
-		    <gsf:metadata name="pj.Access"/>
+	    <gsf:metadata name="pj.Format"/>
+	    <gsf:when test="exists">
+	      <tr>
+		<td class="heading">
+		  <p rect="norect">Format</p>
+		</td>
+		<td>
+		  <p data="Format" rect="norect">
+		    <gsf:metadata name="pj.Format"/>
 		  </p>
 		</td>
