[XML4Lib] Style sheet question (UNCLASSIFIED)

Metz, Edward J Mr CIV USA TRADOC edward.metz at us.army.mil
Tue Jun 10 13:59:09 EDT 2008


Classification:  UNCLASSIFIED 
Caveats: NONE

I'm trying to convert our digital library metadata to MARC so we can
upload the records to our local OPAC and to OCLC. I've hit a snag that
maybe someone can help me with. It involves the 245 tag and subfield b.
I created this call-template below and it seems to work okay with one
major exception that I've found so far. I haven't been able to get it to
handle correctly those instances where a title containing a subfield b
happens to end with a question mark. Can anyone offer any advice?

<!--title template-->
<xsl:template name="title_template">
      <xsl:param name="string" />
      <xsl:param name="field" />
      <xsl:param name="ind1" />
      <xsl:param name="ind2" />
      <xsl:param name="type" />
      <datafield>
         <xsl:attribute name="tag">
            <xsl:value-of select="$field" />
         </xsl:attribute>
         <xsl:attribute name="ind1">
            <xsl:value-of select="$ind1" />
         </xsl:attribute>
         <xsl:attribute name="ind2">
            <xsl:value-of select="$ind2" />
         </xsl:attribute>
       

         
         <xsl:choose>
            <!-- IF A Colon, STOP AT AN OPENING PAREN -->
            <xsl:when test="contains($string, ':')!=0">
               <subfield code="a">
                  <xsl:value-of select="substring-before($string, ':')"
/>:</subfield>
            </xsl:when>
            
            <!-- NO colons, commas JUST OUTPUT THE NAME -->
            <xsl:otherwise>
               <subfield code="a">
                  <xsl:value-of select="$string" />
               </subfield>
            </xsl:otherwise>
       
	   </xsl:choose>

         <!-- CAPTURE subfield b -->
      
         <xsl:if test="contains($string, ':')!=0">
            <xsl:variable name="title_tmp"
select="substring-after($string, ':')" />
            <xsl:variable name="title"
select="substring-before($title_tmp, '.')" />
            <subfield code="b">
               <xsl:value-of select="$title" /></subfield>
         </xsl:if>
   </datafield>
   </xsl:template>

Edward Metz
Systems Librarian
Combined Arms Research Library, USACGSC
250 Gibbon Ave
Fort Leavenworth KS 66027-2314
Tel: 913-758-3027
Fax: 913-758-3014
DSN: 585-3027
http://carl.army.mil
Classification:  UNCLASSIFIED 
Caveats: NONE





More information about the XML4Lib mailing list