BIBFRAME full display in place MP-553
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 11 Jul 2014 11:43:19 +0000 (13:43 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 11 Jul 2014 11:43:19 +0000 (13:43 +0200)
bibframe/explain.xml
bibframe/xsl/briefDisplay.xsl
bibframe/xsl/fullDisplay.xsl [new file with mode: 0644]

index 5c73d6f..3050861 100644 (file)
   </indexInfo>
 
   <schemaInfo>
+    <schema identifier="http://www.loc.gov/zing/srw/bibframe"
+            name="bibframe"
+            retrieve="true">
+      <title lang="en">BIBFRAME</title>
+    </schema>
     <schema identifier="info:srw/schema/1/marcxml-v1.1"
             location="http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
             name="marcxml"
             retrieve="true">
       <title lang="en">MARCXML</title>
     </schema>
-    <schema identifier="http://www.loc.gov/zing/srw/bibframe"
-            name="bibframe"
-            retrieve="true">
-      <title lang="en">BIBFRAME</title>
-    </schema>
   </schemaInfo>
 
 
index 0decea8..2052446 100644 (file)
 
   <xsl:template match="rdf:RDF">
     <table>
-      <xsl:if test="bf:Work/bf:creator">
+      <xsl:for-each select="bf:Work/bf:creator">
        <xsl:variable
-           name="resource" select="bf:Work/bf:creator/@rdf:resource"/>
+           name="resource" select="./@rdf:resource"/>
        <tr>
          <td>Author</td>
          <td>
-           <xsl:value-of select="//bf:Person[@rdf:about=$resource]/bf:label"/>
+           <xsl:value-of select="//*[@rdf:about=$resource]/bf:label"/>
          </td>
        </tr>
-      </xsl:if>
-      <xsl:if test="bf:Work/bf:workTitle">
+      </xsl:for-each>
+      <xsl:for-each select="bf:Work/bf:workTitle">
        <xsl:variable
-           name="resource" select="bf:Work/bf:workTitle/@rdf:resource"/>
+           name="resource" select="./@rdf:resource"/>
        <tr>
          <td>Work Title</td>
          <td>
-           <xsl:value-of select="//bf:Title[@rdf:about=$resource]/bf:titleValue"/>
+           <xsl:value-of select="//*[@rdf:about=$resource]/bf:titleValue"/>
          </td>
        </tr>
-      </xsl:if>
-      <xsl:if test="//bf:Instance/bf:providerStatement">
-      <tr>
-       <td>Date/Place</td>
-       <td>
-         <xsl:value-of select="//bf:Instance/bf:providerStatement"/>
-       </td>
-      </tr>
-      </xsl:if>
+      </xsl:for-each>
+      <xsl:for-each select="bf:Instance/bf:providerStatement">
+       <tr>
+         <td>Date/Place</td>
+         <td>
+           <xsl:value-of select="."/>
+         </td>
+       </tr>
+      </xsl:for-each>
     </table>
   </xsl:template>
 
           </select>
           <xsl:text> recordPacking: </xsl:text>
           <select name="recordPacking">
-            <option value="string">string</option>
             <option value="xml">XML</option>
+            <option value="string">string</option>
           </select>
 
         </div>
                    <xsl:value-of select="srw:recordSchema"/>
                  </xsl:attribute>
                </input>
-               <input type="hidden" name="stylesheet" value="/xsl/briefDisplay.xsl"/>
+               <input type="hidden" name="stylesheet" value="/xsl/fullDisplay.xsl"/>
                <input type="hidden" name="startRecord">
                  <xsl:attribute name="value">
                    <xsl:value-of select="srw:recordPosition"/>
diff --git a/bibframe/xsl/fullDisplay.xsl b/bibframe/xsl/fullDisplay.xsl
new file mode 100644 (file)
index 0000000..9245e85
--- /dev/null
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:srw="http://www.loc.gov/zing/srw/"
+               xmlns:sru="http://docs.oasis-open.org/ns/search-ws/sruResponse"
+                xmlns:dc="http://www.loc.gov/zing/srw/dcschema/v1.0/"
+                xmlns:zr="http://explain.z3950.org/dtd/2.0/"
+                xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+               xmlns:bf="http://bibframe.org/vocab/"
+                version="1.0">
+
+  <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
+
+  <xsl:template match="text()"/>
+
+  <xsl:template match="rdf:RDF">
+    <table>
+      <xsl:for-each select="bf:*">
+       <tr><td><xsl:value-of select="name(.)"/></td></tr>
+       <xsl:for-each select="./*">
+         <xsl:variable name="resource" select="./@rdf:resource"/>
+         <tr>
+           <td/><td><xsl:value-of select="name(.)"/></td>
+           <td/><td>
+             <xsl:if test="$resource">
+               <xsl:variable name="rvalue"
+                             select="//*[@rdf:about=$resource]/*[1]"/>
+               <xsl:choose>
+                 <xsl:when test="$rvalue">
+                   <xsl:value-of select="$rvalue"/>
+                 </xsl:when>
+                 <xsl:otherwise>
+                   <xsl:value-of select="$resource"/>
+                 </xsl:otherwise>
+               </xsl:choose>
+             </xsl:if>
+             <xsl:value-of select="."/>
+           </td>
+         </tr>
+       </xsl:for-each>
+      </xsl:for-each>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="/">
+    <xsl:call-template name="html"/>
+  </xsl:template>
+
+  <xsl:template name="html">
+    <html>
+      <head>
+        <title>Full Display</title>
+        <link href="css.css" rel="stylesheet"
+              type="text/css" media="screen, all"/>
+      </head>
+      <body>
+        <div class="body">
+          <xsl:apply-templates/>
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="srw:searchRetrieveResponse">
+    <h2>Search Results</h2>
+    <xsl:call-template name="diagnostic"/>
+    <xsl:call-template name="displaysearch"/>
+  </xsl:template>
+
+  <xsl:template name="diagnostic">
+    <xsl:for-each select="//diag:diagnostic">
+     <div class="diagnostic">
+        <!-- <xsl:value-of select="diag:uri"/> -->
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="diag:message"/>
+        <xsl:text>: </xsl:text>
+        <xsl:value-of select="diag:details"/>
+      </div>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="displaysearch">
+    <div class="searchresults">
+      <xsl:for-each select="srw:numberOfRecords">
+        <h4>
+          <xsl:text>Number of Records: </xsl:text>
+          <xsl:value-of select="."/>
+        </h4>
+      </xsl:for-each>
+      <xsl:for-each select="srw:records">
+        <xsl:for-each select="srw:record">
+          <div class="record">
+            <p>
+              <xsl:text>Record: </xsl:text>
+              <xsl:value-of select="srw:recordPosition"/>
+              <xsl:text> : </xsl:text>
+              <xsl:value-of select="srw:recordSchema"/>
+              <xsl:text> : </xsl:text>
+              <xsl:value-of select="srw:recordPacking"/>
+           </p>
+            <p>
+             <xsl:if test="srw:recordPacking='string'">
+               <pre>
+                 <xsl:value-of select="srw:recordData"/>
+               </pre>
+             </xsl:if>
+             <xsl:if test="srw:recordPacking='xml'">
+               <xsl:choose>
+                 <xsl:when test="srw:recordSchema='marcxml'">
+                   <xsl:text>MARCXML</xsl:text>
+                 </xsl:when>
+                 <xsl:when test="srw:recordSchema='bibframe'">
+                   <xsl:apply-templates select="srw:recordData"/>
+                 </xsl:when>
+               </xsl:choose>
+             </xsl:if>
+
+             <form name="rawlink" method="get">
+               <input type="hidden" name="version" value="1.2"/>
+               <input type="hidden" name="operation" value="searchRetrieve"/>
+               <input type="hidden" name="query">
+                 <xsl:attribute name="value">
+                   <xsl:value-of
+                       select="//srw:echoedSearchRetrieveRequest/srw:query"/>
+                 </xsl:attribute>
+               </input>
+               <input type="hidden" name="recordPacking">
+                 <xsl:attribute name="value">
+                   <xsl:value-of select="srw:recordPacking"/>
+                 </xsl:attribute>
+               </input>
+               <input type="hidden" name="recordSchema">
+                 <xsl:attribute name="value">
+                   <xsl:value-of select="srw:recordSchema"/>
+                 </xsl:attribute>
+               </input>
+               <input type="hidden" name="startRecord">
+                 <xsl:attribute name="value">
+                   <xsl:value-of select="srw:recordPosition"/>
+                 </xsl:attribute>
+               </input>
+               <input type="hidden" name="maximumRecords" value="1"/>
+               <input type="submit">
+                 <xsl:attribute name="value">
+                   <xsl:text>Raw Record </xsl:text>
+                   <xsl:value-of select="srw:recordPosition"/>
+                 </xsl:attribute>
+               </input>
+             </form>
+           </p>
+          </div>
+        </xsl:for-each>
+      </xsl:for-each>
+    </div>
+  </xsl:template>
+
+</xsl:stylesheet>