Changeset 868

Show
Ignore:
Timestamp:
08/01/07 16:15:49 (1 year ago)
Author:
thomase
Message:

Varia: dumbed2ascii-based sort for lists, meta tags in html to indicate utf-8 encoding, alternate formats links, data origin and rights (in html only), complete (such as it can be) COinS support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • BibIt/trunk/ProcModsCollection.xsl

    r867 r868  
    55    xmlns:xlink="http://www.w3.org/1999/xlink" 
    66    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
     7    xmlns:a="http://www.unc.edu/awmc/pleiades/bibl/ns" 
    78    version="2.0" > 
    89     
     
    3233          ================================================================ --> 
    3334     
    34     <xsl:output name="toc-format" method="html" indent="yes" escape-uri-attributes="yes" 
     35    <xsl:output name="toc-format" method="html" indent="yes" escape-uri-attributes="yes" encoding="UTF-8" 
    3536        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 
    3637        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/> 
    37     <xsl:output name="record-format" method="html" indent="yes"  escape-uri-attributes="yes" 
     38    <xsl:output name="record-format" method="html" indent="yes"  escape-uri-attributes="yes" encoding="UTF-8" 
    3839        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 
    3940        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/> 
    40     <xsl:output name="mods-format" method="xml" indent="yes" escape-uri-attributes="yes"/> 
     41    <xsl:output name="mods-format" method="xml" indent="yes" escape-uri-attributes="yes" encoding="UTF-8"/> 
    4142         
    42         
     43    <xsl:key name="modskeys" match="mods:titleInfo[@type='abbreviated'][1]/mods:title | mods:titleInfo[@type='uniform' and not(../mods:titleInfo/@type='abbreviated')][1]/mods:title" use="ancestor::mods:mods/@ID"/> 
    4344    <!-- ================================================================ 
    4445          basic templates control overall flow and the creation of the various  
     
    5051            <html xmlns="http://www.w3.org/1999/xhtml"> 
    5152                <head> 
     53                    <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> 
    5254                    <title>Bibliography for Barrington Atlas Map <xsl:value-of select="$mapnum"/></title> 
    5355                </head> 
     
    6365 
    6466    <xsl:template match="mods:modsCollection"> 
    65         <xsl:apply-templates select="mods:mods"/>  
     67         
     68        <xsl:apply-templates select="mods:mods"> 
     69            <xsl:sort select="a:escapetoascii(lower-case(replace(key('modskeys', ./@ID), ' ', '')))" collation="http://www.w3.org/2005/xpath-functions/collation/codepoint"/> 
     70        </xsl:apply-templates>  
    6671    </xsl:template> 
    6772     
     
    7883                        <xsl:if test="mods:titleInfo[@type='abbreviated' and @xml:lang]"><xsl:copy-of select="mods:titleInfo[@type='abbreviated']/@xml:lang"/></xsl:if> 
    7984                        <xsl:if test="mods:titleInfo[@type='uniform']"> 
    80                             <xsl:attribute name="title"><xsl:value-of select="mods:titleInfo[@type='uniform']/mods:title"/></xsl:attribute> 
     85                            <xsl:attribute name="title"><xsl:value-of select="mods:titleInfo[@type='uniform'][1]/mods:title"/></xsl:attribute> 
    8186                        </xsl:if> 
    82                         <xsl:value-of select="mods:titleInfo[@type='abbreviated']/mods:title"/></xsl:element> 
     87                        <xsl:value-of select="mods:titleInfo[@type='abbreviated'][1]/mods:title"/></xsl:element> 
    8388                </xsl:when> 
    8489                <xsl:when test="mods:titleInfo[@type='uniform']"> 
     
    8792                        <xsl:attribute name="href"><xsl:value-of select="$newid"/>.html</xsl:attribute> 
    8893                        <xsl:if test="mods:titleInfo[@type='uniform' and @xml:lang]"><xsl:copy-of select="mods:titleInfo[@type='uniform']/@xml:lang"/></xsl:if> 
    89                         <xsl:value-of select="mods:titleInfo[@type='uniform']/mods:title"/></xsl:element> 
     94                        <xsl:value-of select="mods:titleInfo[@type='uniform'][1]/mods:title"/></xsl:element> 
    9095                </xsl:when> 
    9196            </xsl:choose> 
     
    113118            <html xmlns="http://www.w3.org/1999/xhtml"> 
    114119                <head> 
     120                    <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> 
    115121                    <title><xsl:value-of select="normalize-space($thetitle)"/></title> 
    116122                </head> 
    117123                <body> 
    118124                    <h1><xsl:value-of select="normalize-space($thetitle)"/></h1> 
    119                     <p>MODS XML file: <a href="{$newid}.xml"><xsl:value-of select="$newid"/>.xml</a></p> 
    120125                    <div id="formattedcitation"> 
    121                     <h2>Formatted citation:</h2> 
     126                        <h2>Formatted citation:</h2> 
    122127                        <ul> 
    123128                            <li><xsl:choose> 
     
    133138                            </ul> 
    134139                    </div> 
    135                     <div id="coins"> 
    136                         <p><xsl:apply-templates select="." mode="coins"/></p> 
     140                    <div id="alternate"> 
     141                        <h2>Alternate formats:</h2> 
     142                        <xsl:apply-templates select="." mode="coins"/> 
     143                        <p id="modsxml">MODS XML file: <a href="{$newid}.xml"><xsl:value-of select="$newid"/>.xml</a></p> 
     144                    </div> 
     145                    <div id="searchforit"> 
     146                        <h2>Search for it:</h2> 
     147                        <xsl:apply-templates select="." mode="searchforit"/> 
     148                    </div> 
     149                    <div id="meta"> 
     150                        <h2>About this information:</h2> 
     151                        <p>This bibliographic record was compiled by staff and affiliates of the <a href="http://www.unc.edu/awmc/">Ancient 
     152                        World Mapping Center</a> and its <a href="http://pleiades.stoa.org">Pleiades Project</a>. The information in it was 
     153                        compiled initially from citation handlists and other unpublished working papers of the  
     154                            <a href="http://www.unc.edu/depts/cl_atlas/">Classical Atlas Project</a> (1988-2000).  
     155                        It was subsequently verified, updated and expanded with reference to an actual copy of the work cited, or (failing that) to  
     156                        at least 3 different online library catalog systems. Where possible, information from publishers' and authors' websites has  
     157                        also been consulted.</p> 
     158                         
     159                        <p>We encourage you, in accordance with standard scholarly practice, to cite the source of this data if you copy and  
     160                        redistribute it en masse. Use of individual citations in articles, papers and books need not be cited, but you should  
     161                        check them yourself for accuracy. <a href="rights.html">This  
     162                            data is in  
     163                        the public domain</a>.</p> 
     164                         
    137165                    </div> 
    138166                </body> 
     
    410438           templates for generating COinS "microformat" information for  
    411439           embedding in html pages 
    412           ================================================================ --> 
    413     <xsl:template match="mods:mods[mods:genre='article']" mode="coins"> 
     440           ================================================================ --> 
     441    <xsl:template match="mods:mods[mods:genre='article' or mods:genre='book' or mods:genre='collection' or mods:genre='multi-volume work']" mode="coins"> 
     442 
     443        <!-- build a variable containing the necessary key-value pairs; we'll clean it up anon --> 
     444        <xsl:variable name="coins"> 
     445            ctx_ver=Z39.88-2004&amp; 
     446 
     447            <!-- genre indicators --> 
     448            <xsl:call-template name="coins_genre"><xsl:with-param name="mods" select="."/></xsl:call-template> 
     449 
     450            <!-- titles for this work (not parents) --> 
     451            <xsl:call-template name="coins_titles"><xsl:with-param name="mods" select="."/></xsl:call-template> 
     452 
     453            <!-- human authors --> 
     454            <xsl:for-each select="mods:name[@type='personal' and mods:role/mods:roleTerm='author']"> 
     455                <xsl:if test="count(preceding-sibling::mods:name[@type='personal']) = 0"> 
     456                        rft.aulast=<xsl:value-of select="mods:namePart[@type='family']"/>&amp; 
     457                        rft.aufirst=<xsl:value-of select="mods:namePart[@type='given']"/>&amp; 
     458                </xsl:if> 
     459                rft.au=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:namePart[@type='given']"/><xsl:text> </xsl:text><xsl:value-of select="mods:namePart[@type='family']"/></xsl:with-param></xsl:call-template>&amp; 
     460            </xsl:for-each> 
     461 
     462            <!-- date of publication; does not include date of journal volume --> 
     463            <xsl:for-each select="mods:originInfo/mods:dateIssued">rft.date=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     464 
     465            <!-- publishers --> 
     466            <xsl:for-each select="mods:originInfo/mods:publisher">rft.pub=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="."/></xsl:with-param></xsl:call-template>&amp;</xsl:for-each> 
     467 
     468            <!-- places of publication --> 
     469            <xsl:for-each select="mods:originInfo/mods:place/mods:placeTerm">rft.place=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="."/></xsl:with-param></xsl:call-template>&amp;</xsl:for-each> 
     470 
     471            <!-- isbns --> 
     472            <xsl:for-each select="mods:identifier[@type='isbn']">rft.isbn=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     473 
     474            <!-- information related to parent works --> 
     475            <xsl:apply-templates select="mods:relatedItem[@type='host']" mode="coins"/> 
     476        </xsl:variable> 
     477         
     478        <!-- remove spaces --> 
     479        <xsl:variable name="cleancoins"><xsl:value-of select="replace(normalize-space($coins), ' ', '')"/></xsl:variable> 
     480         
     481        <!-- remove trailing ampersand, if there is one --> 
     482        <xsl:variable name="readycoins"> 
     483            <xsl:choose> 
     484                <xsl:when test="substring($cleancoins, string-length($cleancoins), 1) = '&amp;'"> 
     485                    <xsl:value-of select="substring($cleancoins, 1, string-length($cleancoins) - 1)"/> 
     486                </xsl:when> 
     487                <xsl:otherwise><xsl:value-of select="$cleancoins"/></xsl:otherwise> 
     488            </xsl:choose> 
     489        </xsl:variable> 
     490         
     491        <!-- emit the xhtml span element with the appropriate attribute tagging for COinS --> 
     492        <p id="coins"><xsl:element name="span"> 
     493            <xsl:attribute name="class">Z3988</xsl:attribute> 
     494            <xsl:attribute name="title"><xsl:value-of select="$readycoins" /></xsl:attribute> 
     495            This page includes embedded <a href="http://ocoins.info/" 
     496                title="ContextObjects in Spans bibliographic data">COinS bibliographic 
     497                data</a>, so it should be possible to capture the bibliographic data 
     498            presented here using <a href="http://www.zotero.org">Zotero</a>. Note, 
     499            however, that the <a 
     500                href="http://alcme.oclc.org/openurl/servlet/OAIHandler?verb=ListRecords&amp;metadataPrefix=oai_dc&amp;set=Core:Metadata+Formats" 
     501                >OpenURL Core Metadata Formats used by COinS</a> for <a 
     502                href="http://alcme.oclc.org/openurl/servlet/OAIHandler/extension?verb=GetMetadata&amp;metadataPrefix=mtx&amp;identifier=info:ofi/fmt:kev:mtx:book" 
     503                >books</a> and <a 
     504                href="http://alcme.oclc.org/openurl/servlet/OAIHandler/extension?verb=GetMetadata&amp;metadataPrefix=mtx&amp;identifier=info:ofi/fmt:kev:mtx:journal" 
     505                >articles</a> do not provide for all the bibliographic details captured in 
     506            our records. To get a more complete citation in Zotero (or another system of 
     507            your choice), download the <a href="http://www.loc.gov/standards/mods/" 
     508                title="Metadata Object Description Schema">MODS</a> XML file linked below and import it locally.</xsl:element></p> 
     509    </xsl:template> 
     510     
     511    <xsl:template match="mods:relatedItem" mode="coins"> 
     512        <xsl:variable name="parentref"><xsl:value-of select="substring-after(./@xlink:href, '#')"/></xsl:variable> 
     513        <xsl:variable name="parent" select="//mods:mods[@ID=$parentref]"/> 
     514        <xsl:variable name="parentgenre"><xsl:value-of select="$parent/mods:genre"/></xsl:variable> 
     515        <xsl:apply-templates select="$parent" mode="coinsparent"/> 
     516        <xsl:apply-templates select="mods:part/mods:detail" mode="coins"/> 
     517        <xsl:apply-templates select="mods:part/mods:extent" mode="coins"/> 
     518        <xsl:apply-templates select="mods:part/mods:date" mode="coins"/> 
     519 
     520    </xsl:template> 
     521     
     522    <xsl:template match="mods:detail" mode="coins"> 
     523        <xsl:choose> 
     524            <xsl:when test="@type='volume'"> 
     525                rft.volume=<xsl:value-of select="mods:number"/>&amp; 
     526            </xsl:when> 
     527        </xsl:choose> 
     528    </xsl:template> 
     529     
     530    <xsl:template match="mods:extent" mode="coins"> 
     531        <xsl:choose> 
     532            <xsl:when test="@unit='pages'"> 
     533                <xsl:for-each select="mods:start">rft.spage=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     534                <xsl:for-each select="mods:end">rft.epage=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     535            </xsl:when> 
     536            <!-- coins doesn't seem to have support for extents other than columns --> 
     537        </xsl:choose> 
     538    </xsl:template> 
     539     
     540    <xsl:template match="mods:date[ancestor::mods:part]" mode="coins"> 
     541        rft.date=<xsl:value-of select="."/>&amp; 
     542    </xsl:template> 
     543     
     544     
     545     
     546    <xsl:template match="mods:mods" mode="coinsparent"> 
     547        <xsl:call-template name="coins_titles"><xsl:with-param name="mods" select="."/></xsl:call-template> 
     548        <xsl:if test="mods:genre = 'book' or mods:genre = 'collection' or mods:genre = 'multi-volume work'"> 
     549            <xsl:for-each select="mods:originInfo/mods:dateIssued">rft.date=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     550            <xsl:for-each select="mods:originInfo/mods:publisher">rft.pub=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="."/></xsl:with-param></xsl:call-template>&amp;</xsl:for-each> 
     551            <xsl:for-each select="mods:originInfo/mods:place/mods:placeTerm">rft.place=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="."/></xsl:with-param></xsl:call-template>&amp;</xsl:for-each> 
     552            <xsl:for-each select="mods:identifier[@type='isbn']">rft.isbn=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     553        </xsl:if> 
     554        <xsl:for-each select="mods:identifier[@type='issn']">rft.issn=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     555        <xsl:for-each select="mods:identifier[@type='isbn']">rft.isbn=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     556    </xsl:template> 
     557     
     558    <xsl:template name="coins_genre"> 
     559        <xsl:param name="mods"/> 
     560        <xsl:variable name="genre"><xsl:value-of select="$mods/mods:genre"></xsl:value-of></xsl:variable> 
     561        rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3A 
     562        <xsl:choose> 
     563            <xsl:when test="$genre = 'article'"> 
     564                <xsl:variable name="parentgenres"><xsl:call-template name="coins_parentgenres"><xsl:with-param name="mods" select="."/></xsl:call-template></xsl:variable> 
     565                <xsl:choose> 
     566                    <xsl:when test="contains($parentgenres, 'journal')">journal&amp;rft.genre=article&amp;</xsl:when> 
     567                    <xsl:otherwise>book&amp;rft.genre=bookitem&amp;</xsl:otherwise> 
     568                </xsl:choose> 
     569            </xsl:when> 
     570            <xsl:when test="$genre = 'book' or $genre = 'collection' or $genre = 'multi-volume work'">book&amp;rft.genre=book&amp;</xsl:when> 
     571        </xsl:choose> 
     572    </xsl:template> 
     573     
     574    <xsl:template name="coins_parentgenres"> 
     575        <xsl:param name="mods"/> 
     576        <xsl:for-each select="$mods/mods:relatedItem[@type='host']"> 
     577            <xsl:variable name="parentref"><xsl:value-of select="substring-after(./@xlink:href, '#')"/></xsl:variable> 
     578            <xsl:variable name="parent" select="//mods:mods[@ID=$parentref]"/> 
     579            <xsl:value-of select="$parent/mods:genre"/> 
     580        </xsl:for-each> 
     581    </xsl:template> 
     582     
     583    <xsl:template name="coins_titles"> 
     584        <xsl:param name="mods"/> 
     585        <xsl:param name="doshort">yes</xsl:param> 
     586        <xsl:variable name="genre"><xsl:value-of select="$mods/mods:genre"></xsl:value-of></xsl:variable> 
     587        <xsl:variable name="thistitle"><xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="$mods/mods:titleInfo[@type='uniform'][1]/mods:title"/></xsl:with-param></xsl:call-template></xsl:variable> 
     588        <xsl:choose> 
     589            <xsl:when test="$genre = 'article'"> 
     590                rft.atitle=<xsl:value-of select="$thistitle"/>&amp; 
     591            </xsl:when> 
     592            <xsl:when test="$genre = 'book' or $genre = 'collection' or $genre = 'multi-volume work'"> 
     593                rft.btitle=<xsl:value-of select="$thistitle"/>&amp; 
     594            </xsl:when> 
     595            <xsl:when test="$genre='journal'"> 
     596                rft.jtitle=<xsl:value-of select="$thistitle"/>&amp;                 
     597            </xsl:when> 
     598            <xsl:when test="$genre='series'"> 
     599                rft.series=<xsl:value-of select="$thistitle"/>&amp;                 
     600            </xsl:when> 
     601        </xsl:choose> 
     602        <xsl:if test="$doshort='yes' and $genre='journal'"> 
     603            <xsl:for-each select="$mods/mods:titleInfo[@type='abbreviated'][1]"> 
     604                <xsl:variable name="shorttitle"><xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:title"/></xsl:with-param></xsl:call-template></xsl:variable> 
     605                rft.stitle=<xsl:value-of select="$shorttitle"/>&amp; 
     606            </xsl:for-each> 
     607        </xsl:if> 
     608    </xsl:template> 
     609     
     610    <xsl:template match="mods:mods[mods:genre='article']" mode="pig"> 
    414611        <xsl:variable name="parentref"><xsl:value-of select="substring-after(mods:relatedItem[@type='host']/@xlink:href, '#')"/></xsl:variable> 
    415612        <xsl:variable name="parent" select="//mods:mods[@ID=$parentref]"/> 
     
    430627                        rft.aufirst=<xsl:value-of select="mods:namePart[@type='given']"/>&amp; 
    431628                </xsl:if> 
    432                 rft.au=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:namePart[@type='given']"/><xsl:text> </xsl:text><xsl:value-of select="mods:namePart[@type='family']"/></xsl:with-param></xsl:call-template><xsl:if test="following-sibling::mods:name[@type='personal' and mods:role/mods:roleTerm='author']">&amp;</xsl:if> 
     629                rft.au=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:namePart[@type='given']"/><xsl:text> </xsl:text><xsl:value-of select="mods:namePart[@type='family']"/></xsl:with-param></xsl:call-template>&amp; 
    433630            </xsl:for-each> 
    434631        </xsl:variable> 
    435632        <xsl:variable name="cleancoins"><xsl:value-of select="replace(normalize-space($coins), ' ', '')"/></xsl:variable> 
     633        <xsl:variable name="readycoins"> 
     634            <xsl:choose> 
     635                <xsl:when test="substring($cleancoins, string-length($cleancoins), 1) = '&amp;'"> 
     636                    <xsl:value-of select="substring($cleancoins, 1, string-length($cleancoins) - 1)"/> 
     637                </xsl:when> 
     638                <xsl:otherwise><xsl:value-of select="$cleancoins"/></xsl:otherwise> 
     639            </xsl:choose> 
     640        </xsl:variable> 
    436641        <xsl:element name="span"> 
    437642            <xsl:attribute name="class">Z3988</xsl:attribute> 
    438             <xsl:attribute name="title"><xsl:value-of select="$cleancoins"/></xsl:attribute>This page includes embedded COinS bibliographic data.</xsl:element> 
    439     </xsl:template> 
    440      
    441     <!-- missing: support for coins for types other than article --> 
    442     <xsl:template match="mods:mods[mods:genre!='article']" mode="coins"/> 
     643            <xsl:attribute name="title"><xsl:value-of select="$readycoins"/></xsl:attribute>This page includes embedded COinS bibliographic data.</xsl:element> 
     644    </xsl:template> 
     645     
     646    <xsl:template match="mods:mods[mods:genre='book']" mode="pig"> 
     647        <!-- <xsl:variable name="parentref"><xsl:value-of select="substring-after(mods:relatedItem[@type='host']/@xlink:href, '#')"/></xsl:variable> 
     648        <xsl:variable name="parent" select="//mods:mods[@ID=$parentref]"/> --> 
     649        <xsl:variable name="coins"> 
     650            ctx_ver=Z39.88-2004&amp; 
     651            rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp; 
     652            rft.genre=book&amp; 
     653            rft.btitle=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:titleInfo[@type='uniform']/mods:title"/></xsl:with-param></xsl:call-template>&amp; 
     654            rft.title=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:titleInfo[@type='uniform']/mods:title"/></xsl:with-param></xsl:call-template>&amp; 
     655            <xsl:for-each select="mods:identifier[@type='isbn']">rft.isbn=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     656            <xsl:for-each select="mods:name[@type='personal' and mods:role/mods:roleTerm='author']"> 
     657                <xsl:if test="count(preceding-sibling::mods:name[@type='personal']) = 0"> 
     658                        rft.aulast=<xsl:value-of select="mods:namePart[@type='family']"/>&amp; 
     659                        rft.aufirst=<xsl:value-of select="mods:namePart[@type='given']"/>&amp; 
     660                </xsl:if> 
     661                rft.au=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:namePart[@type='given']"/><xsl:text> </xsl:text><xsl:value-of select="mods:namePart[@type='family']"/></xsl:with-param></xsl:call-template>&amp; 
     662            </xsl:for-each> 
     663            <xsl:for-each select="mods:originInfo/mods:dateIssued">rft.date=<xsl:value-of select="."/>&amp;</xsl:for-each> 
     664            <xsl:for-each select="mods:originInfo/mods:publisher">rft.pub=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="."/></xsl:with-param></xsl:call-template>&amp;</xsl:for-each> 
     665            <xsl:for-each select="mods:originInfo/mods:place/mods:placeTerm">rft.place=<xsl:call-template name="makecoinstitle"><xsl:with-param name="rawtitle"><xsl:value-of select="."/></xsl:with-param></xsl:call-template>&amp;</xsl:for-each> 
     666        </xsl:variable> 
     667        <xsl:variable name="cleancoins"><xsl:value-of select="replace(normalize-space($coins), ' ', '')"/></xsl:variable> 
     668        <xsl:variable name="readycoins"> 
     669            <xsl:choose> 
     670                <xsl:when test="substring($cleancoins, string-length($cleancoins), 1) = '&amp;'"> 
     671                    <xsl:value-of select="substring($cleancoins, 1, string-length($cleancoins) - 1)"/> 
     672                </xsl:when> 
     673                <xsl:otherwise><xsl:value-of select="$cleancoins"/></xsl:otherwise> 
     674            </xsl:choose> 
     675        </xsl:variable> 
     676        <xsl:element name="span"> 
     677            <xsl:attribute name="class">Z3988</xsl:attribute> 
     678            <xsl:attribute name="title"><xsl:value-of select="$readycoins"/></xsl:attribute>This page includes embedded COinS bibliographic data.</xsl:element> 
     679    </xsl:template> 
     680 
     681    <xsl:template match="mods:mods" mode="coins"/> 
    443682     
    444683    <xsl:template name="makecoinstitle"> 
    445684        <xsl:param name="rawtitle"/> 
    446         <xsl:value-of select="replace(encode-for-uri(normalize-space($rawtitle)), '%20', '+')"/> 
    447     </xsl:template> 
    448      
     685        <xsl:value-of select="replace(normalize-space($rawtitle), ' ', '+')"/> 
     686    </xsl:template> 
     687 
     688    <!-- ================================================================ 
     689           search for it 
     690           ================================================================ --> 
     691    <xsl:template match="mods:mods" mode="searchforit"> 
     692        <xsl:variable name="genre"><xsl:value-of select="mods:genre"/></xsl:variable> 
     693        <xsl:variable name="parentgenres"><xsl:call-template  name="coins_parentgenres"><xsl:with-param name="mods" select="."/></xsl:call-template></xsl:variable> 
     694        <xsl:variable name="thetitle"><xsl:call-template name="trunctitle"><xsl:with-param name="rawtitle"><xsl:value-of select="mods:titleInfo[@type='uniform'][1]/mods:title"/></xsl:with-param></xsl:call-template></xsl:variable> 
     695        <xsl:variable name="readytitle"><xsl:value-of select="replace(normalize-space($thetitle), ' ', '+')"/></xsl:variable> 
     696        <xsl:variable name="theauthor"><xsl:value-of select="mods:name[@type='personal'][1]/mods:namePart[@type='family']"/></xsl:variable> 
     697        <xsl:variable name="readyauthor"><xsl:value-of select="replace(normalize-space($theauthor), ' ', '+')"/></xsl:variable> 
     698        <ul> 
     699            <xsl:choose> 
     700                <xsl:when test="mods:identifier[@type='isbn']"> 
     701                    <xsl:variable name="isbn"><xsl:value-of select="mods:identifier[@type='isbn']"/></xsl:variable> 
     702                    <li><xsl:element name="a"> 
     703                            <xsl:attribute name="href">http://books.google.com/books?as_isbn=<xsl:value-of select="$isbn"/></xsl:attribute> 
     704                            Search Google Books using ISBN = <xsl:value-of select="$isbn"/></xsl:element></li> 
     705                    <li><xsl:element name="a"> 
     706                            <xsl:attribute name="href">http://www.worldcat.org/search?q=isbn%3A<xsl:value-of select="$isbn"/></xsl:attribute> 
     707                            Search WorldCat using ISBN = <xsl:value-of select="$isbn"/></xsl:element></li> 
     708                </xsl:when> 
     709                <xsl:when test="mods:identifier[@type='issn']"> 
     710                    <xsl:variable name="issn"><xsl:value-of select="mods:identifier[@type='issn']"/></xsl:variable> 
     711                    <li><xsl:element name="a"> 
     712                                <xsl:attribute name="href">http://www.google.com/search?as_epq=<xsl:value-of select="$readytitle"/></xsl:attribute> 
     713                                Search the web using the phrase ("<xsl:value-of select="$thetitle"/>")</xsl:element></li> 
     714                    <li><xsl:element name="a"> 
     715                            <xsl:attribute name="href">http://www.worldcat.org/search?q=issn%3A<xsl:value-of select="$issn"/></xsl:attribute> 
     716                            Search WorldCat using ISSN = <xsl:value-of select="$issn"/></xsl:element></li> 
     717                </xsl:when> 
     718                <xsl:otherwise> 
     719                    <xsl:choose> 
     720                        <xsl:when test="$genre = 'article'"> 
     721                            <li><xsl:element name="a"> 
     722                                <xsl:attribute name="href">http://scholar.google.com/scholar?as_epq=<xsl:value-of select="$readytitle"/><xsl:if test="string-length($readyauthor) &gt; 0">&amp;as_sauthors=<xsl:value-of select="$readyauthor"/></xsl:if></xsl:attribute> 
     723                                Search Google Scholar using title phrase ("<xsl:value-of select="$thetitle"/>") <xsl:if test="string-length($readyauthor)"> and author name ("<xsl:value-of select="$theauthor"/>")</xsl:if></xsl:element></li> 
     724                        </xsl:when> 
     725                        <xsl:when test="$genre = 'book' or $genre = 'collection' or $genre = 'multi-volume work' or $genre = 'journal'"> 
     726                            <li><xsl:element name="a"> 
     727                                <xsl:attribute name="href">http://books.google.com/books?as_vt=<xsl:value-of select="$readytitle"/><xsl:if test="string-length($readyauthor) &gt; 0">&amp;as_auth=<xsl:value-of select="$readyauthor"/></xsl:if></xsl:attribute> 
     728                                Search Google Books using title phrase ("<xsl:value-of select="$thetitle"/>") <xsl:if test="string-length($readyauthor)"> and author name ("<xsl:value-of select="$theauthor"/>")</xsl:if></xsl:element></li> 
     729                            <li><xsl:element name="a"> 
     730                                <xsl:attribute name="href">http://www.worldcat.org/search?q=<xsl:value-of select="$readytitle"/></xsl:attribute> 
     731                                Search WorldCat using title phrase ("<xsl:value-of select="$thetitle"/>")</xsl:element></li> 
     732                        </xsl:when> 
     733                        <xsl:otherwise> 
     734                            <li><xsl:element name="a"> 
     735                                <xsl:attribute name="href">http://www.google.com/search?as_epq=<xsl:value-of select="$readytitle"/></xsl:attribute> 
     736                                Search the web using the phrase ("<xsl:value-of select="$thetitle"/>")</xsl:element></li> 
     737                        </xsl:otherwise> 
     738                    </xsl:choose> 
     739                </xsl:otherwise> 
     740            </xsl:choose> 
     741        </ul> 
     742    </xsl:template> 
     743 
    449744    <!-- ================================================================ 
    450745           utility functions; mostly named templates 
     
    468763    <xsl:template name="makenewid"> 
    469764        <xsl:variable name="titletouse"><xsl:call-template name="getbesttitle"/></xsl:variable> 
    470         <xsl:variable name="titleready"> 
    471             <xsl:choose> 
    472                 <xsl:when test="contains($titletouse, ':')"><xsl:value-of select="normalize-space(substring-before($titletouse, ':'))"/></xsl:when> 
    473                 <xsl:when test="contains($titletouse, ';')"><xsl:value-of select="normalize-space(substring-before($titletouse, ';'))"/></xsl:when> 
    474                 <xsl:when test="contains($titletouse, ',')"><xsl:value-of select="normalize-space(substring-before($titletouse, ','))"/></xsl:when> 
    475                 <xsl:when test="string-length($titletouse) &gt; 60"><xsl:for-each select="tokenize( substring($titletouse, 1, 60), ' ')"><xsl:if test="contains($titletouse, concat(., ' '))"><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:if></xsl:for-each></xsl:when> 
    476                 <xsl:otherwise><xsl:value-of select="$titletouse"/></xsl:otherwise> 
    477             </xsl:choose> 
    478         </xsl:variable> 
     765        <xsl:variable name="titleready"><xsl:call-template name="trunctitle"><xsl:with-param name="rawtitle" select="$titletouse"/></xsl:call-template></xsl:variable> 
    479766        <xsl:variable name="rawid"><xsl:call-template name="escaper"><xsl:with-param name="victim" select="replace(normalize-space($titleready), ' ', '-')"/></xsl:call-template></xsl:variable> 
    480767        <xsl:value-of select="lower-case($rawid)"/> 
     768    </xsl:template> 
     769     
     770    <xsl:template name="trunctitle"> 
     771        <xsl:param name="rawtitle"/> 
     772        <xsl:choose> 
     773            <xsl:when test="contains($rawtitle, ':')"><xsl:value-of select="normalize-space(substring-before($rawtitle, ':'))"/></xsl:when> 
     774            <xsl:when test="contains($rawtitle, ';')"><xsl:value-of select="normalize-space(substring-before($rawtitle, ';'))"/></xsl:when> 
     775            <xsl:when test="contains($rawtitle, ',')"><xsl:value-of select="normalize-space(substring-before($rawtitle, ','))"/></xsl:when> 
     776            <xsl:when test="string-length($rawtitle) &gt; 60"><xsl:for-each select="tokenize( substring($rawtitle, 1, 60), ' ')"><xsl:if test="contains($rawtitle, concat(., ' '))"><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:if></xsl:for-each></xsl:when> 
     777            <xsl:otherwise><xsl:value-of select="$rawtitle"/></xsl:otherwise> 
     778        </xsl:choose> 
    481779    </xsl:template> 
    482780     
     
    491789    </xsl:template> 
    492790 
     791    <xsl:function name="a:escapetoascii"> 
     792        <xsl:param name="victim"/> 
     793        <xsl:variable name="thing"><xsl:call-template name="escaper"> 
     794            <xsl:with-param name="subapos">yes</xsl:with-param> 
     795            <xsl:with-param name="victim" select="$victim"/> 
     796        </xsl:call-template></xsl:variable> 
     797        <xsl:value-of select="$thing"/> 
     798    </xsl:function> 
     799     
    493800    <xsl:template name="escaper"> 
    494801        <xsl:param name="victim"/> 
     802        <xsl:param name="subapos">yes</xsl:param> 
    495803        <xsl:for-each select="string-to-codepoints($victim)"> 
    496804            <xsl:choose> 
     
    504812 
    505813                <!-- handle apostrophes specially --> 
    506                 <xsl:when test=". = 39">-</xsl:when> 
    507                 <xsl:when test=". = 8217">-</xsl:when> 
     814                <xsl:when test=". = 39 or . = 8217"> 
     815                    <xsl:choose> 
     816                        <xsl:when test="$subapos">-</xsl:when> 
     817                        <xsl:otherwise>'</xsl:otherwise> 
     818                    </xsl:choose> 
     819                </xsl:when> 
    508820 
    509821                <!-- dumb down to base ASCII -->