usebnodes=true and update XSLs due to different output
[mp-xquery-moved-to-github.git] / bibframe / xsl / fullDisplay.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 xmlns:srw="http://www.loc.gov/zing/srw/"
4                 xmlns:sru="http://docs.oasis-open.org/ns/search-ws/sruResponse"
5                 xmlns:dc="http://www.loc.gov/zing/srw/dcschema/v1.0/"
6                 xmlns:zr="http://explain.z3950.org/dtd/2.0/"
7                 xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/"
8                 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9                 xmlns:bf="http://bibframe.org/vocab/"
10                 version="1.0">
11
12   <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
13
14   <xsl:template match="text()"/>
15
16   <xsl:template match="rdf:RDF">
17     <table>
18       <xsl:for-each select="bf:*">
19         <tr><td><b><xsl:value-of select="name(.)"/>:</b></td></tr>
20         <xsl:for-each select="./*">
21           <xsl:variable name="resource" select="./@rdf:resource"/>
22           <xsl:variable name="nodeid" select="./@rdf:nodeID"/>
23           <tr>
24             <td/><td><b><xsl:value-of select="name(.)"/>:</b></td>
25             <td/><td>
26               <xsl:if test="$resource">
27                 <xsl:variable name="rvalue"
28                               select="//*[@rdf:about=$resource]/*[1]"/>
29                 <xsl:choose>
30                   <xsl:when test="$rvalue">
31                     <xsl:value-of select="$rvalue"/>
32                   </xsl:when>
33                   <xsl:otherwise>
34                     <xsl:value-of select="$resource"/>
35                   </xsl:otherwise>
36                 </xsl:choose>
37               </xsl:if>
38               <xsl:if test="$nodeid">
39                 <xsl:variable name="rvalue"
40                               select="//*[@rdf:nodeID=$nodeid]/*[1]"/>
41                 <xsl:choose>
42                   <xsl:when test="$rvalue">
43                     <xsl:value-of select="$rvalue"/>
44                   </xsl:when>
45                   <xsl:otherwise>
46                     <xsl:value-of select="$nodeid"/>
47                   </xsl:otherwise>
48                 </xsl:choose>
49               </xsl:if>
50               <xsl:value-of select="."/>
51             </td>
52           </tr>
53         </xsl:for-each>
54       </xsl:for-each>
55     </table>
56   </xsl:template>
57
58   <xsl:template match="/">
59     <xsl:call-template name="html"/>
60   </xsl:template>
61
62   <xsl:template name="html">
63     <html>
64       <head>
65         <title>BIBFRAME Full Display</title>
66         <link href="css.css" rel="stylesheet"
67               type="text/css" media="screen, all"/>
68       </head>
69       <body>
70         <div class="body">
71           <xsl:apply-templates/>
72         </div>
73       </body>
74     </html>
75   </xsl:template>
76
77   <xsl:template match="srw:searchRetrieveResponse">
78     <h2>Search Results</h2>
79     <xsl:call-template name="diagnostic"/>
80     <xsl:call-template name="displaysearch"/>
81   </xsl:template>
82
83   <xsl:template name="diagnostic">
84     <xsl:for-each select="//diag:diagnostic">
85      <div class="diagnostic">
86         <!-- <xsl:value-of select="diag:uri"/> -->
87         <xsl:text> </xsl:text>
88         <xsl:value-of select="diag:message"/>
89         <xsl:text>: </xsl:text>
90         <xsl:value-of select="diag:details"/>
91       </div>
92     </xsl:for-each>
93   </xsl:template>
94
95   <xsl:template name="displaysearch">
96     <div class="searchresults">
97       <xsl:for-each select="srw:numberOfRecords">
98         <h4>
99           <xsl:text>Number of Records: </xsl:text>
100           <xsl:value-of select="."/>
101         </h4>
102       </xsl:for-each>
103       <xsl:for-each select="srw:records">
104         <xsl:for-each select="srw:record">
105           <div class="record">
106             <h4>
107               <xsl:text>Record </xsl:text>
108               <xsl:value-of select="srw:recordPosition"/>
109             </h4>
110             <p>
111               <xsl:if test="srw:recordPacking='string'">
112                 <pre>
113                   <xsl:value-of select="srw:recordData"/>
114                 </pre>
115               </xsl:if>
116               <xsl:if test="srw:recordPacking='xml'">
117                 <xsl:choose>
118                   <xsl:when test="srw:recordSchema='marcxml'">
119                     <xsl:text>MARCXML</xsl:text>
120                   </xsl:when>
121                   <xsl:when test="srw:recordSchema='bibframe'">
122                     <xsl:apply-templates select="srw:recordData"/>
123                   </xsl:when>
124                 </xsl:choose>
125               </xsl:if>
126
127               <form name="rawlink" method="get">
128                 <input type="hidden" name="version">
129                   <xsl:attribute name="value">
130                     <xsl:value-of
131                         select="//srw:echoedSearchRetrieveRequest/srw:version"/>
132                   </xsl:attribute>
133                 </input>
134                 <input type="hidden" name="operation" value="searchRetrieve"/>
135                 <input type="hidden" name="query">
136                   <xsl:attribute name="value">
137                     <xsl:value-of
138                         select="//srw:echoedSearchRetrieveRequest/srw:query"/>
139                   </xsl:attribute>
140                 </input>
141                 <input type="hidden" name="recordPacking">
142                   <xsl:attribute name="value">
143                     <xsl:value-of select="srw:recordPacking"/>
144                   </xsl:attribute>
145                 </input>
146                 <input type="hidden" name="recordSchema">
147                   <xsl:attribute name="value">
148                     <xsl:value-of select="srw:recordSchema"/>
149                   </xsl:attribute>
150                 </input>
151                 <input type="hidden" name="startRecord">
152                   <xsl:attribute name="value">
153                     <xsl:value-of select="srw:recordPosition"/>
154                   </xsl:attribute>
155                 </input>
156                 <input type="hidden" name="maximumRecords" value="1"/>
157                 <input type="submit">
158                   <xsl:attribute name="value">
159                     <xsl:text>Raw Record </xsl:text>
160                     <xsl:value-of select="srw:recordPosition"/>
161                   </xsl:attribute>
162                 </input>
163               </form>
164             </p>
165           </div>
166         </xsl:for-each>
167       </xsl:for-each>
168     </div>
169   </xsl:template>
170
171 </xsl:stylesheet>