Follow both resource and nodeID in simple display MPX-5
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 1 Dec 2014 12:56:05 +0000 (13:56 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 1 Dec 2014 12:59:16 +0000 (13:59 +0100)
This is to continue to show creator and workTitle when we
use usebnodes=false in xquery filter.

bibframe/xsl/briefDisplay.xsl

index e975da9..5a931c9 100644 (file)
 
   <xsl:template match="text()"/>
 
+  <xsl:template name="show-value">
+    <xsl:variable name="resource" select="@rdf:resource"/>
+    <xsl:variable name="nodeid" select="@rdf:nodeID"/>
+    <xsl:choose>
+      <xsl:when test="$resource">
+       <xsl:variable name="rvalue"
+                     select="//*[@rdf:about=$resource]/*[1]/text()"/>
+       <xsl:choose>
+         <xsl:when test="$rvalue">
+           <xsl:value-of select="$rvalue"/>
+         </xsl:when>
+       </xsl:choose>
+      </xsl:when>
+      <xsl:when test="$nodeid">
+       <xsl:variable name="rvalue"
+                     select="//*[@rdf:nodeID=$nodeid]/*[1]"/>
+       <xsl:choose>
+         <xsl:when test="$rvalue">
+           <xsl:value-of select="$rvalue"/>
+         </xsl:when>
+         <xsl:otherwise>
+           <xsl:value-of select="$nodeid"/>
+         </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
   <xsl:template match="rdf:RDF">
     <table>
       <xsl:for-each select="bf:Work[1]/bf:creator">
        <tr>
          <td><b>Creator:</b></td>
          <td>
-           <xsl:value-of select="//*[@rdf:nodeID=$resource]/bf:label"/>
+           <xsl:call-template name="show-value"/>
          </td>
        </tr>
       </xsl:for-each>
       <xsl:for-each select="bf:Work[1]/bf:workTitle">
-       <xsl:variable
-           name="resource" select="@rdf:nodeID"/>
        <tr>
          <td><b>Work Title:</b></td>
          <td>
-           <xsl:value-of select="//*[@rdf:nodeID=$resource]/bf:titleValue"/>
+           <xsl:call-template name="show-value"/>
          </td>
        </tr>
       </xsl:for-each>