Updates to pz:authentication documentation
[pazpar2-moved-to-github.git] / etc / xsl / cf.xsl
index 7796273..794454c 100644 (file)
         version="1.0"
         encoding="UTF-8"/>
 
-  <xsl:param name="medium" />
+    <xsl:param name="medium" />
 
-  <!--
-    According to cf/builder/templates/parseTask.cff, connectors can
-    also generate a "medium" field, but that is ignored in this
-    stylesheet, the rule below instead using an XSLT parameter.
-    Should the data element be used in preference when it is included?
-  -->
+    <xsl:variable name="startpage" select="/record/page" />
+    <xsl:variable name="endpage" select="/record/endpage" />
 
+  <!-- Use medium parameter if given. Default to medium from connector -->
   <xsl:template match="/record">
     <pz:record>
       <pz:metadata type="medium">
           </xsl:otherwise>
         </xsl:choose>
       </pz:metadata>
+
+      <!-- calculate md-pages-number for startpage/endpage -->
+      <xsl:if test="string-length($startpage)">
+        <pz:metadata type="pages-number">
+          <xsl:value-of select="$startpage" />
+          <xsl:if test="string-length($endpage)">
+            <xsl:text>-</xsl:text>
+            <xsl:value-of select="$endpage" />
+          </xsl:if>
+        </pz:metadata>
+      </xsl:if>
+
       <xsl:apply-templates/>
+
     </pz:record>
   </xsl:template>
 
       <xsl:value-of select="."/>
     </pz:metadata>
   </xsl:template>
-  
-  <!-- no-op template to avoid printing medium out --> 
+
+  <!-- no-op template to avoid printing medium out -->
   <xsl:template match="medium" />
 
+  <xsl:template match="volume">
+    <pz:metadata type="volume-number">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="issue">
+    <pz:metadata type="issue-number">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="affiliation">
+    <pz:metadata type="affiliation-person" empty="PAZPAR2_NULL_VALUE">
+      <xsl:value-of select="person"/>
+    </pz:metadata>
+    <pz:metadata type="affiliation-institution" empty="PAZPAR2_NULL_VALUE">
+      <xsl:value-of select="institution"/>
+    </pz:metadata>
+  </xsl:template>
+
   <xsl:template match="*" >
     <pz:metadata type="{local-name()}">
       <xsl:value-of select="."/>