Update test xslt
authorDennis Schafroth <dennis@indexdata.com>
Wed, 6 Apr 2011 11:03:51 +0000 (11:03 +0000)
committerDennis Schafroth <dennis@indexdata.com>
Wed, 6 Apr 2011 11:03:51 +0000 (11:03 +0000)
test/dads-pz2.xsl

index c2858cf..6b7dfaf 100644 (file)
   <xsl:template match="art">
     <xsl:variable name="journal_title" select="journal/title" />
     <xsl:variable name="journal_issn" select="journal/issn" />
-    <xsl:variable name="date" select="localInfo/cdate" />
+    <xsl:variable name="date" select="journal/year" />
+    <xsl:variable name="month" select="journal/month" />
     <xsl:variable name="description" select="abstract/abstract" />
 
+    <xsl:variable name="has_fulltext" select="article/fulltext"/>
+    <xsl:variable name="has_title" select="article/title"/>
+
     <xsl:variable name="vmedium">
       <xsl:choose>
-        <xsl:when test="$journal_title">article</xsl:when>
+        <xsl:when  test="$has_title and $has_fulltext">
+         <xsl:text>e-article</xsl:text>
+       </xsl:when>
+        <xsl:when  test="$has_title and not($has_fulltext)">
+         <xsl:text>article</xsl:text>
+       </xsl:when>
         <xsl:otherwise>
           <xsl:text>other</xsl:text>
         </xsl:otherwise>
     </xsl:variable>
     
     <pz:record>
+
+      <xsl:for-each select="localInfo/systemno"> 
+        <pz:metadata type="id">
+          <xsl:value-of select="."/>
+        </pz:metadata>
+      </xsl:for-each>
+
       <xsl:for-each select="author/name">
         <pz:metadata type="author">
           <xsl:value-of select="." />
           <xsl:value-of select="." />
         </pz:metadata>
       </xsl:for-each>
-      
-    <xsl:for-each select="journal"> 
-        <pz:metadata type="journal-subpart">
-            <xsl:text>Vol. </xsl:text><xsl:value-of select="vol" />
-            <xsl:text> no. </xsl:text><xsl:value-of select="issue" />
-            <xsl:text>(</xsl:text><xsl:value-of select="month" /><xsl:text>-</xsl:text><xsl:value-of select="year" /><xsl:text>)</xsl:text>
-            <xsl:text> p. </xsl:text><xsl:value-of select="page" />
+
+      <xsl:for-each select="journal/vol">
+        <pz:metadata type="journal-number">
+          <xsl:value-of select="." />
         </pz:metadata>
-    </xsl:for-each>      
+      </xsl:for-each>
 
-      <xsl:for-each select="localInfo/systemno"> 
-        <pz:metadata type="system-control-nr">
-          <xsl:value-of select="."/>
+      <xsl:for-each select="journal/issue">
+        <pz:metadata type="issue-number">
+          <xsl:value-of select="." />
         </pz:metadata>
       </xsl:for-each>
 
+      <xsl:for-each select="journal"> 
+        <pz:metadata type="journal-subpart">
+         <xsl:if test="vol">
+           <xsl:text>Vol. </xsl:text><xsl:value-of select="vol" /><xsl:text>,</xsl:text>
+         </xsl:if>
+          <xsl:if test="issue">
+           <xsl:if test="vol">
+             <xsl:text> no. </xsl:text>
+           </xsl:if>
+           <xsl:if test="not(vol)">
+             <xsl:text>No. </xsl:text>
+           </xsl:if>
+           <xsl:value-of select="issue" />
+         </xsl:if>
+         <xsl:text> (</xsl:text>
+         <xsl:if test="month">
+           <xsl:choose>
+             <xsl:when test="$month='01'">
+               <xsl:text>Jan. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='02'">
+               <xsl:text>Feb. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='03'">
+               <xsl:text>Mar. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='04'">
+               <xsl:text>Apr. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='05'">
+               <xsl:text>May </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='06'">
+               <xsl:text>June </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='07'">
+               <xsl:text>July </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='08'">
+               <xsl:text>Aug. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='09'">
+               <xsl:text>Sept. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='10'">
+               <xsl:text>Oct. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='11'">
+               <xsl:text>Nov. </xsl:text>
+             </xsl:when>
+             <xsl:when test="$month='12'">
+               <xsl:text>Dec. </xsl:text>
+             </xsl:when>
+             <xsl:otherwise>
+               <xsl:value-of select="$month"/><xsl:text> </xsl:text>
+             </xsl:otherwise>
+           </xsl:choose>
+         </xsl:if>
+         <xsl:value-of select="year" /><xsl:text>)</xsl:text>
+         <xsl:if test="page"> 
+            <xsl:text>, p. </xsl:text><xsl:value-of select="page" />
+         </xsl:if>
+        </pz:metadata>
+      </xsl:for-each>      
+
       <pz:metadata type="description">
-        <xsl:value-of select="$description" />
+       <xsl:value-of select="$description" />
       </pz:metadata>
       
       <xsl:for-each select="ctrlT/term">
-        <pz:metadata type="subject">
+       <pz:metadata type="subject">
           <xsl:value-of select="." />
-        </pz:metadata>
+       </pz:metadata>
       </xsl:for-each>
 
-      <xsl:for-each select="tmarc:d773">
-        <pz:metadata type="citation">
-          <xsl:for-each select="*">
-            <xsl:value-of select="normalize-space(.)" />
-            <xsl:text> </xsl:text>
-          </xsl:for-each>
-        </pz:metadata>
+      <xsl:for-each select="article/fulltext">
+       <pz:metadata type="fulltext">
+          <xsl:value-of select="." />
+       </pz:metadata>
       </xsl:for-each>
 
       <pz:metadata type="medium">
         <xsl:value-of select="$vmedium" />
+<!--
+        <xsl:if test="string-length($electronic) and $vmedium != 'electronic'">
+          <xsl:text> (electronic)</xsl:text>
+        </xsl:if>
+-->
       </pz:metadata>
 
-      <xsl:for-each select="article/fulltext">
-        <pz:metadata type="fulltext">
-          <xsl:value-of select="." />
-        </pz:metadata>
-      </xsl:for-each>
 
       <!-- passthrough id data -->
       <xsl:for-each select="pz:metadata">
        
     </pz:record>
 
-
   </xsl:template>
 
   <xsl:template match="text()" />