Index: documentViewer.py
===================================================================
--- documentViewer.py	(revision 560)
+++ documentViewer.py	(revision 561)
@@ -33,4 +33,11 @@
     #    stream.close()
     return s
+
+def getMDText(node):
+    """returns the @text content from the MetaDataProvider metadata node"""
+    if isinstance(node, dict):
+        return node.get('@text', None)
+    
+    return node
 
 def browserCheck(self):
@@ -220,4 +227,8 @@
         return self.template.fulltextclient.getTocPage(**args)
 
+    def getRepositoryType(self, **args):
+        """get repository type"""
+        return self.template.fulltextclient.getRepositoryType(**args)
+
     def getTextDownloadUrl(self, **args):
         """get list of gis places on one page"""
@@ -571,5 +582,5 @@
 
             # texttool info
-            texttool = self.metadataService.getTexttoolData(dom=metaDom)
+            texttool = self.metadataService.getTexttoolData(dom=metaDom, recursive=1, all=True)
             if texttool:
                 docinfo = self.getDocinfoFromTexttool(docinfo, texttool)
@@ -676,7 +687,12 @@
     def getDocinfoFromTexttool(self, docinfo, texttool):
         """reads contents of texttool element into docinfo"""
+        logging.debug("texttool=%s"%repr(texttool))
+        # unpack list if necessary
+        if isinstance(texttool, list):
+            texttool = texttool[0]
+                                    
         # image dir
-        imageDir = texttool.get('image', None)
-        docPath = docinfo.get('documentPath', None)
+        imageDir = getMDText(texttool.get('image', None))
+        docPath = getMDText(docinfo.get('documentPath', None))
         if imageDir and docPath:
             #print "image: ", imageDir, " archivepath: ", archivePath
@@ -686,5 +702,5 @@
         
         # old style text URL
-        textUrl = texttool.get('text', None)
+        textUrl = getMDText(texttool.get('text', None))
         if textUrl and docPath:
             if urlparse.urlparse(textUrl)[0] == "": #keine url
@@ -693,20 +709,35 @@
             docinfo['textURL'] = textUrl
     
-        # new style text-url-path
-        textUrl = texttool.get('text-url-path', None)
-        if textUrl:
-            docinfo['textURLPath'] = textUrl
+        # new style text-url-path (can be more than one with "repository" attribute)
+        textUrlNode = texttool.get('text-url-path', None)
+        if not isinstance(textUrlNode, list):
+            textUrlNode = [textUrlNode]
+
+        for tun in textUrlNode:
+            textUrl = getMDText(tun)
+            if textUrl:
+                textUrlAtts = tun.get('@attr')
+                if (textUrlAtts and 'repository' in textUrlAtts):
+                    textRepo = textUrlAtts['repository']
+                    # use matching repository
+                    if self.getRepositoryType() == textRepo:
+                        docinfo['textURLPath'] = textUrl
+                        docinfo['textURLRepository'] = textRepo
+                
+                else:
+                    # no repo attribute - use always
+                    docinfo['textURLPath'] = textUrl
             
         # page flow
-        docinfo['pageFlow'] = texttool.get('page-flow', 'ltr')
+        docinfo['pageFlow'] = getMDText(texttool.get('page-flow', 'ltr'))
             
         # odd pages are left
-        docinfo['oddPage'] = texttool.get('odd-scan-position', 'left')
+        docinfo['oddPage'] = getMDText(texttool.get('odd-scan-position', 'left'))
             
         # number of title page (default 1)
-        docinfo['titlePage'] = texttool.get('title-scan-no', 1)
+        docinfo['titlePage'] = getMDText(texttool.get('title-scan-no', 1))
             
         # old presentation stuff
-        presentation = texttool.get('presentation', None)
+        presentation = getMDText(texttool.get('presentation', None))
         if presentation and docPath:
             if presentation.startswith('http:'):
