Index: documentViewer.py
===================================================================
--- documentViewer.py	(revision 501)
+++ documentViewer.py	(revision 503)
@@ -116,4 +116,5 @@
     # templates and forms
     viewer_text = PageTemplateFile('zpt/viewer_text', globals())
+    viewer_xml = PageTemplateFile('zpt/viewer_xml', globals())
     viewer_images = PageTemplateFile('zpt/viewer_images', globals())
     viewer_index = PageTemplateFile('zpt/viewer_index', globals())
@@ -259,15 +260,15 @@
   
     security.declareProtected('View','index_html')
-    def index_html(self,url,mode="texttool",viewMode="auto",viewType=None,tocMode="thumbs",start=1,pn=1):
+    def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode="thumbs",start=1,pn=1):
         """
         view page
         @param url: url which contains display information
         @param mode: defines how to access the document behind url 
-        @param viewMode: 'images': display images, 'text': display text, default is 'auto'
-        @param viewType: sub-type of viewMode, e.g. 'dict' for viewMode='text'
+        @param viewMode: 'images': display images, 'text': display text, 'xml': display xml, default is 'auto'
+        @param viewLayer: sub-type of viewMode, e.g. 'dict' for viewMode='text'
         @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none)
         """
         
-        logging.debug("documentViewer(index_html) mode=%s url=%s viewMode=%s viewType=%s start=%s pn=%s"%(mode,url,viewMode,viewType,start,pn))
+        logging.debug("documentViewer(index_html) mode=%s url=%s viewMode=%s viewLayer=%s start=%s pn=%s"%(mode,url,viewMode,viewLayer,start,pn))
         
         if not hasattr(self, 'template'):
@@ -289,5 +290,5 @@
             if docinfo.get('textURL', None) or docinfo.get('textURLPath', None): 
                 viewMode = "text"
-                viewType = "dict"
+                viewLayer = "dict"
             else:
                 viewMode = "images"
@@ -296,12 +297,12 @@
             # legacy fix
             viewMode = "text"
-            viewType = "dict"
-            
-        # stringify viewType
-        if isinstance(viewType, list):
-            logging.debug("index_html: viewType is list:%s"%viewType)
-            viewType = ','.join([t for t in viewType if t])
+            viewLayer = "dict"
+            
+        # stringify viewLayer
+        if isinstance(viewLayer, list):
+            logging.debug("index_html: viewLayer is list:%s"%viewLayer)
+            viewLayer = ','.join([t for t in viewLayer if t])
                         
-        pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, viewMode=viewMode, viewType=viewType, tocMode=tocMode)
+        pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode)
                     
         # get template /template/viewer_$viewMode
@@ -704,10 +705,10 @@
     
 
-    def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, viewMode=None, viewType=None, tocMode=None):
+    def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, viewMode=None, viewLayer=None, tocMode=None):
         """returns pageinfo with the given parameters"""
-        logging.debug("getPageInfo(current=%s, start=%s, rows=%s, cols=%s, viewMode=%s, viewType=%s, tocMode=%s)"%(current,start,rows,cols,viewMode,viewType,tocMode))
+        logging.debug("getPageInfo(current=%s, start=%s, rows=%s, cols=%s, viewMode=%s, viewLayer=%s, tocMode=%s)"%(current,start,rows,cols,viewMode,viewLayer,tocMode))
         pageinfo = {}
         pageinfo['viewMode'] = viewMode
-        pageinfo['viewType'] = viewType
+        pageinfo['viewLayer'] = viewLayer
         pageinfo['tocMode'] = tocMode
 
@@ -731,5 +732,5 @@
             if docinfo.get('textURLPath', None):
                 # cache text page as well
-                pageinfo['textPage'] = self.getTextPage(mode=viewType, pn=current, docinfo=docinfo, pageinfo=pageinfo)
+                pageinfo['textPage'] = self.getTextPage(mode=viewLayer, pn=current, docinfo=docinfo, pageinfo=pageinfo)
                 np = int(docinfo.get('numPages', 0))
                 
Index: zpt/viewer_images.zpt
===================================================================
--- zpt/viewer_images.zpt	(revision 501)
+++ zpt/viewer_images.zpt	(revision 503)
@@ -3,5 +3,5 @@
 <html xmlns="http://www.w3.org/1999/xhtml"
   tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
-              tocMode pageinfo/tocMode; viewType pageinfo/viewType; viewerUrl docinfo/viewerUrl;
+              tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl;
               numPages docinfo/numPages | nothing; dlBaseUrl docinfo/digilibBaseUrl | nothing;">
 <head>
Index: zpt/viewer_text.zpt
===================================================================
--- zpt/viewer_text.zpt	(revision 502)
+++ zpt/viewer_text.zpt	(revision 503)
@@ -3,5 +3,5 @@
 <html xmlns="http://www.w3.org/1999/xhtml"
   tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
-              tocMode pageinfo/tocMode; viewType pageinfo/viewType; viewerUrl docinfo/viewerUrl;
+              tocMode pageinfo/tocMode; viewLayer pageinfo/viewLayer; viewerUrl docinfo/viewerUrl;
               rootUrl here/getDocumentViewerURL;
               numPages docinfo/numPages | nothing;">
@@ -29,5 +29,5 @@
                                pn pageinfo/pn; 
                                flowLtr python:pageinfo.get('pageFlow','ltr')!='rtl';
-                               textPage python:here.getTextPage(mode=viewType, pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
+                               textPage python:here.getTextPage(mode=viewLayer, pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
     <!-- header -->
     <div class="page-head">
@@ -67,18 +67,19 @@
           <form tal:attributes="action viewerUrl" class="autosubmit">
             <input type="hidden"
-              tal:define="params python:here.getParams(params={'viewType':None})"
+              tal:define="params python:here.getParams(params={'viewLayer':None,'viewMode':None})"
               tal:repeat="param params"
-              tal:attributes="name param; value python:params[param]" /> <input
-              class="autosubmit" type="radio" name="viewType" value=""
-              tal:attributes="checked python:viewType!='xml'" /> Text<br /> <span
-              class="optionsText" tal:condition="python:viewType!='xml'">
-              &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewType"
-              value="dict" tal:attributes="checked python:viewType=='dict'" /> Dictionary<br />
-            </span> <span class="optionsText"
-              tal:condition="python:viewType!='xml' and docinfo.get('numPlaces',0)">
-              &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewType"
-              value="gis" tal:attributes="checked python:viewType=='gis'" /> Places<br />
-            </span> <input type="radio" class="autosubmit" name="viewType"
-              tal:attributes="value string:xml; checked python:viewType=='xml'" /> XML<br />
+              tal:attributes="name param; value python:params[param]" /> 
+            <input class="autosubmit" type="radio" name="viewMode" value="text"
+              tal:attributes="checked python:viewMode=='text'" /> Text<br /> 
+            <span class="optionsText">
+              &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewLayer"
+              value="dict" tal:attributes="checked python:viewLayer=='dict'" /> Dictionary<br />
+            </span> 
+            <span class="optionsText" tal:condition="python:docinfo.get('numPlaces',0)">
+              &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewLayer"
+              value="gis" tal:attributes="checked python:viewLayer=='gis'" /> Places<br />
+            </span> 
+            <input type="radio" class="autosubmit" name="viewMode" value="xml"
+              tal:attributes="checked python:viewMode=='xml'" /> XML<br />
             <input type="submit" value="Go!" />
           </form>
@@ -98,5 +99,5 @@
 
         <!--"BEGIN DICTIONARY OVERVIEW"-->
-        <div class="options" tal:condition="python:viewType=='dict'">
+        <div class="options" tal:condition="python:viewLayer=='dict'">
           <h4>Dictionary view</h4>
           <form name="f3" action="">
@@ -107,5 +108,5 @@
 
         <!--"BEGIN TEXT NORMALIZATION"-->
-        <div class="options" tal:condition="python:viewType!='xml'">
+        <div class="options" tal:condition="python:viewLayer!='xml'">
           <h4>Text normalization</h4>
           <form tal:attributes="action viewerUrl" class="autosubmit"
@@ -127,5 +128,5 @@
 
         <!--"BEGIN PLACES"-->
-        <div class="options" tal:condition="python:viewType=='gis'">
+        <div class="options" tal:condition="python:viewLayer=='gis'">
           <tal:block
             tal:define="gisPlaces python:here.getGisPlaces(docinfo=docinfo, pageinfo=pageinfo); gisAllPlaces python:here.getAllGisPlaces(docinfo=docinfo, pageinfo=pageinfo);">
Index: zpt/viewer_xml.zpt
===================================================================
--- zpt/viewer_xml.zpt	(revision 503)
+++ zpt/viewer_xml.zpt	(revision 503)
@@ -0,0 +1,166 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+  tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
+              tocMode pageinfo/tocMode; viewType pageinfo/viewType; viewerUrl docinfo/viewerUrl;
+              rootUrl here/getDocumentViewerURL;
+              numPages docinfo/numPages | nothing;">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title
+    tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
+  <link rel="stylesheet" href="template/docuviewer_css" type="text/css" />
+  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/jquery_js"></script>
+  <script type="text/javascript">
+            // <!--
+            $(document).ready(function() {
+                // autosubmit forms
+                $('form.autosubmit').find('.autosubmit').change(function() {
+                    this.form.submit();
+                });
+                $('form.autosubmit input[type="submit"]').hide();
+            });
+        // -->
+        </script>
+</head>
+<body tal:condition="numPages">
+  <tal:block
+    tal:define="docpath docinfo/textURLPath;
+                               pn pageinfo/pn; 
+                               flowLtr python:pageinfo.get('pageFlow','ltr')!='rtl';
+                               textPage python:here.getTextPage(mode=viewType, pn=pn, docinfo=docinfo, pageinfo=pageinfo) or '[no text here]';">
+    <!-- header -->
+    <div class="page-head">
+      <metal:block metal:use-macro="here/template/common_template/macros/head" />
+    </div>
+    <div class="page-body" tal:condition="python:here.isAccessible(docinfo)">
+      <!--table of contents-->
+      <div class="col-left">
+        <metal:block
+          metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
+      </div>
+
+      <!-- text page -->
+      <div class="col-main">
+        <div class="ruler">
+          <metal:block metal:use-macro="here/template/common_template/macros/page_ruler" />
+        </div>
+        <ul class="switcher">
+          <li>
+            <a tal:attributes="href python:here.getLink('viewMode','images')">Image</a>
+          </li>
+          <li class="sel">Text</li>
+        </ul>
+        <div class="content">
+          <div class="pageHeaderTitle" tal:condition="exists:pageinfo/pageHeaderTitle"
+            tal:content="structure pageinfo/pageHeaderTitle" />
+          <tal:block tal:replace="structure textPage" />
+        </div>
+      </div>
+      <!-- col-main -->
+
+      <!-- right-side options -->
+      <div class="col-right">
+        <!--"BEGIN TEXT DISPLAY"  -->
+        <div class="options">
+          <h4>Text display</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit">
+            <input type="hidden"
+              tal:define="params python:here.getParams(params={'viewType':None})"
+              tal:repeat="param params"
+              tal:attributes="name param; value python:params[param]" /> <input
+              class="autosubmit" type="radio" name="viewType" value=""
+              tal:attributes="checked python:viewType!='xml'" /> Text<br /> <span
+              class="optionsText" tal:condition="python:viewType!='xml'">
+              &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewType"
+              value="dict" tal:attributes="checked python:viewType=='dict'" /> Dictionary<br />
+            </span> <span class="optionsText"
+              tal:condition="python:viewType!='xml' and docinfo.get('numPlaces',0)">
+              &nbsp;&nbsp;<input type="checkbox" class="autosubmit" name="viewType"
+              value="gis" tal:attributes="checked python:viewType=='gis'" /> Places<br />
+            </span> <input type="radio" class="autosubmit" name="viewType"
+              tal:attributes="value string:xml; checked python:viewType=='xml'" /> XML<br />
+            <input type="submit" value="Go!" />
+          </form>
+        </div>
+        <!--"END TEXT DISPLAY"-->
+
+        <!--"BEGIN TEXT SIZE"-->
+        <div class="options">
+          <h4>Text size</h4>
+          <div class="fsizer">
+            &nbsp; <a href="javascript:fontSize(12);" class="fs_sml">S</a> <a
+              href="javascript:fontSize(14);" class="fs_med">M</a> <a
+              href="javascript:fontSize(16);" class="fs_lrg">L</a>
+          </div>
+        </div>
+        <!--"END TEXT SIZE"-->
+
+        <!--"BEGIN DICTIONARY OVERVIEW"-->
+        <div class="options" tal:condition="python:viewType=='dict'">
+          <h4>Dictionary view</h4>
+          <form name="f3" action="">
+            <input type="radio" name="r3" />Tab<br /> <input type="radio" name="r3" />Window<br />
+          </form>
+        </div>
+        <!--"END DICTIONARY OVERVIEW"-->
+
+        <!--"BEGIN TEXT NORMALIZATION"-->
+        <div class="options" tal:condition="python:viewType!='xml'">
+          <h4>Text normalization</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit"
+            tal:define="norm python:pageinfo.get('characterNormalization','regPlusNorm');">
+            <input type="hidden"
+              tal:define="params python:here.getParams('characterNormalization',None)"
+              tal:repeat="param params"
+              tal:attributes="name param; value python:params[param]" /> <input
+              type="radio" class="autosubmit" name="characterNormalization" value="orig"
+              tal:attributes="checked python:norm=='orig'" /> Original<br /> <input
+              type="radio" class="autosubmit" name="characterNormalization" value="reg"
+              tal:attributes="checked python:norm=='reg'" /> Regularized<br /> <input
+              type="radio" class="autosubmit" name="characterNormalization"
+              value="regPlusNorm" tal:attributes="checked python:norm=='regPlusNorm'" />
+            Normalized<br /> <input type="submit" value="Go!" />
+          </form>
+        </div>
+        <!--"END TEXT NORMALIZATION"-->
+
+        <!--"BEGIN PLACES"-->
+        <div class="options" tal:condition="python:viewType=='gis'">
+          <tal:block
+            tal:define="gisPlaces python:here.getGisPlaces(docinfo=docinfo, pageinfo=pageinfo); gisAllPlaces python:here.getAllGisPlaces(docinfo=docinfo, pageinfo=pageinfo);">
+            <span><b>Places</b></span>
+            <br />(Link to extern:)<br />
+            <span>Page</span>
+            <span style="float: right"> <a
+              tal:attributes="href python:'http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/db/mpdl/%s?id=%s&format=%s'%(name,gisPlaces,'gis')"
+              target="_blank"> <img src="images/arrow.png" alt="" />
+            </a>
+            </span>
+            <br />
+            <span>Book</span>
+            <span style="float: right"> <a
+              tal:attributes="href python:'http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/db/mpdl/%s?format=%s'%(name,'gis')"
+              target="_blank"> <img src="images/arrow.png" alt="" />
+            </a>
+            </span>
+            <br />
+          </tal:block>
+        </div>
+        <!--"END PLACES"-->
+      </div>
+      <!-- /col-right -->
+
+    </div>
+    <!-- /page-body -->
+
+    <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
+      <div class="errortext">Sorry, access to this document is restricted.</div>
+    </div>
+
+  </tal:block>
+</body>
+<body tal:condition="not:numPages">
+  <div class="errortext">Sorry, document doesn't exist.</div>
+</body>
+</html>
