summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:17:32 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:17:32 +0000
commite38d2351b83fa65c66ccde443777647ef5cb6cff (patch)
tree1897fc20e9f73a81c520a5b9f76f8ed042124883 /xslt
downloadtellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz
tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'xslt')
-rw-r--r--xslt/MARC21slim2MODS3.xsl2517
-rw-r--r--xslt/MARC21slimUtils.xsl82
-rw-r--r--xslt/Makefile.am29
-rw-r--r--xslt/UNIMARC2MODS3.xsl2920
-rw-r--r--xslt/amazon2tellico.xsl590
-rw-r--r--xslt/arxiv2tellico.xsl277
-rw-r--r--xslt/bluray-logo.pngbin0 -> 1359 bytes
-rw-r--r--xslt/cassette-logo.pngbin0 -> 1042 bytes
-rw-r--r--xslt/cd-logo.pngbin0 -> 2153 bytes
-rw-r--r--xslt/crossref2tellico.xsl121
-rw-r--r--xslt/delicious2tellico.xsl164
-rw-r--r--xslt/discogs2tellico.xsl206
-rw-r--r--xslt/dvd-logo.pngbin0 -> 4387 bytes
-rw-r--r--xslt/entry-templates/Album.xsl497
-rw-r--r--xslt/entry-templates/Compact.xsl294
-rw-r--r--xslt/entry-templates/Default.xsl346
-rw-r--r--xslt/entry-templates/Fancy.xsl444
-rw-r--r--xslt/entry-templates/Makefile.am17
-rw-r--r--xslt/entry-templates/Video.xsl512
-rw-r--r--xslt/gcstar2tellico.xsl503
-rw-r--r--xslt/hddvd-logo.pngbin0 -> 2390 bytes
-rw-r--r--xslt/isbndb2tellico.xsl205
-rw-r--r--xslt/mods2tellico.xsl521
-rw-r--r--xslt/pubmed2tellico.xsl190
-rw-r--r--xslt/record-logo.pngbin0 -> 9306 bytes
-rw-r--r--xslt/referencer2tellico.xsl120
-rw-r--r--xslt/report-templates/Column_View.xsl310
-rw-r--r--xslt/report-templates/Group_Summary.xsl323
-rw-r--r--xslt/report-templates/Group_View.xsl284
-rw-r--r--xslt/report-templates/Image_List.xsl250
-rw-r--r--xslt/report-templates/Loan_View.xsl201
-rw-r--r--xslt/report-templates/Makefile.am21
-rw-r--r--xslt/report-templates/Title_Listing_(Horizontal).xsl146
-rw-r--r--xslt/report-templates/Title_Listing_(Vertical).xsl156
-rw-r--r--xslt/report-templates/Tri-Column.xsl234
-rw-r--r--xslt/shadowAlpha.pngbin0 -> 1670 bytes
-rw-r--r--xslt/tellico-by-author.xsl159
-rw-r--r--xslt/tellico-by-title.xsl120
-rw-r--r--xslt/tellico-common.xsl307
-rw-r--r--xslt/tellico-printing.xsl381
-rw-r--r--xslt/tellico2gcstar.xsl286
-rw-r--r--xslt/tellico2html.js620
-rw-r--r--xslt/tellico2html.xsl625
-rw-r--r--xslt/tellico2onix.xsl149
-rw-r--r--xslt/unixref2tellico.xsl174
-rw-r--r--xslt/vhs-logo.pngbin0 -> 2081 bytes
-rw-r--r--xslt/welcome.html60
-rw-r--r--xslt/xmp2tellico.xsl176
-rw-r--r--xslt/yahoo2tellico.xsl86
49 files changed, 15623 insertions, 0 deletions
diff --git a/xslt/MARC21slim2MODS3.xsl b/xslt/MARC21slim2MODS3.xsl
new file mode 100644
index 0000000..f33e0bc
--- /dev/null
+++ b/xslt/MARC21slim2MODS3.xsl
@@ -0,0 +1,2517 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xlink marc">
+ <xsl:include href="MARC21slimUtils.xsl"/>
+ <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+
+<!-- This file is in the public domain. -->
+
+<!--
+
+Revision 1.10 MODS 3.1 revisions to language and classification elements 2006/02/06 ggar
+
+Revision 1.9 subfield $y was added to field 242 2004/09/02 10:57 jrad
+
+Revision 1.8 Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
+
+Revision 1.7 2004/03/25 08:29 jrad
+
+Revision 1.6 various validation fixes 2004/02/20 ntra
+
+Revision 1.5 2003/10/02 16:18:58 ntra
+MODS2 to MODS3 updates, language unstacking and
+de-duping, chopPunctuation expanded
+
+Revision 1.3 2003/04/03 00:07:19 ntra
+Revision 1.3 Additional Changes not related to MODS Version 2.0 by ntra
+
+Revision 1.2 2003/03/24 19:37:42 ckeith
+Added Log Comment
+
+-->
+ <xsl:template match="/">
+ <modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-1.xsd">
+ <xsl:for-each select=".//marc:record">
+ <mods version="3.1">
+ <xsl:call-template name="marcRecord"/>
+ </mods>
+ </xsl:for-each>
+ </modsCollection>
+ </xsl:template>
+ <xsl:template name="marcRecord">
+ <xsl:variable name="leader" select="marc:leader"/>
+ <xsl:variable name="leader6" select="substring($leader,7,1)"/>
+ <xsl:variable name="leader7" select="substring($leader,8,1)"/>
+ <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
+ <xsl:variable name="typeOf008">
+ <xsl:choose>
+ <xsl:when test="$leader6='a'">
+ <xsl:choose>
+ <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
+ <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$leader6='t'">BK</xsl:when>
+ <xsl:when test="$leader6='p'">MM</xsl:when>
+ <xsl:when test="$leader6='m'">CF</xsl:when>
+ <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
+ <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
+ <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:for-each select="marc:datafield[@tag=245]">
+ <titleInfo>
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='b']">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">b</xsl:with-param>
+ <xsl:with-param name="beforeCodes">afghk</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abfgk</xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="titleChop">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="$title"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@ind2&gt;0">
+ <nonSort>
+ <xsl:value-of select="substring($titleChop,1,@ind2)"/>
+ </nonSort>
+ <title>
+ <xsl:value-of select="substring($titleChop,@ind2+1)"/>
+ </title>
+ </xsl:when>
+ <xsl:otherwise>
+ <title>
+ <xsl:value-of select="$titleChop"/>
+ </title>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="marc:subfield[@code='b']">
+ <subTitle>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">b</xsl:with-param>
+ <xsl:with-param name="anyCodes">b</xsl:with-param>
+ <xsl:with-param name="afterCodes">afghk</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </subTitle>
+ </xsl:if>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=210]">
+ <titleInfo type="abbreviated">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="subtitle"/>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=242]">
+ <titleInfo type="translated">
+ <!--09/01/04 Added subfield $y-->
+ <xsl:for-each select="marc:subfield[@code='y']">
+ <xsl:attribute name="lang"><xsl:value-of select="text()"/></xsl:attribute>
+ </xsl:for-each>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <!-- 1/04 removed $h, b -->
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <!-- 1/04 fix -->
+ <xsl:call-template name="subtitle"/>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=246]">
+ <titleInfo type="alternative">
+ <xsl:for-each select="marc:subfield[@code='i']">
+ <xsl:attribute name="displayLabel"><xsl:value-of select="text()"/></xsl:attribute>
+ </xsl:for-each>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <!-- 1/04 removed $h, $b -->
+ <xsl:with-param name="codes">af</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="subtitle"/>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">
+ <titleInfo type="uniform">
+ <title>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="(contains('adfklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=740][@ind2!=2]">
+ <titleInfo type="alternative">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ah</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=100]">
+ <name type="personal">
+ <xsl:call-template name="nameABCDQ"/>
+ <xsl:call-template name="affiliation"/>
+ <role>
+ <roleTerm authority="marcrelator" type="text">creator</roleTerm>
+ </role>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=110]">
+ <name type="corporate">
+ <xsl:call-template name="nameABCDN"/>
+ <role>
+ <roleTerm authority="marcrelator" type="text">creator</roleTerm>
+ </role>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=111]">
+ <name type="conference">
+ <xsl:call-template name="nameACDEQ"/>
+ <role>
+ <roleTerm authority="marcrelator" type="text">creator</roleTerm>
+ </role>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=700][not(marc:subfield[@code='t'])]">
+ <name type="personal">
+ <xsl:call-template name="nameABCDQ"/>
+ <xsl:call-template name="affiliation"/>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=710][not(marc:subfield[@code='t'])]">
+ <name type="corporate">
+ <xsl:call-template name="nameABCDN"/>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=711][not(marc:subfield[@code='t'])]">
+ <name type="conference">
+ <xsl:call-template name="nameACDEQ"/>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=720][not(marc:subfield[@code='t'])]">
+ <name>
+ <xsl:if test="@ind1=1">
+ <xsl:attribute name="type"><xsl:text>personal</xsl:text></xsl:attribute>
+ </xsl:if>
+ <namePart>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </namePart>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+ <typeOfResource>
+ <xsl:if test="$leader7='c'">
+ <xsl:attribute name="collection">yes</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
+ <xsl:attribute name="manuscript">yes</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
+ <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
+ <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
+ <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
+ <xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
+ <xsl:when test="$leader6='k'">still image</xsl:when>
+ <xsl:when test="$leader6='g'">moving image</xsl:when>
+ <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
+ <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
+ <xsl:when test="$leader6='p'">mixed material</xsl:when>
+ </xsl:choose>
+ </typeOfResource>
+ <xsl:if test="substring($controlField008,26,1)='d'">
+ <genre authority="marc">globe</genre>
+ </xsl:if>
+ <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
+ <genre authority="marc">remote sensing image</genre>
+ </xsl:if>
+ <xsl:if test="$typeOf008='MP'">
+ <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-25='a' or $controlField008-25='b' or $controlField008-25='c' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
+ <genre authority="marc">map</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
+ <genre authority="marc">atlas</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$typeOf008='SE'">
+ <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-21='d'">
+ <genre authority="marc">database</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='l'">
+ <genre authority="marc">loose-leaf</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='m'">
+ <genre authority="marc">series</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='n'">
+ <genre authority="marc">newspaper</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='p'">
+ <genre authority="marc">periodical</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='w'">
+ <genre authority="marc">web site</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
+ <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
+ <xsl:choose>
+ <xsl:when test="contains($controlField008-24,'a')">
+ <genre authority="marc">abstract or summary</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'b')">
+ <genre authority="marc">bibliography</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'c')">
+ <genre authority="marc">catalog</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'d')">
+ <genre authority="marc">dictionary</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'e')">
+ <genre authority="marc">encyclopedia</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'f')">
+ <genre authority="marc">handbook</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'g')">
+ <genre authority="marc">legal article</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'i')">
+ <genre authority="marc">index</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'k')">
+ <genre authority="marc">discography</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'l')">
+ <genre authority="marc">legislation</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'m')">
+ <genre authority="marc">theses</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'n')">
+ <genre authority="marc">survey of literature</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'o')">
+ <genre authority="marc">review</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'p')">
+ <genre authority="marc">programmed text</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'q')">
+ <genre authority="marc">filmography</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'r')">
+ <genre authority="marc">directory</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'s')">
+ <genre authority="marc">statistics</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'t')">
+ <genre authority="marc">technical report</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'v')">
+ <genre authority="marc">legal case and case notes</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'w')">
+ <genre authority="marc">law report or digest</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'z')">
+ <genre authority="marc">treaty</genre>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-29='1'">
+ <genre authority="marc">conference publication</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$typeOf008='CF'">
+ <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-26='a'">
+ <genre authority="marc">numeric data</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-26='e'">
+ <genre authority="marc">database</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-26='f'">
+ <genre authority="marc">font</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-26='g'">
+ <genre authority="marc">game</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$typeOf008='BK'">
+ <xsl:if test="substring($controlField008,25,1)='j'">
+ <genre authority="marc">patent</genre>
+ </xsl:if>
+ <xsl:if test="substring($controlField008,31,1)='1'">
+ <genre authority="marc">festschrift</genre>
+ </xsl:if>
+ <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
+ <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
+ <genre authority="marc">biography</genre>
+ </xsl:if>
+ <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-33='e'">
+ <genre authority="marc">essay</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='d'">
+ <genre authority="marc">drama</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='c'">
+ <genre authority="marc">comic strip</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='l'">
+ <genre authority="marc">fiction</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='h'">
+ <genre authority="marc">humor, satire</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='i'">
+ <genre authority="marc">letter</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='f'">
+ <genre authority="marc">novel</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='j'">
+ <genre authority="marc">short story</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='s'">
+ <genre authority="marc">speech</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$typeOf008='MU'">
+ <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
+ <xsl:if test="contains($controlField008-30-31,'b')">
+ <genre authority="marc">biography</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'c')">
+ <genre authority="marc">conference publication</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'d')">
+ <genre authority="marc">drama</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'e')">
+ <genre authority="marc">essay</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'f')">
+ <genre authority="marc">fiction</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'o')">
+ <genre authority="marc">folktale</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'h')">
+ <genre authority="marc">history</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'k')">
+ <genre authority="marc">humor, satire</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'m')">
+ <genre authority="marc">memoir</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'p')">
+ <genre authority="marc">poetry</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'r')">
+ <genre authority="marc">rehearsal</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'g')">
+ <genre authority="marc">reporting</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'s')">
+ <genre authority="marc">sound</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'l')">
+ <genre authority="marc">speech</genre>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$typeOf008='VM'">
+ <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-33='a'">
+ <genre authority="marc">art original</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='b'">
+ <genre authority="marc">kit</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='c'">
+ <genre authority="marc">art reproduction</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='d'">
+ <genre authority="marc">diorama</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='f'">
+ <genre authority="marc">filmstrip</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='g'">
+ <genre authority="marc">legal article</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='i'">
+ <genre authority="marc">picture</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='k'">
+ <genre authority="marc">graphic</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='l'">
+ <genre authority="marc">technical drawing</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='m'">
+ <genre authority="marc">motion picture</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='n'">
+ <genre authority="marc">chart</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='o'">
+ <genre authority="marc">flash card</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='p'">
+ <genre authority="marc">microscope slide</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
+ <genre authority="marc">model</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='r'">
+ <genre authority="marc">realia</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='s'">
+ <genre authority="marc">slide</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='t'">
+ <genre authority="marc">transparency</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='v'">
+ <genre authority="marc">videorecording</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='w'">
+ <genre authority="marc">toy</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=655]">
+ <genre authority="marc">
+ <xsl:attribute name="authority"><xsl:value-of select="marc:subfield[@code='2']"/></xsl:attribute>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abvxyz</xsl:with-param>
+ <xsl:with-param name="delimeter">-</xsl:with-param>
+ </xsl:call-template>
+ </genre>
+ </xsl:for-each>
+ <originInfo>
+ <xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"/>
+ <xsl:if test="translate($MARCpublicationCode,'|','')">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">code</xsl:attribute>
+ <xsl:attribute name="authority">marccountry</xsl:attribute>
+ <xsl:value-of select="$MARCpublicationCode"/>
+ </placeTerm>
+ </place>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">code</xsl:attribute>
+ <xsl:attribute name="authority">iso3166</xsl:attribute>
+ <xsl:value-of select="."/>
+ </placeTerm>
+ </place>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">text</xsl:attribute>
+ <xsl:call-template name="chopPunctuationFront">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </placeTerm>
+ </place>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
+ <dateValid point="start">
+ <xsl:value-of select="."/>
+ </dateValid>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
+ <dateValid point="end">
+ <xsl:value-of select="."/>
+ </dateValid>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
+ <dateModified>
+ <xsl:value-of select="."/>
+ </dateModified>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
+ <xsl:choose>
+ <xsl:when test="@code='b'">
+ <publisher>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/ </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </publisher>
+ </xsl:when>
+ <xsl:when test="@code='c'">
+ <dateIssued>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </dateIssued>
+ </xsl:when>
+ <xsl:when test="@code='g'">
+ <dateCreated>
+ <xsl:value-of select="."/>
+ </dateCreated>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:variable name="dataField260c">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"/>
+ <xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"/>
+ <xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"/>
+ <xsl:if test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
+ <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
+ <dateIssued encoding="marc">
+ <xsl:value-of select="$controlField008-7-10"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
+ <xsl:if test="$controlField008-7-10">
+ <dateIssued encoding="marc" point="start">
+ <xsl:value-of select="$controlField008-7-10"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
+ <xsl:if test="$controlField008-11-14">
+ <dateIssued encoding="marc" point="end">
+ <xsl:value-of select="$controlField008-11-14"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$controlField008-6='q'">
+ <xsl:if test="$controlField008-7-10">
+ <dateIssued encoding="marc" point="start" qualifier="questionable">
+ <xsl:value-of select="$controlField008-7-10"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$controlField008-6='q'">
+ <xsl:if test="$controlField008-11-14">
+ <dateIssued encoding="marc" point="end" qualifier="questionable">
+ <xsl:value-of select="$controlField008-11-14"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$controlField008-6='t'">
+ <xsl:if test="$controlField008-11-14">
+ <copyrightDate encoding="marc">
+ <xsl:value-of select="$controlField008-11-14"/>
+ </copyrightDate>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
+ <dateCaptured encoding="iso8601">
+ <xsl:value-of select="."/>
+ </dateCaptured>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
+ <dateCaptured encoding="iso8601" point="start">
+ <xsl:value-of select="."/>
+ </dateCaptured>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
+ <dateCaptured encoding="iso8601" point="end">
+ <xsl:value-of select="."/>
+ </dateCaptured>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+ </xsl:for-each>
+ <xsl:for-each select="marc:leader">
+ <issuance>
+ <xsl:choose>
+ <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when>
+ <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">continuing</xsl:when>
+ </xsl:choose>
+ </issuance>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
+ <frequency>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </frequency>
+ </xsl:for-each>
+ </originInfo>
+ <xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>
+ <xsl:if test="$controlField008-35-37">
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="substring($controlField008,36,3)"/>
+ </languageTerm>
+ </language>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=041]">
+ <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='d' or @code='e' or @code='f' or @code='g' or @code='h']">
+ <xsl:variable name="langCodes" select="."/>
+ <xsl:choose>
+ <xsl:when test="../marc:subfield[@code='2']='rfc3066'">
+ <!-- not stacked but could be repeated -->
+ <xsl:call-template name="rfcLanguages">
+ <xsl:with-param name="nodeNum">
+ <xsl:value-of select="1"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:text/>
+ </xsl:with-param>
+ <xsl:with-param name="controlField008-35-37">
+ <xsl:value-of select="$controlField008-35-37"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- iso -->
+ <xsl:variable name="allLanguages">
+ <xsl:copy-of select="$langCodes"/>
+ </xsl:variable>
+ <xsl:variable name="currentLanguage">
+ <xsl:value-of select="substring($allLanguages,1,3)"/>
+ </xsl:variable>
+ <xsl:call-template name="isoLanguage">
+ <xsl:with-param name="currentLanguage">
+ <xsl:value-of select="substring($allLanguages,1,3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="remainingLanguages">
+ <xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:if test="$controlField008-35-37">
+ <xsl:value-of select="$controlField008-35-37"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:variable name="physicalDescription">
+ <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a' or substring(.,12,1)='b']">
+ <digitalOrigin>reformatted digital</digitalOrigin>
+ </xsl:if>
+ <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
+ <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
+ <xsl:variable name="check008-23">
+ <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
+ <xsl:value-of select="true()"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="check008-29">
+ <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
+ <xsl:value-of select="true()"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
+ <form authority="marcform">braille</form>
+ </xsl:when>
+ <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
+ <form authority="marcform">print</form>
+ </xsl:when>
+ <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
+ <form authority="marcform">electronic</form>
+ </xsl:when>
+ <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
+ <form authority="marcform">microfiche</form>
+ </xsl:when>
+ <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
+ <form authority="marcform">microfilm</form>
+ </xsl:when>
+ </xsl:choose>
+ <!-- 1/04 fix -->
+ <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
+ <form>
+ <xsl:value-of select="."/>
+ </form>
+ </xsl:for-each>
+ <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
+ <xsl:choose>
+ <xsl:when test="substring(text(),14,1)='a'">
+ <reformattingQuality>access</reformattingQuality>
+ </xsl:when>
+ <xsl:when test="substring(text(),14,1)='p'">
+ <reformattingQuality>preservation</reformattingQuality>
+ </xsl:when>
+ <xsl:when test="substring(text(),14,1)='r'">
+ <reformattingQuality>replacement</reformattingQuality>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)&gt;1]">
+ <internetMediaType>
+ <xsl:value-of select="."/>
+ </internetMediaType>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=300]">
+ <extent>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abce</xsl:with-param>
+ </xsl:call-template>
+ </extent>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:if test="string-length(normalize-space($physicalDescription))">
+ <physicalDescription>
+ <xsl:copy-of select="$physicalDescription"/>
+ </physicalDescription>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=520]">
+ <abstract>
+ <xsl:call-template name="uri"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </abstract>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=505]">
+ <tableOfContents>
+ <xsl:call-template name="uri"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">agrt</xsl:with-param>
+ </xsl:call-template>
+ </tableOfContents>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=521]">
+ <targetAudience>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </targetAudience>
+ </xsl:for-each>
+ <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
+ <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
+ <xsl:choose>
+ <!-- 01/04 fix -->
+ <xsl:when test="$controlField008-22='d'">
+ <targetAudience authority="marctarget">adolescent</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='e'">
+ <targetAudience authority="marctarget">adult</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='g'">
+ <targetAudience authority="marctarget">general</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
+ <targetAudience authority="marctarget">juvenile</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='a'">
+ <targetAudience authority="marctarget">preschool</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='f'">
+ <targetAudience authority="marctarget">specialized</targetAudience>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
+ <note type="statement of responsibility">
+ <xsl:value-of select="."/>
+ </note>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=500]">
+ <note>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ <xsl:call-template name="uri"/>
+ </note>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=511]">
+ <note type="performers">
+ <xsl:call-template name="uri"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </note>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=518]">
+ <note type="venue">
+ <xsl:call-template name="uri"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </note>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=506 or @tag=507 or @tag=508 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=530 or @tag=533 or @tag=534 or @tag=535 or @tag=536 or @tag=538 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=583 or @tag=584 or @tag=585 or @tag=586]">
+ <note>
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
+ <subject>
+ <cartographics>
+ <coordinates>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">defg</xsl:with-param>
+ </xsl:call-template>
+ </coordinates>
+ </cartographics>
+ </subject>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=043]">
+ <subject>
+ <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
+ <geographicCode>
+ <xsl:attribute name="authority"><xsl:if test="@code='a'"><xsl:text>marcgac</xsl:text></xsl:if><xsl:if test="@code='b'"><xsl:value-of select="following-sibling::marc:subfield[@code=2]"/></xsl:if><xsl:if test="@code='c'"><xsl:text>iso3166</xsl:text></xsl:if></xsl:attribute>
+ <xsl:value-of select="self::marc:subfield"/>
+ </geographicCode>
+ </xsl:for-each>
+ </subject>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=255]">
+ <subject>
+ <cartographics>
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <coordinates>
+ <xsl:value-of select="."/>
+ </coordinates>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <scale>
+ <xsl:value-of select="."/>
+ </scale>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <projection>
+ <xsl:value-of select="."/>
+ </projection>
+ </xsl:for-each>
+ </cartographics>
+ </subject>
+ </xsl:for-each>
+ <xsl:apply-templates select="marc:datafield[653 &gt;= @tag and @tag &gt;= 600]"/>
+ <xsl:apply-templates select="marc:datafield[@tag=656]"/>
+ <xsl:for-each select="marc:datafield[@tag=752]">
+ <subject>
+ <hierarchicalGeographic>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <country>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </country>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <state>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </state>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <county>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </county>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='d']">
+ <city>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </city>
+ </xsl:for-each>
+ </hierarchicalGeographic>
+ </subject>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
+ <subject>
+ <xsl:choose>
+ <xsl:when test="@ind1=2">
+ <temporal encoding="iso8601" point="start">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='b'][1]"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </temporal>
+ <temporal encoding="iso8601" point="end">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='b'][2]"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </temporal>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <temporal encoding="iso8601">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </temporal>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </subject>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=055]">
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <classification authority="lcc">
+ <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="text()"/>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
+ <classification authority="lcc">
+ <xsl:value-of select="text()"/>
+ </classification>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=050]">
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <classification authority="lcc">
+ <xsl:if test="../marc:subfield[@code='3']">
+ <xsl:attribute name="displayLabel"><xsl:value-of select="../marc:subfield[@code='3']"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="text()"/>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
+ <classification authority="lcc">
+ <xsl:if test="../marc:subfield[@code='3']">
+ <xsl:attribute name="displayLabel"><xsl:value-of select="../marc:subfield[@code='3']"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="text()"/>
+ </classification>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=082]">
+ <classification authority="ddc">
+ <xsl:if test="marc:subfield[@code='2']">
+ <xsl:attribute name="edition"><xsl:value-of select="marc:subfield[@code='2']"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=080]">
+ <classification authority="udc">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abx</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=060]">
+ <classification authority="nlm">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
+ <classification authority="sudocs">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
+ <classification authority="candoc">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=086]">
+ <classification>
+ <xsl:attribute name="authority"><xsl:value-of select="marc:subfield[@code='2']"/></xsl:attribute>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=084]">
+ <classification>
+ <xsl:attribute name="authority"><xsl:value-of select="marc:subfield[@code='2']"/></xsl:attribute>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=440]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">av</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">av</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=510]">
+ <relatedItem type="isReferencedBy">
+ <note>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcx3</xsl:with-param>
+ </xsl:call-template>
+ </note>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=534]">
+ <relatedItem type="original">
+ <xsl:call-template name="relatedTitle"/>
+ <xsl:call-template name="relatedName"/>
+ <xsl:if test="marc:subfield[@code='b' or @code='c']">
+ <originInfo>
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <publisher>
+ <xsl:value-of select="."/>
+ </publisher>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+ </xsl:for-each>
+ </originInfo>
+ </xsl:if>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ <xsl:for-each select="marc:subfield[@code='z']">
+ <identifier type="isbn">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:call-template name="relatedNote"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <name type="personal">
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aq</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">dg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="corporate">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:variable name="tempNamePart">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">c</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="normalize-space($tempNamePart)">
+ <namePart>
+ <xsl:value-of select="$tempNamePart"/>
+ </namePart>
+ </xsl:if>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="conference">
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">gn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
+ <relatedItem type="series">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
+ <relatedItem>
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=775]">
+ <relatedItem type="otherVersion">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
+ <relatedItem type="constituent">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
+ <relatedItem type="host">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=776]">
+ <relatedItem type="otherFormat">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=780]">
+ <relatedItem type="preceding">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=785]">
+ <relatedItem type="succeeding">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=786]">
+ <relatedItem type="original">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=800]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <name type="personal">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aq</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=810]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">dg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="corporate">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">c</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=811]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="conference">
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">gn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=830]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=856][@ind2=2]/marc:subfield[@code='q']">
+ <relatedItem>
+ <internetMediaType>
+ <xsl:value-of select="."/>
+ </internetMediaType>
+ </relatedItem>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=020]">
+ <identifier type="isbn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1=0]">
+ <identifier type="isrc">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1=2]">
+ <identifier type="ismn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=022]">
+ <identifier type="issn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=010]">
+ <identifier type="lccn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=028]">
+ <identifier>
+ <xsl:call-template name="isInvalid"/>
+ <xsl:attribute name="type"><xsl:choose><xsl:when test="@ind1=0">issue number</xsl:when><xsl:when test="@ind1=1">matrix number</xsl:when><xsl:when test="@ind1=2">music plate</xsl:when><xsl:when test="@ind1=3">music publisher</xsl:when><xsl:when test="@ind1=4">videorecording identifier</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">
+ <xsl:choose>
+ <xsl:when test="@ind1=0">ba</xsl:when>
+ <xsl:otherwise>ab</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1='4']">
+ <identifier type="sici">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=037]">
+ <identifier type="stock number">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
+ <identifier>
+ <xsl:attribute name="type"><xsl:choose><xsl:when test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:when><xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov')">hdl</xsl:when><xsl:otherwise>uri</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov') ">
+ <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="marc:subfield[@code='u']"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </identifier>
+ <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
+ <identifier type="hdl">
+ <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
+ <xsl:attribute name="displayLabel"><xsl:call-template name="subfieldSelect"><xsl:with-param name="codes">y3z</xsl:with-param></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/>
+ </identifier>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
+ <identifier type="upc">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+ <!-- 1/04 fix added $y -->
+ <xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
+ <location>
+ <url>
+ <xsl:if test="marc:subfield[@code='y' or @code='3']">
+ <xsl:attribute name="displayLabel"><xsl:call-template name="subfieldSelect"><xsl:with-param name="codes">y3</xsl:with-param></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="marc:subfield[@code='u']"/>
+ </url>
+ </location>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=852]">
+ <location>
+ <physicalLocation>
+ <xsl:call-template name="displayLabel"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abje</xsl:with-param>
+ </xsl:call-template>
+ </physicalLocation>
+ </location>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=506]">
+ <accessCondition type="restrictionOnAccess">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcd35</xsl:with-param>
+ </xsl:call-template>
+ </accessCondition>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=540]">
+ <accessCondition type="useAndReproduction">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcde35</xsl:with-param>
+ </xsl:call-template>
+ </accessCondition>
+ </xsl:for-each>
+ <recordInfo>
+ <xsl:for-each select="marc:datafield[@tag=040]">
+ <recordContentSource authority="marcorg">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </recordContentSource>
+ </xsl:for-each>
+ <xsl:for-each select="marc:controlfield[@tag=008]">
+ <recordCreationDate encoding="marc">
+ <xsl:value-of select="substring(.,1,6)"/>
+ </recordCreationDate>
+ </xsl:for-each>
+ <xsl:for-each select="marc:controlfield[@tag=005]">
+ <recordChangeDate encoding="iso8601">
+ <xsl:value-of select="."/>
+ </recordChangeDate>
+ </xsl:for-each>
+ <xsl:for-each select="marc:controlfield[@tag=001]">
+ <recordIdentifier>
+ <xsl:if test="../marc:controlfield[@tag=003]">
+ <xsl:attribute name="source"><xsl:value-of select="../marc:controlfield[@tag=003]"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="."/>
+ </recordIdentifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
+ <languageOfCataloging>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="."/>
+ </languageTerm>
+ </languageOfCataloging>
+ </xsl:for-each>
+ </recordInfo>
+ </xsl:template>
+ <xsl:template name="displayForm">
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <displayForm>
+ <xsl:value-of select="."/>
+ </displayForm>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="affiliation">
+ <xsl:for-each select="marc:subfield[@code='u']">
+ <affiliation>
+ <xsl:value-of select="."/>
+ </affiliation>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="uri">
+ <xsl:for-each select="marc:subfield[@code='u']">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="role">
+ <xsl:for-each select="marc:subfield[@code='e']">
+ <role>
+ <roleTerm type="text">
+ <xsl:value-of select="."/>
+ </roleTerm>
+ </role>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='4']">
+ <role>
+ <roleTerm authority="marcrelator" type="code">
+ <xsl:value-of select="."/>
+ </roleTerm>
+ </role>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="part">
+ <xsl:variable name="partNumber">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">n</xsl:with-param>
+ <xsl:with-param name="anyCodes">n</xsl:with-param>
+ <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="partName">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">p</xsl:with-param>
+ <xsl:with-param name="anyCodes">p</xsl:with-param>
+ <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length(normalize-space($partNumber))">
+ <partNumber>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$partNumber"/>
+ </xsl:call-template>
+ </partNumber>
+ </xsl:if>
+ <xsl:if test="string-length(normalize-space($partName))">
+ <partName>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$partName"/>
+ </xsl:call-template>
+ </partName>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="relatedPart">
+ <xsl:if test="@tag=773">
+ <xsl:for-each select="marc:subfield[@code='g']">
+ <part>
+ <text>
+ <xsl:value-of select="."/>
+ </text>
+ </part>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='q']">
+ <part>
+ <xsl:call-template name="parsePart"/>
+ </part>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="relatedPartNumName">
+ <xsl:variable name="partNumber">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">g</xsl:with-param>
+ <xsl:with-param name="anyCodes">g</xsl:with-param>
+ <xsl:with-param name="afterCodes">pst</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="partName">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">p</xsl:with-param>
+ <xsl:with-param name="anyCodes">p</xsl:with-param>
+ <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length(normalize-space($partNumber))">
+ <partNumber>
+ <xsl:value-of select="$partNumber"/>
+ </partNumber>
+ </xsl:if>
+ <xsl:if test="string-length(normalize-space($partName))">
+ <partName>
+ <xsl:value-of select="$partName"/>
+ </partName>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="relatedName">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <name>
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </name>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedForm">
+ <xsl:for-each select="marc:subfield[@code='h']">
+ <physicalDescription>
+ <form>
+ <xsl:value-of select="."/>
+ </form>
+ </physicalDescription>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedExtent">
+ <xsl:for-each select="marc:subfield[@code='h']">
+ <physicalDescription>
+ <extent>
+ <xsl:value-of select="."/>
+ </extent>
+ </physicalDescription>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedNote">
+ <xsl:for-each select="marc:subfield[@code='n']">
+ <note>
+ <xsl:value-of select="."/>
+ </note>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedSubject">
+ <xsl:for-each select="marc:subfield[@code='j']">
+ <subject>
+ <temporal encoding="iso8601">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </temporal>
+ </subject>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedIdentifierISSN">
+ <xsl:for-each select="marc:subfield[@code='x']">
+ <identifier type="issn">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedIdentifierLocal">
+ <xsl:for-each select="marc:subfield[@code='w']">
+ <identifier type="local">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedIdentifier">
+ <xsl:for-each select="marc:subfield[@code='o']">
+ <identifier>
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedItem76X-78X">
+ <xsl:call-template name="displayLabel"/>
+ <xsl:call-template name="relatedTitle76X-78X"/>
+ <xsl:call-template name="relatedName"/>
+ <xsl:call-template name="relatedOriginInfo"/>
+ <xsl:call-template name="relatedLanguage"/>
+ <xsl:call-template name="relatedExtent"/>
+ <xsl:call-template name="relatedNote"/>
+ <xsl:call-template name="relatedSubject"/>
+ <xsl:call-template name="relatedIdentifier"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ <xsl:call-template name="relatedIdentifierLocal"/>
+ <xsl:call-template name="relatedPart"/>
+ </xsl:template>
+ <xsl:template name="subjectGeographicZ">
+ <geographic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </geographic>
+ </xsl:template>
+ <xsl:template name="subjectTemporalY">
+ <temporal>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </temporal>
+ </xsl:template>
+ <xsl:template name="subjectTopic">
+ <topic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </topic>
+ </xsl:template>
+ <xsl:template name="nameABCDN">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">cdn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="nameABCDQ">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">aq</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/ </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ </xsl:template>
+ <xsl:template name="nameACDEQ">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">acdeq</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:template>
+ <xsl:template name="constituentOrRelatedType">
+ <xsl:if test="@ind2=2">
+ <xsl:attribute name="type">constituent</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="relatedTitle">
+ <xsl:for-each select="marc:subfield[@code='t']">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ </titleInfo>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedTitle76X-78X">
+ <xsl:for-each select="marc:subfield[@code='t']">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
+ <xsl:call-template name="relatedPartNumName"/>
+ </xsl:if>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='p']">
+ <titleInfo type="abbreviated">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
+ <xsl:call-template name="relatedPartNumName"/>
+ </xsl:if>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='s']">
+ <titleInfo type="uniform">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
+ <xsl:call-template name="relatedPartNumName"/>
+ </xsl:if>
+ </titleInfo>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="relatedOriginInfo">
+ <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
+ <originInfo>
+ <xsl:if test="@tag=775">
+ <xsl:for-each select="marc:subfield[@code='f']">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">code</xsl:attribute>
+ <xsl:attribute name="authority">marcgac</xsl:attribute>
+ <xsl:value-of select="."/>
+ </placeTerm>
+ </place>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="marc:subfield[@code='d']">
+ <publisher>
+ <xsl:value-of select="."/>
+ </publisher>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+ </xsl:for-each>
+ </originInfo>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="relatedLanguage">
+ <xsl:for-each select="marc:subfield[@code='e']">
+ <xsl:call-template name="getLanguage">
+ <xsl:with-param name="langString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="nameDate">
+ <xsl:for-each select="marc:subfield[@code='d']">
+ <namePart type="date">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </namePart>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="subjectAuthority">
+ <xsl:if test="@ind2!=4">
+ <xsl:if test="@ind2!=' '">
+ <xsl:if test="@ind2!=8">
+ <xsl:if test="@ind2!=9">
+ <xsl:attribute name="authority"><xsl:choose><xsl:when test="@ind2=0">lcsh</xsl:when><xsl:when test="@ind2=1">lcshac</xsl:when><xsl:when test="@ind2=2">mesh</xsl:when><!-- 1/04 fix --><xsl:when test="@ind2=3">nal</xsl:when><xsl:when test="@ind2=5">csh</xsl:when><xsl:when test="@ind2=6">rvm</xsl:when><xsl:when test="@ind2=7"><xsl:value-of select="marc:subfield[@code='2']"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="subjectAnyOrder">
+ <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
+ <xsl:choose>
+ <xsl:when test="@code='v'">
+ <xsl:call-template name="subjectTopic"/>
+ </xsl:when>
+ <xsl:when test="@code='x'">
+ <xsl:call-template name="subjectTopic"/>
+ </xsl:when>
+ <xsl:when test="@code='y'">
+ <xsl:call-template name="subjectTemporalY"/>
+ </xsl:when>
+ <xsl:when test="@code='z'">
+ <xsl:call-template name="subjectGeographicZ"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="specialSubfieldSelect">
+ <xsl:param name="anyCodes"/>
+ <xsl:param name="axis"/>
+ <xsl:param name="beforeCodes"/>
+ <xsl:param name="afterCodes"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($anyCodes, @code) or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis]) or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=600]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <name type="personal">
+ <xsl:call-template name="termsOfAddress"/>
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">aq</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="nameDate"/>
+ <xsl:call-template name="affiliation"/>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=610]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <name type="corporate">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">cdnp</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:if>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=611]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <name type="conference">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdeqnp</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:for-each select="marc:subfield[@code='4']">
+ <role>
+ <roleTerm authority="marcrelator" type="code">
+ <xsl:value-of select="."/>
+ </roleTerm>
+ </role>
+ </xsl:for-each>
+ </name>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=630]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adfhklor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="part"/>
+ </title>
+ </titleInfo>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=650]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <topic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcd</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </topic>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=651]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <geographic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </geographic>
+ </xsl:for-each>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=653]">
+ <subject>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <topic>
+ <xsl:value-of select="."/>
+ </topic>
+ </xsl:for-each>
+ </subject>
+ </xsl:template>
+ <xsl:template match="marc:datafield[@tag=656]">
+ <subject>
+ <xsl:if test="marc:subfield[@code=2]">
+ <xsl:attribute name="authority"><xsl:value-of select="marc:subfield[@code=2]"/></xsl:attribute>
+ </xsl:if>
+ <occupation>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </occupation>
+ </subject>
+ </xsl:template>
+ <xsl:template name="termsOfAddress">
+ <xsl:if test="marc:subfield[@code='b' or @code='c']">
+ <namePart type="termsOfAddress">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">bc</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="displayLabel">
+ <xsl:if test="marc:subfield[@code='i']">
+ <xsl:attribute name="displayLabel"><xsl:value-of select="marc:subfield[@code='i']"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="marc:subfield[@code='3']">
+ <xsl:attribute name="displayLabel"><xsl:value-of select="marc:subfield[@code='3']"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="isInvalid">
+ <xsl:if test="marc:subfield[@code='z']">
+ <xsl:attribute name="invalid">yes</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="subtitle">
+ <xsl:if test="marc:subfield[@code='b']">
+ <subTitle>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='b']"/>
+ <!--<xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">b</xsl:with-param>
+ </xsl:call-template>-->
+ </xsl:with-param>
+ </xsl:call-template>
+ </subTitle>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="script">
+ <xsl:param name="scriptCode"/>
+ <xsl:attribute name="script"><xsl:choose><xsl:when test="$scriptCode='(3'">Arabic</xsl:when><xsl:when test="$scriptCode='(B'">Latin</xsl:when><xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when><xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when><xsl:when test="$scriptCode='(2'">Hebrew</xsl:when><xsl:when test="$scriptCode='(S'">Greek</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="parsePart">
+ <!-- assumes 773$q= 1:2:3<4
+ with up to 3 levels and one optional start page
+ -->
+ <xsl:variable name="level1">
+ <xsl:choose>
+ <xsl:when test="contains(text(),':')">
+ <!-- 1:2 -->
+ <xsl:value-of select="substring-before(text(),':')"/>
+ </xsl:when>
+ <xsl:when test="not(contains(text(),':'))">
+ <!-- 1 or 1<3 -->
+ <xsl:if test="contains(text(),'&lt;')">
+ <!-- 1<3 -->
+ <xsl:value-of select="substring-before(text(),'&lt;')"/>
+ </xsl:if>
+ <xsl:if test="not(contains(text(),'&lt;'))">
+ <!-- 1 -->
+ <xsl:value-of select="text()"/>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sici2">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after(text(),$level1),':')">
+ <xsl:value-of select="substring(substring-after(text(),$level1),2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after(text(),$level1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="level2">
+ <xsl:choose>
+ <xsl:when test="contains($sici2,':')">
+ <!-- 2:3<4 -->
+ <xsl:value-of select="substring-before($sici2,':')"/>
+ </xsl:when>
+ <xsl:when test="contains($sici2,'&lt;')">
+ <!-- 1: 2<4 -->
+ <xsl:value-of select="substring-before($sici2,'&lt;')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$sici2"/>
+ <!-- 1:2 -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sici3">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after($sici2,$level2),':')">
+ <xsl:value-of select="substring(substring-after($sici2,$level2),2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($sici2,$level2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="level3">
+ <xsl:choose>
+ <xsl:when test="contains($sici3,'&lt;')">
+ <!-- 2<4 -->
+ <xsl:value-of select="substring-before($sici3,'&lt;')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$sici3"/>
+ <!-- 3 -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="page">
+ <xsl:if test="contains(text(),'&lt;')">
+ <xsl:value-of select="substring-after(text(),'&lt;')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="$level1">
+ <detail level="1">
+ <number>
+ <xsl:value-of select="$level1"/>
+ </number>
+ </detail>
+ </xsl:if>
+ <xsl:if test="$level2">
+ <detail level="2">
+ <number>
+ <xsl:value-of select="$level2"/>
+ </number>
+ </detail>
+ </xsl:if>
+ <xsl:if test="$level3">
+ <detail level="3">
+ <number>
+ <xsl:value-of select="$level3"/>
+ </number>
+ </detail>
+ </xsl:if>
+ <xsl:if test="$page">
+ <extent unit="page">
+ <start>
+ <xsl:value-of select="$page"/>
+ </start>
+ </extent>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="getLanguage">
+ <xsl:param name="langString"/>
+ <xsl:param name="controlField008-35-37"/>
+ <xsl:variable name="length" select="string-length($langString)"/>
+ <xsl:choose>
+ <xsl:when test="$length=0"/>
+ <xsl:when test="$controlField008-35-37=substring($langString,1,3)">
+ <xsl:call-template name="getLanguage">
+ <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
+ <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="substring($langString,1,3)"/>
+ </languageTerm>
+ </language>
+ <xsl:call-template name="getLanguage">
+ <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
+ <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="isoLanguage">
+ <xsl:param name="currentLanguage"/>
+ <xsl:param name="usedLanguages"/>
+ <xsl:param name="remainingLanguages"/>
+ <xsl:choose>
+ <xsl:when test="string-length($currentLanguage)=0"/>
+ <xsl:when test="not(contains($usedLanguages, $currentLanguage))">
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:if test="@code!='a'">
+ <xsl:attribute name="objectPart"><xsl:choose><xsl:when test="@code='b'">summary or subtitle</xsl:when><xsl:when test="@code='d'">sung or spoken text</xsl:when><xsl:when test="@code='e'">libretto</xsl:when><xsl:when test="@code='f'">table of contents</xsl:when><xsl:when test="@code='g'">accompanying material</xsl:when><xsl:when test="@code='h'">translation</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$currentLanguage"/>
+ </languageTerm>
+ </language>
+ <xsl:call-template name="isoLanguage">
+ <xsl:with-param name="currentLanguage">
+ <xsl:value-of select="substring($remainingLanguages,1,3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
+ </xsl:with-param>
+ <xsl:with-param name="remainingLanguages">
+ <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="isoLanguage">
+ <xsl:with-param name="currentLanguage">
+ <xsl:value-of select="substring($remainingLanguages,1,3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
+ </xsl:with-param>
+ <xsl:with-param name="remainingLanguages">
+ <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="chopBrackets">
+ <xsl:param name="chopString"/>
+ <xsl:variable name="string">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$chopString"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="substring($string, 1,1)='['">
+ <xsl:value-of select="substring($string,2, string-length($string)-2)"/>
+ </xsl:if>
+ <xsl:if test="substring($string, 1,1)!='['">
+ <xsl:value-of select="$string"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="rfcLanguages">
+ <xsl:param name="nodeNum"/>
+ <xsl:param name="usedLanguages"/>
+ <xsl:param name="controlField008-35-37"/>
+ <xsl:variable name="currentLanguage" select="."/>
+ <xsl:choose>
+ <xsl:when test="not($currentLanguage)"/>
+ <xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
+ <xsl:if test="not(contains($usedLanguages,$currentLanguage))">
+ <language>
+ <languageTerm authority="rfc3066" type="code">
+ <xsl:if test="@code!='a'">
+ <xsl:attribute name="objectPart"><xsl:choose><xsl:when test="@code='b'">summary or subtitle</xsl:when><xsl:when test="@code='d'">sung or spoken text</xsl:when><xsl:when test="@code='e'">libretto</xsl:when><xsl:when test="@code='f'">table of contents</xsl:when><xsl:when test="@code='g'">accompanying material</xsl:when><xsl:when test="@code='h'">translation</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$currentLanguage"/>
+ </languageTerm>
+ </language>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
+<!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
+<metaInformation>
+<scenarios ><scenario default="no" name="Apr 02 Test" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\test_files\v3.xml" htmlbaseurl="" outputurl="file://n:\temp\x.xml" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="v3Test1" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\test_files\v3.xml" htmlbaseurl="" outputurl="file://n:\jackie\test_files\modsv3Converted.xml" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="Scenario1" userelativepaths="yes" externalpreview="no" url="file://n:\ckeith\DESKTOP\test.xml" htmlbaseurl="" outputurl="" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="Test" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\MARCXML\marcxmlfile.xml" htmlbaseurl="" outputurl="" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
+</metaInformation>
+-->
diff --git a/xslt/MARC21slimUtils.xsl b/xslt/MARC21slimUtils.xsl
new file mode 100644
index 0000000..b1104ce
--- /dev/null
+++ b/xslt/MARC21slimUtils.xsl
@@ -0,0 +1,82 @@
+<?xml version='1.0'?>
+<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- This file is in the public domain. -->
+
+<!-- 8/19/04: ntra added "marc:" prefix to datafield element -->
+ <xsl:template name="datafield">
+ <xsl:param name="tag"/>
+ <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
+ <xsl:param name="subfields"/>
+ <xsl:element name="marc:datafield">
+ <xsl:attribute name="tag">
+ <xsl:value-of select="$tag"/>
+ </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:copy-of select="$subfields"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="subfieldSelect">
+ <xsl:param name="codes"/>
+ <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($codes, @code)">
+ <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
+ </xsl:template>
+
+ <xsl:template name="buildSpaces">
+ <xsl:param name="spaces"/>
+ <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
+ <xsl:if test="$spaces>0">
+ <xsl:value-of select="$char"/>
+ <xsl:call-template name="buildSpaces">
+ <xsl:with-param name="spaces" select="$spaces - 1"/>
+ <xsl:with-param name="char" select="$char"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="chopPunctuation">
+ <xsl:param name="chopString"/>
+ <xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param>
+ <xsl:variable name="length" select="string-length($chopString)"/>
+ <xsl:choose>
+ <xsl:when test="$length=0"/>
+ <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
+ <xsl:with-param name="punctuation" select="$punctuation"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not($chopString)"/>
+ <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="chopPunctuationFront">
+ <xsl:param name="chopString"/>
+ <xsl:variable name="length" select="string-length($chopString)"/>
+ <xsl:choose>
+ <xsl:when test="$length=0"/>
+ <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
+ <xsl:call-template name="chopPunctuationFront">
+ <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not($chopString)"/>
+ <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/xslt/Makefile.am b/xslt/Makefile.am
new file mode 100644
index 0000000..d0fb0c4
--- /dev/null
+++ b/xslt/Makefile.am
@@ -0,0 +1,29 @@
+EXTRA_DIST = tellico-by-author.xsl tellico-by-title.xsl \
+ tellico-printing.xsl tellico2html.xsl shadowAlpha.png \
+ cd-logo.png dvd-logo.png cassette-logo.png record-logo.png \
+ vhs-logo.png tellico-common.xsl mods2tellico.xsl \
+ amazon2tellico.xsl MARC21slim2MODS3.xsl MARC21slimUtils.xsl \
+ pubmed2tellico.xsl tellico2onix.xsl UNIMARC2MODS3.xsl \
+ tellico2html.js yahoo2tellico.xsl isbndb2tellico.xsl \
+ bluray-logo.png hddvd-logo.png gcstar2tellico.xsl \
+ xmp2tellico.xsl crossref2tellico.xsl arxiv2tellico.xsl \
+ referencer2tellico.xsl delicious2tellico.xsl welcome.html \
+ unixref2tellico.xsl discogs2tellico.xsl tellico2gcstar.xsl
+
+xsldir = $(kde_datadir)/tellico
+xsl_DATA = tellico-printing.xsl tellico-by-author.xsl tellico-by-title.xsl \
+ tellico2html.xsl shadowAlpha.png cassette-logo.png cd-logo.png \
+ dvd-logo.png record-logo.png vhs-logo.png tellico-common.xsl \
+ mods2tellico.xsl amazon2tellico.xsl MARC21slim2MODS3.xsl \
+ MARC21slimUtils.xsl pubmed2tellico.xsl tellico2onix.xsl \
+ UNIMARC2MODS3.xsl tellico2html.js yahoo2tellico.xsl \
+ isbndb2tellico.xsl bluray-logo.png hddvd-logo.png gcstar2tellico.xsl \
+ xmp2tellico.xsl crossref2tellico.xsl arxiv2tellico.xsl \
+ referencer2tellico.xsl delicious2tellico.xsl welcome.html \
+ unixref2tellico.xsl discogs2tellico.xsl tellico2gcstar.xsl
+
+SUBDIRS = entry-templates report-templates
+
+KDE_OPTIONS = noautodist
+
+CLEANFILES = *~
diff --git a/xslt/UNIMARC2MODS3.xsl b/xslt/UNIMARC2MODS3.xsl
new file mode 100644
index 0000000..30035f5
--- /dev/null
+++ b/xslt/UNIMARC2MODS3.xsl
@@ -0,0 +1,2920 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xlink marc">
+ <xsl:include href="MARC21slimUtils.xsl"/>
+ <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+
+<!-- This file is in the public domain. -->
+
+<!--
+
+Revised version of MARC21slim2MODS3.xsl from Library of Congress
+with input from Yves Pratter's version of UNIMARC2MODS.xsl
+
+-->
+ <xsl:template match="/">
+ <modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-1.xsd">
+ <xsl:for-each select=".//marc:record">
+ <mods version="3.1">
+ <xsl:call-template name="marcRecord"/>
+ </mods>
+ </xsl:for-each>
+ </modsCollection>
+ </xsl:template>
+
+ <xsl:template name="marcRecord">
+ <xsl:variable name="leader" select="marc:leader"/>
+ <xsl:variable name="leader6" select="substring($leader,7,1)"/>
+ <xsl:variable name="leader7" select="substring($leader,8,1)"/>
+ <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
+ <xsl:variable name="typeOf008">
+ <xsl:choose>
+ <xsl:when test="$leader6='a'">
+ <xsl:choose>
+ <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
+ <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$leader6='t'">BK</xsl:when>
+ <xsl:when test="$leader6='p'">MM</xsl:when>
+ <xsl:when test="$leader6='m'">CF</xsl:when>
+ <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
+ <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
+ <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- MARC21 tag 245 - TITLE STATEMENT -->
+ <xsl:for-each select="marc:datafield[@tag=200]">
+ <titleInfo>
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='e']">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">e</xsl:with-param>
+ <xsl:with-param name="beforeCodes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ae</xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="titleChop">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="$title"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@ind2&gt;0">
+ <nonSort>
+ <xsl:value-of select="substring($titleChop,1,@ind2)"/>
+ </nonSort>
+ <title>
+ <xsl:value-of select="substring($titleChop,@ind2+1)"/>
+ </title>
+ </xsl:when>
+ <xsl:when test="contains($title,'ˆ') and contains($title,'‰')">
+ <nonSort>
+ <xsl:value-of select="substring(substring-before($title,'‰'),2)"/>
+ </nonSort>
+ <title>
+ <xsl:value-of select="substring-after($title,'‰')"/>
+ </title>
+ </xsl:when>
+ <xsl:otherwise>
+ <title>
+ <xsl:value-of select="$titleChop"/>
+ </title>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="marc:subfield[@code='e']">
+ <subTitle>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">e</xsl:with-param>
+ <xsl:with-param name="anyCodes">e</xsl:with-param>
+ <xsl:with-param name="afterCodes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </subTitle>
+ </xsl:if>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+
+ <!-- MARC21 - ABBREVIATED TITLE / tag 210 ab -->
+ <xsl:for-each select="marc:datafield[@tag=531]">
+ <titleInfo type="abbreviated">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="subtitle"/>
+ </titleInfo>
+ </xsl:for-each>
+
+ <!-- MARC21 - translated title / 242 -->
+ <xsl:for-each select="marc:datafield[@tag=541]">
+ <titleInfo type="translated">
+ <!-- 541/z is 242/y -->
+ <xsl:for-each select="marc:subfield[@code='z']">
+ <xsl:attribute name="lang">
+ <xsl:value-of select="text()"/>
+ </xsl:attribute>
+ </xsl:for-each>
+ <title>
+
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ </title>
+
+
+ <!-- 1/04 fix -->
+ <xsl:call-template name="subtitle"/>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+
+ <!-- MARC21 - Expanded title / 246 -->
+ <xsl:for-each select="marc:datafield[@tag=532]|marc:datafield[@tag=540]">
+ <titleInfo type="alternative">
+ <xsl:for-each select="marc:subfield[@code='i']">
+ <xsl:attribute name="displayLabel">
+ <xsl:value-of select="text()"/>
+ </xsl:attribute>
+ </xsl:for-each>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <!-- 1/04 removed $h, $b -->
+ <xsl:with-param name="codes">af</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="subtitle"/>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+
+ <!-- MARC21 - Expanded title / 130, 240, 730i2 -->
+ <xsl:for-each select="marc:datafield[@tag=500]">
+ <titleInfo type="uniform">
+ <title>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="(contains('anklmrtuv',@code) and (not(../marc:subfield[@code='h' or @code='s' or @code='i']) or (following-sibling::marc:subfield[@code='h' or @code='s' or @code='i'])))">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+
+ <!--
+ <xsl:for-each select="marc:datafield[@tag=740][@ind2!=2]">
+ <titleInfo type="alternative">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ah</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 - creator / 100 -->
+ <xsl:for-each select="marc:datafield[@tag=700]">
+ <name type="personal">
+ <xsl:call-template name="nameABCDFG"/>
+ <xsl:call-template name="affiliation"/>
+ <role>
+ <roleTerm authority="marcrelator" type="text">creator</roleTerm>
+ </role>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+
+ <!-- MARC21 - creator / 110 and 111 -->
+ <xsl:for-each select="marc:datafield[@tag=710]">
+ <name>
+ <xsl:if test="@ind1=0">
+ <xsl:attribute name="type">
+ <xsl:text>corporate</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ind1=1">
+ <xsl:attribute name="type">
+ <xsl:text>conference</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="nameABCDEF"/>
+ <role>
+ <roleTerm authority="marcrelator" type="text">creator</roleTerm>
+ </role>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+
+ <!-- MARC21 - creator / 700 -->
+ <xsl:for-each select="marc:datafield[@tag=701 or @tag=702]">
+ <name type="personal">
+ <xsl:call-template name="nameABCDFG"/>
+ <xsl:call-template name="affiliation"/>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+
+ <!-- MARC21 - creator / 710 and 711 -->
+ <xsl:for-each select="marc:datafield[@tag=711 or @tag=712]">
+ <name>
+ <xsl:if test="@ind1=0">
+ <xsl:attribute name="type">
+ <xsl:text>corporate</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ind1=1">
+ <xsl:attribute name="type">
+ <xsl:text>conference</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="nameABCDEF"/>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=720][not(marc:subfield[@code='t'])]">
+ <name>
+ <xsl:if test="@ind1=1">
+ <xsl:attribute name="type">
+ <xsl:text>personal</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <namePart>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </namePart>
+ <xsl:call-template name="role"/>
+ </name>
+ </xsl:for-each>
+-->
+
+ <typeOfResource>
+ <xsl:if test="$leader7='c'">
+ <xsl:attribute name="collection">yes</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
+ <xsl:attribute name="manuscript">yes</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$leader6='a' or $leader6='b' or $leader6='h' or $leader6='t'">text</xsl:when>
+ <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
+ <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
+ <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
+ <xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
+ <xsl:when test="$leader6='k'">still image</xsl:when>
+ <xsl:when test="$leader6='g'">moving image</xsl:when>
+ <xsl:when test="$leader6='n'">three dimensional object</xsl:when>
+ <xsl:when test="$leader6='l'">software, multimedia</xsl:when>
+ <xsl:when test="$leader6='p'">mixed material</xsl:when>
+ </xsl:choose>
+ </typeOfResource>
+
+ <!-- MARC21 controlField008 -->
+ <xsl:if test="substring(marc:field[@tag=124],26,1)='d'">
+ <genre authority="marc">globe</genre>
+ </xsl:if>
+
+ <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
+ <genre authority="marc">remote sensing image</genre>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='MP'">
+ <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-25='a' or $controlField008-25='b' or $controlField008-25='c' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
+ <genre authority="marc">map</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
+ <genre authority="marc">atlas</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='SE'">
+ <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-21='d'">
+ <genre authority="marc">database</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='l'">
+ <genre authority="marc">loose-leaf</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='m'">
+ <genre authority="marc">series</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='n'">
+ <genre authority="marc">newspaper</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='p'">
+ <genre authority="marc">periodical</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-21='w'">
+ <genre authority="marc">web site</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
+ <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
+ <xsl:choose>
+ <xsl:when test="contains($controlField008-24,'a')">
+ <genre authority="marc">abstract or summary</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'b')">
+ <genre authority="marc">bibliography</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'c')">
+ <genre authority="marc">catalog</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'d')">
+ <genre authority="marc">dictionary</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'e')">
+ <genre authority="marc">encyclopedia</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'f')">
+ <genre authority="marc">handbook</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'g')">
+ <genre authority="marc">legal article</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'i')">
+ <genre authority="marc">index</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'k')">
+ <genre authority="marc">discography</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'l')">
+ <genre authority="marc">legislation</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'m')">
+ <genre authority="marc">theses</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'n')">
+ <genre authority="marc">survey of literature</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'o')">
+ <genre authority="marc">review</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'p')">
+ <genre authority="marc">programmed text</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'q')">
+ <genre authority="marc">filmography</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'r')">
+ <genre authority="marc">directory</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'s')">
+ <genre authority="marc">statistics</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'t')">
+ <genre authority="marc">technical report</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'v')">
+ <genre authority="marc">legal case and case notes</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'w')">
+ <genre authority="marc">law report or digest</genre>
+ </xsl:when>
+ <xsl:when test="contains($controlField008-24,'z')">
+ <genre authority="marc">treaty</genre>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-29='1'">
+ <genre authority="marc">conference publication</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='CF'">
+ <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-26='a'">
+ <genre authority="marc">numeric data</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-26='e'">
+ <genre authority="marc">database</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-26='f'">
+ <genre authority="marc">font</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-26='g'">
+ <genre authority="marc">game</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='BK'">
+ <xsl:if test="substring($controlField008,25,1)='j'">
+ <genre authority="marc">patent</genre>
+ </xsl:if>
+ <xsl:if test="substring($controlField008,31,1)='1'">
+ <genre authority="marc">festschrift</genre>
+ </xsl:if>
+
+ <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
+ <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
+ <genre authority="marc">biography</genre>
+ </xsl:if>
+
+ <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-33='e'">
+ <genre authority="marc">essay</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='d'">
+ <genre authority="marc">drama</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='c'">
+ <genre authority="marc">comic strip</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='l'">
+ <genre authority="marc">fiction</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='h'">
+ <genre authority="marc">humor, satire</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='i'">
+ <genre authority="marc">letter</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='f'">
+ <genre authority="marc">novel</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='j'">
+ <genre authority="marc">short story</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='s'">
+ <genre authority="marc">speech</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='MU'">
+ <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
+ <xsl:if test="contains($controlField008-30-31,'b')">
+ <genre authority="marc">biography</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'c')">
+ <genre authority="marc">conference publication</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'d')">
+ <genre authority="marc">drama</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'e')">
+ <genre authority="marc">essay</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'f')">
+ <genre authority="marc">fiction</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'o')">
+ <genre authority="marc">folktale</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'h')">
+ <genre authority="marc">history</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'k')">
+ <genre authority="marc">humor, satire</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'m')">
+ <genre authority="marc">memoir</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'p')">
+ <genre authority="marc">poetry</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'r')">
+ <genre authority="marc">rehearsal</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'g')">
+ <genre authority="marc">reporting</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'s')">
+ <genre authority="marc">sound</genre>
+ </xsl:if>
+ <xsl:if test="contains($controlField008-30-31,'l')">
+ <genre authority="marc">speech</genre>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$typeOf008='VM'">
+ <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
+ <xsl:choose>
+ <xsl:when test="$controlField008-33='a'">
+ <genre authority="marc">art original</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='b'">
+ <genre authority="marc">kit</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='c'">
+ <genre authority="marc">art reproduction</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='d'">
+ <genre authority="marc">diorama</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='f'">
+ <genre authority="marc">filmstrip</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='g'">
+ <genre authority="marc">legal article</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='i'">
+ <genre authority="marc">picture</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='k'">
+ <genre authority="marc">graphic</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='l'">
+ <genre authority="marc">technical drawing</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='m'">
+ <genre authority="marc">motion picture</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='n'">
+ <genre authority="marc">chart</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='o'">
+ <genre authority="marc">flash card</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='p'">
+ <genre authority="marc">microscope slide</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
+ <genre authority="marc">model</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='r'">
+ <genre authority="marc">realia</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='s'">
+ <genre authority="marc">slide</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='t'">
+ <genre authority="marc">transparency</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='v'">
+ <genre authority="marc">videorecording</genre>
+ </xsl:when>
+ <xsl:when test="$controlField008-33='w'">
+ <genre authority="marc">toy</genre>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:for-each select="marc:datafield[@tag=655]">
+ <genre authority="marc">
+ <xsl:attribute name="authority">
+ <xsl:value-of select="marc:subfield[@code='2']"/>
+ </xsl:attribute>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abvxyz</xsl:with-param>
+ <xsl:with-param name="delimeter">-</xsl:with-param>
+ </xsl:call-template>
+ </genre>
+ </xsl:for-each>
+
+ <originInfo>
+ <xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"/>
+
+ <xsl:if test="translate($MARCpublicationCode,'|','')">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">code</xsl:attribute>
+ <xsl:attribute name="authority">marccountry</xsl:attribute>
+ <xsl:value-of select="$MARCpublicationCode"/>
+ </placeTerm>
+ </place>
+ </xsl:if>
+
+ <!-- MARC21 44a -->
+ <xsl:for-each select="marc:datafield[@tag=102]/marc:subfield[@code='a']">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">code</xsl:attribute>
+ <xsl:attribute name="authority">iso3166</xsl:attribute>
+ <xsl:value-of select="."/>
+ </placeTerm>
+ </place>
+ </xsl:for-each>
+
+ <!-- MARC21 260a -->
+ <xsl:for-each select="marc:datafield[@tag=210]/marc:subfield[@code='a']">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">text</xsl:attribute>
+ <xsl:call-template name="chopPunctuationFront">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ <xsl:with-param name="chopString" select="../marc:subfield[@code='a']"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </placeTerm>
+ </place>
+ </xsl:for-each>
+
+ <!-- Unknown -->
+ <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
+ <dateValid point="start">
+ <xsl:value-of select="."/>
+ </dateValid>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
+ <dateValid point="end">
+ <xsl:value-of select="."/>
+ </dateValid>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
+ <dateModified>
+ <xsl:value-of select="."/>
+ </dateModified>
+ </xsl:for-each>
+
+ <!-- MARC21 260bcg -->
+ <xsl:for-each select="marc:datafield[@tag=210]/marc:subfield[@code='c' or @code='d' or @code='h']">
+ <xsl:choose>
+ <xsl:when test="@code='c'">
+ <publisher>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/ </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </publisher>
+ </xsl:when>
+ <xsl:when test="@code='d'">
+ <dateIssued>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="chopPunctuationFront">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation"> <!-- add closing bracket -->
+ <xsl:text>:,;/] </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </dateIssued>
+ </xsl:when>
+ <xsl:when test="@code='h'">
+ <dateCreated>
+ <xsl:value-of select="."/>
+ </dateCreated>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+
+ <!-- Unknown
+ <xsl:variable name="dataField260d">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='d']"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"/>
+ <xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"/>
+ <xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"/>
+
+ <xsl:if test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
+ <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260d)">
+ <dateIssued encoding="marc">
+ <xsl:value-of select="$controlField008-7-10"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
+ <xsl:if test="$controlField008-7-10">
+ <dateIssued encoding="marc" point="start">
+ <xsl:value-of select="$controlField008-7-10"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">
+ <xsl:if test="$controlField008-11-14">
+ <dateIssued encoding="marc" point="end">
+ <xsl:value-of select="$controlField008-11-14"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$controlField008-6='q'">
+ <xsl:if test="$controlField008-7-10">
+ <dateIssued encoding="marc" point="start" qualifier="questionable">
+ <xsl:value-of select="$controlField008-7-10"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$controlField008-6='q'">
+ <xsl:if test="$controlField008-11-14">
+ <dateIssued encoding="marc" point="end" qualifier="questionable">
+ <xsl:value-of select="$controlField008-11-14"/>
+ </dateIssued>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="$controlField008-6='t'">
+ <xsl:if test="$controlField008-11-14">
+ <copyrightDate encoding="marc">
+ <xsl:value-of select="$controlField008-11-14"/>
+ </copyrightDate>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
+ <dateCaptured encoding="iso8601">
+ <xsl:value-of select="."/>
+ </dateCaptured>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
+ <dateCaptured encoding="iso8601" point="start">
+ <xsl:value-of select="."/>
+ </dateCaptured>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
+ <dateCaptured encoding="iso8601" point="end">
+ <xsl:value-of select="."/>
+ </dateCaptured>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 250a -->
+ <xsl:for-each select="marc:datafield[@tag=205]/marc:subfield[@code='a']">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:leader">
+ <issuance>
+ <xsl:choose>
+ <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when>
+ <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">continuing</xsl:when>
+ </xsl:choose>
+ </issuance>
+ </xsl:for-each>
+
+ <!-- MARC21 310 and 321 -->
+ <xsl:for-each select="marc:datafield[@tag=326]">
+ <frequency>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </frequency>
+ </xsl:for-each>
+ </originInfo>
+
+ <xsl:for-each select="marc:datafield[@tag=101]">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="text()"/>
+ </languageTerm>
+ </language>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>
+ <xsl:if test="$controlField008-35-37">
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="substring($controlField008,36,3)"/>
+ </languageTerm>
+ </language>
+ </xsl:if>
+
+ <xsl:for-each select="marc:datafield[@tag=041]">
+
+ <!-- <xsl:variable name="langCodes">
+ <xsl:copy-of select="marc:subfield[@code='a'or @code='d' or @code='e' or @code='2']"/>
+ </xsl:variable>
+ -->
+ <xsl:variable name="langCodes" select="marc:subfield[@code='a'or @code='d' or @code='e' or @code='2']"/>
+
+ <xsl:choose>
+ <xsl:when test="marc:subfield[@code='2']='rfc3066'">
+ <!-- not stacked but could be repeated -->
+ <xsl:call-template name="rfcLanguages">
+ <xsl:with-param name="nodeNum">
+ <xsl:value-of select="1"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:text></xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="controlField008-35-37">
+ <xsl:value-of select="$controlField008-35-37"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- iso -->
+ <xsl:variable name="allLanguages">
+ <xsl:copy-of select="$langCodes"/>
+ </xsl:variable>
+ <xsl:variable name="currentLanguage">
+ <xsl:value-of select="substring($allLanguages,1,3)"/>
+ </xsl:variable>
+ <xsl:call-template name="isoLanguage">
+ <xsl:with-param name="currentLanguage">
+ <xsl:value-of select="substring($allLanguages,1,3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="remainingLanguages">
+ <xsl:value-of select="substring($allLanguages,4,string-length($allLanguages)-3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:if test="$controlField008-35-37">
+ <xsl:value-of select="$controlField008-35-37"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+
+ <xsl:variable name="physicalDescription">
+ <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a' or substring(.,12,1)='b']">
+ <digitalOrigin>reformatted digital</digitalOrigin>
+ </xsl:if>
+
+ <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
+ <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
+
+ <xsl:variable name="check008-23">
+ <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
+ <xsl:value-of select="true()"/>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:variable name="check008-29">
+ <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
+ <xsl:value-of select="true()"/>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
+ <form authority="marcform">braille</form>
+ </xsl:when>
+ <xsl:when test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
+ <form authority="marcform">print</form>
+ </xsl:when>
+ <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
+ <form authority="marcform">electronic</form>
+ </xsl:when>
+ <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
+ <form authority="marcform">microfiche</form>
+ </xsl:when>
+ <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
+ <form authority="marcform">microfilm</form>
+ </xsl:when>
+ </xsl:choose>
+<!--
+ <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+
+ <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
+ <form authority="gmd">
+ <xsl:call-template name="chopBrackets">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </form>
+ </xsl:if>
+ <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
+ <form>
+ <xsl:value-of select="."/>
+ </form>
+ </xsl:for-each>
+-->
+ <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
+ <xsl:choose>
+ <xsl:when test="substring(text(),14,1)='a'">
+ <reformattingQuality>access</reformattingQuality>
+ </xsl:when>
+ <xsl:when test="substring(text(),14,1)='p'">
+ <reformattingQuality>preservation</reformattingQuality>
+ </xsl:when>
+ <xsl:when test="substring(text(),14,1)='r'">
+ <reformattingQuality>replacement</reformattingQuality>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)&gt;1]">
+ <internetMediaType>
+ <xsl:value-of select="."/>
+ </internetMediaType>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 300 - PHYSICAL DESCRIPTION (R) subfields abce-->
+ <xsl:for-each select="marc:datafield[@tag=215]">
+ <extent>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">acde</xsl:with-param>
+ </xsl:call-template>
+ </extent>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:if test="string-length(normalize-space($physicalDescription))">
+ <physicalDescription>
+ <xsl:copy-of select="$physicalDescription"/>
+ </physicalDescription>
+ </xsl:if>
+
+ <!-- MARC21 tag 520 -->
+ <xsl:for-each select="marc:datafield[@tag=330]">
+ <abstract>
+ <xsl:call-template name="uri"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </abstract>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 505 -->
+ <xsl:for-each select="marc:datafield[@tag=327]">
+ <tableOfContents>
+ <xsl:call-template name="uri"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">agrt</xsl:with-param>
+ </xsl:call-template>
+ </tableOfContents>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 521 -->
+ <xsl:for-each select="marc:datafield[@tag=333]">
+ <targetAudience>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </targetAudience>
+ </xsl:for-each>
+
+ <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
+ <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
+ <xsl:choose>
+ <!-- 01/04 fix -->
+ <xsl:when test="$controlField008-22='d'">
+ <targetAudience authority="marctarget">adolescent</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='e'">
+ <targetAudience authority="marctarget">adult</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='g'">
+ <targetAudience authority="marctarget">general</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
+ <targetAudience authority="marctarget">juvenile</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='a'">
+ <targetAudience authority="marctarget">preschool</targetAudience>
+ </xsl:when>
+ <xsl:when test="$controlField008-22='f'">
+ <targetAudience authority="marctarget">specialized</targetAudience>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <!-- MARC21 tag 245c -->
+ <xsl:for-each select="marc:datafield[@tag=200]/marc:subfield[@code='f' or @code='g']">
+ <note type="statement of responsibility">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="punctuation">
+ <xsl:text>.:,;/] </xsl:text> <!-- have to add the closing bracket -->
+ </xsl:with-param>
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="chopPunctuationFront">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </note>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 500 -->
+ <xsl:for-each select="marc:datafield[@tag &gt; 299 and @tag &lt; 316]">
+ <note>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ <xsl:call-template name="uri"/>
+ </note>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 511 -->
+ <xsl:for-each select="marc:datafield[@tag=323]">
+ <note type="performers">
+ <xsl:call-template name="uri"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </note>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=518]">
+ <note type="venue">
+ <xsl:call-template name="uri"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </note>
+ </xsl:for-each>
+
+
+ <xsl:for-each select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=506 or @tag=507 or @tag=508 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=530 or @tag=533 or @tag=534 or @tag=535 or @tag=536 or @tag=538 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=583 or @tag=584 or @tag=585 or @tag=586]">
+ <note>
+ <xsl:call-template name="uri"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
+ <xsl:value-of select="."/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </note>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 tag 034 -->
+ <xsl:for-each select="marc:datafield[@tag=123][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
+ <subject>
+ <cartographics>
+ <coordinates>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">defg</xsl:with-param>
+ </xsl:call-template>
+ </coordinates>
+ </cartographics>
+ </subject>
+ </xsl:for-each>
+
+ <!-- Unknown -->
+ <xsl:for-each select="marc:datafield[@tag=043]">
+ <subject>
+ <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
+ <geographicCode>
+ <xsl:attribute name="authority">
+ <xsl:if test="@code='a'">
+ <xsl:text>marcgac</xsl:text>
+ </xsl:if>
+ <xsl:if test="@code='b'">
+ <xsl:value-of select="following-sibling::marc:subfield[@code=2]"/>
+ </xsl:if>
+ <xsl:if test="@code='c'">
+ <xsl:text>iso3166</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:value-of select="self::marc:subfield"/>
+ </geographicCode>
+ </xsl:for-each>
+ </subject>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 255 -->
+ <!-- needs parsing -->
+<!--
+ <xsl:for-each select="marc:datafield[@tag=206]">
+ <subject>
+ <cartographics>
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <coordinates>
+ <xsl:value-of select="."/>
+ </coordinates>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <scale>
+ <xsl:value-of select="."/>
+ </scale>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <projection>
+ <xsl:value-of select="."/>
+ </projection>
+ </xsl:for-each>
+ </cartographics>
+ </subject>
+ </xsl:for-each>
+-->
+
+ <xsl:apply-templates select="marc:datafield[653 &gt;= @tag and @tag &gt;= 600]"/>
+
+ <xsl:apply-templates select="marc:datafield[@tag=656]"/>
+
+ <!-- MARC21 tag 752 -->
+ <xsl:for-each select="marc:datafield[@tag=620]">
+ <subject>
+ <hierarchicalGeographic>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <country>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </country>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <state>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </state>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <county>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </county>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='d']">
+ <city>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </city>
+ </xsl:for-each>
+ </hierarchicalGeographic>
+ </subject>
+ </xsl:for-each>
+
+ <!-- MARC21 tag 045 -->
+ <xsl:for-each select="marc:datafield[@tag=122][marc:subfield[@code='a']]">
+ <subject>
+
+ <xsl:choose>
+
+ <xsl:when test="@ind1=2">
+
+ <temporal encoding="iso8601" point="start">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='a'][1]"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </temporal>
+ <temporal encoding="iso8601" point="end">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+
+
+ <xsl:value-of select="marc:subfield[@code='a'][2]"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </temporal>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <temporal encoding="iso8601">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </temporal>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </subject>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=050]">
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <classification authority="lcc">
+ <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="text()"/>
+ </classification>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
+ <classification authority="lcc">
+ <xsl:value-of select="text()"/>
+ </classification>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=082]">
+ <classification authority="ddc">
+ <xsl:if test="marc:subfield[@code='2']">
+ <xsl:attribute name="edition">
+ <xsl:value-of select="marc:subfield[@code='2']"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=080]">
+ <classification authority="udc">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abx</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=060]">
+ <classification authority="nlm">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
+ <classification authority="sudocs">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </classification>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
+ <classification authority="candoc">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </classification>
+ </xsl:for-each>
+-->
+ <!-- MARC21 086a -->
+ <xsl:for-each select="marc:datafield[@tag=022]">
+ <classification>
+ <xsl:attribute name="authority">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:attribute>
+ <xsl:value-of select="marc:subfield[@code='b']"/>
+ </classification>
+ </xsl:for-each>
+
+ <!--
+ <xsl:for-each select="marc:datafield[@tag=084]">
+ <classification>
+ <xsl:attribute name="authority">
+ <xsl:value-of select="marc:subfield[@code='2']"/>
+ </xsl:attribute>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </classification>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=440]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">av</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </relatedItem>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 490/0 -->
+ <xsl:for-each select="marc:datafield[@tag=490]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adefhv</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ </relatedItem>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=510]">
+ <relatedItem type="isReferencedBy">
+ <note>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcx3</xsl:with-param>
+ </xsl:call-template>
+ </note>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=534]">
+ <relatedItem type="original">
+ <xsl:call-template name="relatedTitle"/>
+ <xsl:call-template name="relatedName"/>
+ <xsl:if test="marc:subfield[@code='b' or @code='c']">
+ <originInfo>
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <publisher>
+ <xsl:value-of select="."/>
+ </publisher>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+ </xsl:for-each>
+ </originInfo>
+ </xsl:if>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ <xsl:for-each select="marc:subfield[@code='z']">
+ <identifier type="isbn">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:call-template name="relatedNote"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <name type="personal">
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aq</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">dg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="corporate">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:variable name="tempNamePart">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">c</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="normalize-space($tempNamePart)">
+ <namePart>
+ <xsl:value-of select="$tempNamePart"/>
+ </namePart>
+ </xsl:if>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="conference">
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">gn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <xsl:call-template name="relatedForm"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
+ <relatedItem>
+ <xsl:call-template name="constituentOrRelatedType"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 760 and 762 -->
+ <xsl:for-each select="marc:datafield[@tag=410]|marc:datafield[@tag=411]">
+ <relatedItem type="series">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 777 and 787 -->
+ <xsl:for-each select="marc:datafield[@tag=423]|marc:datafield[@tag=455]">
+ <relatedItem>
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 775 -->
+ <xsl:for-each select="marc:datafield[@tag=451]">
+ <relatedItem type="otherVersion">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 770 and 774 -->
+ <xsl:for-each select="marc:datafield[@tag=421]|marc:datafield[@tag=461]|marc:datafield[@tag=462]">
+ <relatedItem type="constituent">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 772 and 773 -->
+ <xsl:for-each select="marc:datafield[@tag=442]|marc:datafield[@tag=463]">
+ <relatedItem type="host">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 776 -->
+ <xsl:for-each select="marc:datafield[@tag=452]">
+ <relatedItem type="otherFormat">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 780 -->
+ <xsl:for-each select="marc:datafield[@tag &gt; 429 and @tag &lt; 438]">
+ <relatedItem type="preceding">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <!-- MARC21 785 -->
+ <xsl:for-each select="marc:datafield[@tag &gt; 439 and @tag &lt; 449]">
+ <relatedItem type="succeeding">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=786]">
+ <relatedItem type="original">
+ <xsl:call-template name="relatedItem76X-78X"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=800]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <name type="personal">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aq</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=810]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">dg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="corporate">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">c</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=811]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="afterCodes">g</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="relatedPartNumName"/>
+ </titleInfo>
+ <name type="conference">
+ <namePart>
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
+ <xsl:with-param name="axis">t</xsl:with-param>
+ <xsl:with-param name="beforeCodes">gn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=830]">
+ <relatedItem type="series">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:call-template name="part"/>
+ </titleInfo>
+ <xsl:call-template name="relatedForm"/>
+ </relatedItem>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=856][@ind2=2]/marc:subfield[@code='q']">
+ <relatedItem>
+ <internetMediaType>
+ <xsl:value-of select="."/>
+ </internetMediaType>
+ </relatedItem>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 020 -->
+ <xsl:for-each select="marc:datafield[@tag=010]">
+ <identifier type="isbn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="translate(marc:subfield[@code='a'],'-','')"/>
+ </identifier>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1=0]">
+ <identifier type="isrc">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1=2]">
+ <identifier type="ismn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+-->
+
+ <!-- MARC21 022 -->
+ <xsl:for-each select="marc:datafield[@tag=011]">
+ <identifier type="issn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+<!--
+ <xsl:for-each select="marc:datafield[@tag=010]">
+ <identifier type="lccn">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
+ </identifier>
+ </xsl:for-each>
+-->
+ <!-- MARC21 028 -->
+ <xsl:for-each select="marc:datafield[@tag=071]">
+ <identifier>
+ <xsl:call-template name="isInvalid"/>
+ <xsl:attribute name="type">
+ <xsl:choose>
+ <xsl:when test="@ind1=0">issue number</xsl:when>
+ <xsl:when test="@ind1=1">matrix number</xsl:when>
+ <xsl:when test="@ind1=2">music plate</xsl:when>
+ <xsl:when test="@ind1=3">music publisher</xsl:when>
+ <xsl:when test="@ind1=4">videorecording identifier</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">
+ <xsl:choose>
+ <xsl:when test="@ind1=0">ba</xsl:when>
+ <xsl:otherwise>ab</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </identifier>
+ </xsl:for-each>
+
+<!--
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1='4']">
+ <identifier type="sici">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </identifier>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=037]">
+ <identifier type="stock number">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">ab</xsl:with-param>
+ </xsl:call-template>
+ </identifier>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
+ <identifier>
+ <xsl:attribute name="type">
+ <xsl:choose>
+ <xsl:when test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')">doi</xsl:when>
+ <xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov')">hdl</xsl:when>
+ <xsl:otherwise>uri</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov') ">
+ <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="marc:subfield[@code='u']"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </identifier>
+ <xsl:if test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
+ <identifier type="hdl">
+ <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
+ <xsl:attribute name="displayLabel">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">y3z</xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"/>
+ </identifier>
+ </xsl:if>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
+ <identifier type="upc">
+ <xsl:call-template name="isInvalid"/>
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </identifier>
+ </xsl:for-each>
+ <xsl:for-each select="marc:datafield[@tag=856][marc:subfield[@code='u']]">
+ <location>
+ <url>
+ <xsl:if test="marc:subfield[@code='y' or @code='3']">
+ <xsl:attribute name="displayLabel">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">y3</xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="marc:subfield[@code='u']"/>
+ </url>
+ </location>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=852]">
+ <location>
+ <physicalLocation>
+ <xsl:call-template name="displayLabel"/>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abje</xsl:with-param>
+ </xsl:call-template>
+ </physicalLocation>
+ </location>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=506]">
+ <accessCondition type="restrictionOnAccess">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcd35</xsl:with-param>
+ </xsl:call-template>
+ </accessCondition>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:datafield[@tag=540]">
+ <accessCondition type="useAndReproduction">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcde35</xsl:with-param>
+ </xsl:call-template>
+ </accessCondition>
+ </xsl:for-each>
+-->
+ <recordInfo>
+<!--
+ <xsl:for-each select="marc:datafield[@tag=040]">
+ <recordContentSource authority="marcorg">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </recordContentSource>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:controlfield[@tag=008]">
+ <recordCreationDate encoding="marc">
+ <xsl:value-of select="substring(.,1,6)"/>
+ </recordCreationDate>
+ </xsl:for-each>
+-->
+
+ <xsl:for-each select="marc:controlfield[@tag=005]">
+ <recordChangeDate encoding="iso8601">
+ <xsl:value-of select="."/>
+ </recordChangeDate>
+ </xsl:for-each>
+
+ <xsl:for-each select="marc:controlfield[@tag=001]">
+ <recordIdentifier>
+ <xsl:if test="../marc:controlfield[@tag=003]">
+ <xsl:attribute name="source">
+ <xsl:value-of select="../marc:controlfield[@tag=003]"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="."/>
+ </recordIdentifier>
+ </xsl:for-each>
+
+ <!-- needs to process tag 100 -->
+ <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
+ <languageOfCataloging>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="."/>
+ </languageTerm>
+ </languageOfCataloging>
+ </xsl:for-each>
+ </recordInfo>
+ </xsl:template>
+
+ <xsl:template name="displayForm">
+ <xsl:for-each select="marc:subfield[@code='c']">
+ <displayForm>
+ <xsl:value-of select="."/>
+ </displayForm>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="affiliation">
+ <xsl:for-each select="marc:subfield[@code='p']">
+ <affiliation>
+ <xsl:value-of select="."/>
+ </affiliation>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="uri">
+ <xsl:for-each select="marc:subfield[@code='u']">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="role">
+ <xsl:for-each select="marc:subfield[@code='e']">
+ <role>
+ <roleTerm type="text">
+ <xsl:value-of select="."/>
+ </roleTerm>
+ </role>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='4']">
+ <role>
+ <roleTerm authority="marcrelator" type="code">
+ <xsl:value-of select="."/>
+ </roleTerm>
+ </role>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="part">
+ <xsl:variable name="partNumber">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">h</xsl:with-param>
+ <xsl:with-param name="anyCodes">h</xsl:with-param>
+ <xsl:with-param name="afterCodes">bfgvz</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="partName">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">i</xsl:with-param>
+ <xsl:with-param name="anyCodes">i</xsl:with-param>
+ <xsl:with-param name="afterCodes">bfgvz</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length(normalize-space($partNumber))">
+ <partNumber>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$partNumber"/>
+ </xsl:call-template>
+ </partNumber>
+ </xsl:if>
+ <xsl:if test="string-length(normalize-space($partName))">
+ <partName>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$partName"/>
+ </xsl:call-template>
+ </partName>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="relatedPart">
+ <xsl:if test="@tag=773">
+ <xsl:for-each select="marc:subfield[@code='g']">
+ <part>
+ <text>
+ <xsl:value-of select="."/>
+ </text>
+ </part>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='q']">
+ <part>
+ <xsl:call-template name="parsePart"/>
+ </part>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="relatedPartNumName">
+ <xsl:variable name="partNumber">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">g</xsl:with-param>
+ <xsl:with-param name="anyCodes">g</xsl:with-param>
+ <xsl:with-param name="afterCodes">pst</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="partName">
+ <xsl:call-template name="specialSubfieldSelect">
+ <xsl:with-param name="axis">p</xsl:with-param>
+ <xsl:with-param name="anyCodes">p</xsl:with-param>
+ <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length(normalize-space($partNumber))">
+ <partNumber>
+ <xsl:value-of select="$partNumber"/>
+ </partNumber>
+ </xsl:if>
+ <xsl:if test="string-length(normalize-space($partName))">
+ <partName>
+ <xsl:value-of select="$partName"/>
+ </partName>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="relatedName">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <name>
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </name>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedForm">
+ <xsl:for-each select="marc:subfield[@code='h']">
+ <physicalDescription>
+ <form>
+ <xsl:value-of select="."/>
+ </form>
+ </physicalDescription>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedExtent">
+ <xsl:for-each select="marc:subfield[@code='h']">
+ <physicalDescription>
+ <extent>
+ <xsl:value-of select="."/>
+ </extent>
+ </physicalDescription>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedNote">
+ <xsl:for-each select="marc:subfield[@code='n']">
+ <note>
+ <xsl:value-of select="."/>
+ </note>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedSubject">
+ <xsl:for-each select="marc:subfield[@code='j']">
+ <subject>
+ <temporal encoding="iso8601">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </temporal>
+ </subject>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedIdentifierISSN">
+ <xsl:for-each select="marc:subfield[@code='x']">
+ <identifier type="issn">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedIdentifierISBN">
+ <xsl:for-each select="marc:subfield[@code='y']">
+ <identifier type="isbn">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedIdentifierLocal">
+ <xsl:for-each select="marc:subfield[@code='w']">
+ <identifier type="local">
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedIdentifier">
+ <xsl:for-each select="marc:subfield[@code='o']">
+ <identifier>
+ <xsl:value-of select="."/>
+ </identifier>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedItem76X-78X">
+ <xsl:call-template name="displayLabel"/>
+ <xsl:call-template name="relatedTitle76X-78X"/>
+ <xsl:call-template name="relatedName"/>
+ <xsl:call-template name="relatedOriginInfo"/>
+ <xsl:call-template name="relatedLanguage"/>
+ <xsl:call-template name="relatedExtent"/>
+ <xsl:call-template name="relatedNote"/>
+ <xsl:call-template name="relatedSubject"/>
+ <xsl:call-template name="relatedIdentifier"/>
+ <xsl:call-template name="relatedIdentifierISSN"/>
+ <xsl:call-template name="relatedIdentifierISBN"/>
+ <xsl:call-template name="relatedIdentifierLocal"/>
+ <xsl:call-template name="relatedPart"/>
+ </xsl:template>
+
+ <xsl:template name="subjectGeographicZ">
+ <geographic>
+
+
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </geographic>
+ </xsl:template>
+
+ <xsl:template name="subjectTemporalY">
+ <temporal>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </temporal>
+ </xsl:template>
+
+ <xsl:template name="subjectTopic">
+ <topic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </topic>
+ </xsl:template>
+
+ <xsl:template name="nameABCDN">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">cdn</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="nameABCDQ">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">aq</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/ </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ </xsl:template>
+
+ <!-- added for unimarc -->
+ <xsl:template name="nameABCDFG">
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abdg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="punctuation">
+ <xsl:text>:,;/ </xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="termsOfAddress"/>
+ <xsl:call-template name="nameDate"/>
+ </xsl:template>
+
+ <xsl:template name="nameACDEQ">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">acdeq</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:template>
+
+ <!-- added for unimarc -->
+ <xsl:template name="nameABCDEF">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdef</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:template>
+
+ <xsl:template name="constituentOrRelatedType">
+ <xsl:if test="@ind2=2">
+ <xsl:attribute name="type">constituent</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="relatedTitle">
+ <xsl:for-each select="marc:subfield[@code='t']">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ </titleInfo>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedTitle76X-78X">
+ <xsl:for-each select="marc:subfield[@code='t']">
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
+ <xsl:call-template name="relatedPartNumName"/>
+ </xsl:if>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='p']">
+ <titleInfo type="abbreviated">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
+ <xsl:call-template name="relatedPartNumName"/>
+ </xsl:if>
+ </titleInfo>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='s']">
+ <titleInfo type="uniform">
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </title>
+ <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
+ <xsl:call-template name="relatedPartNumName"/>
+ </xsl:if>
+ </titleInfo>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="relatedOriginInfo">
+ <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
+ <originInfo>
+ <xsl:if test="@tag=775">
+ <xsl:for-each select="marc:subfield[@code='f']">
+ <place>
+ <placeTerm>
+ <xsl:attribute name="type">code</xsl:attribute>
+ <xsl:attribute name="authority">marcgac</xsl:attribute>
+ <xsl:value-of select="."/>
+ </placeTerm>
+ </place>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="marc:subfield[@code='d']">
+ <publisher>
+ <xsl:value-of select="."/>
+ </publisher>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+ </xsl:for-each>
+ </originInfo>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="relatedLanguage">
+ <xsl:for-each select="marc:subfield[@code='e']">
+ <xsl:call-template name="getLanguage">
+ <xsl:with-param name="langString">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="nameDate">
+ <xsl:for-each select="marc:subfield[@code='f']">
+ <namePart type="date">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </namePart>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="subjectAuthority">
+
+ <xsl:if test="@ind2!=4">
+ <xsl:if test="@ind2!=' '">
+ <xsl:if test="@ind2!=8">
+ <xsl:if test="@ind2!=9">
+ <xsl:attribute name="authority">
+ <xsl:choose>
+
+ <xsl:when test="@ind2=0">lcsh</xsl:when>
+ <xsl:when test="@ind2=1">lcshac</xsl:when>
+ <xsl:when test="@ind2=2">mesh</xsl:when>
+ <!-- 1/04 fix -->
+ <xsl:when test="@ind2=3">nal</xsl:when>
+ <xsl:when test="@ind2=5">csh</xsl:when>
+ <xsl:when test="@ind2=6">rvm</xsl:when>
+ <xsl:when test="@ind2=7">
+ <xsl:value-of select="marc:subfield[@code='2']"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="subjectAnyOrder">
+ <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
+ <xsl:choose>
+ <xsl:when test="@code='v'">
+ <xsl:call-template name="subjectTopic"/>
+ </xsl:when>
+ <xsl:when test="@code='x'">
+ <xsl:call-template name="subjectTopic"/>
+ </xsl:when>
+ <xsl:when test="@code='y'">
+ <xsl:call-template name="subjectTemporalY"/>
+ </xsl:when>
+ <xsl:when test="@code='z'">
+ <xsl:call-template name="subjectGeographicZ"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="specialSubfieldSelect">
+ <xsl:param name="anyCodes"/>
+ <xsl:param name="axis"/>
+ <xsl:param name="beforeCodes"/>
+ <xsl:param name="afterCodes"/>
+ <xsl:variable name="str">
+ <xsl:for-each select="marc:subfield">
+ <xsl:if test="contains($anyCodes, @code) or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis]) or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
+ <xsl:value-of select="text()"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
+ </xsl:template>
+
+ <xsl:template match="marc:datafield[@tag=600 or @tag=602 or @Tag=604]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <name type="personal">
+ <xsl:call-template name="termsOfAddress"/>
+ <namePart>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">a</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:call-template name="nameDate"/>
+ <xsl:call-template name="affiliation"/>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+
+ <!-- MARC21 field 610 -->
+ <xsl:template match="marc:datafield[@tag=601 and @ind1=0]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <name type="corporate">
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:for-each select="marc:subfield[@code='b']">
+ <namePart>
+ <xsl:value-of select="."/>
+ </namePart>
+ </xsl:for-each>
+ <xsl:if test="marc:subfield[@code='d' or @code='e' or @code='f']">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">def</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:if>
+ <xsl:call-template name="role"/>
+ </name>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+
+ <!-- MARC21 field 611 -->
+ <xsl:template match="marc:datafield[@tag=601 and @ind1=01]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <name type="conference">
+ <namePart>
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcdefghqnp</xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ <xsl:for-each select="marc:subfield[@code='4']">
+ <role>
+ <roleTerm authority="marcrelator" type="code">
+ <xsl:value-of select="."/>
+ </roleTerm>
+ </role>
+ </xsl:for-each>
+ </name>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+
+ <!-- MARC21 field 630 -->
+ <xsl:template match="marc:datafield[@tag=605]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <titleInfo>
+ <title>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">adfkloqr</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="part"/>
+ </title>
+ </titleInfo>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+
+ <!-- MARC21 field 650 -->
+ <xsl:template match="marc:datafield[@tag=606]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <topic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">abcd</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </topic>
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+
+ <!-- MARC21 field 651 -->
+ <xsl:template match="marc:datafield[@tag=607]">
+ <subject>
+ <xsl:call-template name="subjectAuthority"/>
+ <xsl:for-each select="marc:subfield[@code='a']">
+
+ <geographic>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="."/>
+ </xsl:call-template>
+ </geographic>
+ </xsl:for-each>
+
+ <xsl:call-template name="subjectAnyOrder"/>
+ </subject>
+ </xsl:template>
+
+ <!-- MARC21 field 610, empty ind2 -->
+ <xsl:template match="marc:datafield[@tag=610 and not(@ind2=0) and not(@ind2=1)]">
+ <subject>
+ <xsl:for-each select="marc:subfield[@code='a']">
+ <topic>
+ <xsl:value-of select="."/>
+ </topic>
+ </xsl:for-each>
+ </subject>
+ </xsl:template>
+
+ <xsl:template match="marc:datafield[@tag=656]">
+ <subject>
+ <xsl:if test="marc:subfield[@code=2]">
+ <xsl:attribute name="authority">
+ <xsl:value-of select="marc:subfield[@code=2]"/>
+ </xsl:attribute>
+ </xsl:if>
+ <occupation>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='a']"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </occupation>
+ </subject>
+ </xsl:template>
+
+ <xsl:template name="termsOfAddress">
+ <xsl:if test="marc:subfield[@code='c']">
+ <namePart type="termsOfAddress">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">c</xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </namePart>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="displayLabel">
+ <xsl:if test="marc:subfield[@code='i']">
+ <xsl:attribute name="displayLabel">
+ <xsl:value-of select="marc:subfield[@code='i']"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="marc:subfield[@code='3']">
+ <xsl:attribute name="displayLabel">
+ <xsl:value-of select="marc:subfield[@code='3']"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="isInvalid">
+ <xsl:if test="marc:subfield[@code='z']">
+ <xsl:attribute name="invalid">yes</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="subtitle">
+ <xsl:if test="marc:subfield[@code='b']">
+ <subTitle>
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString">
+ <xsl:value-of select="marc:subfield[@code='b']"/>
+
+ <!--<xsl:call-template name="subfieldSelect">
+ <xsl:with-param name="codes">b</xsl:with-param>
+ </xsl:call-template>-->
+ </xsl:with-param>
+ </xsl:call-template>
+ </subTitle>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="script">
+ <xsl:param name="scriptCode"/>
+ <xsl:attribute name="script">
+ <xsl:choose>
+ <xsl:when test="$scriptCode='(3'">Arabic</xsl:when>
+ <xsl:when test="$scriptCode='(B'">Latin</xsl:when>
+ <xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when>
+ <xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when>
+ <xsl:when test="$scriptCode='(2'">Hebrew</xsl:when>
+ <xsl:when test="$scriptCode='(S'">Greek</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template name="parsePart">
+ <!-- assumes 773$q= 1:2:3<4
+ with up to 3 levels and one optional start page
+ -->
+ <xsl:variable name="level1">
+ <xsl:choose>
+ <xsl:when test="contains(text(),':')">
+ <!-- 1:2 -->
+ <xsl:value-of select="substring-before(text(),':')"/>
+ </xsl:when>
+ <xsl:when test="not(contains(text(),':'))">
+ <!-- 1 or 1<3 -->
+ <xsl:if test="contains(text(),'&lt;')">
+ <!-- 1<3 -->
+ <xsl:value-of select="substring-before(text(),'&lt;')"/>
+ </xsl:if>
+ <xsl:if test="not(contains(text(),'&lt;'))">
+ <!-- 1 -->
+ <xsl:value-of select="text()"/>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sici2">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after(text(),$level1),':')">
+ <xsl:value-of select="substring(substring-after(text(),$level1),2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after(text(),$level1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="level2">
+ <xsl:choose>
+ <xsl:when test="contains($sici2,':')">
+ <!-- 2:3<4 -->
+ <xsl:value-of select="substring-before($sici2,':')"/>
+ </xsl:when>
+ <xsl:when test="contains($sici2,'&lt;')">
+ <!-- 1: 2<4 -->
+ <xsl:value-of select="substring-before($sici2,'&lt;')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$sici2"/>
+ <!-- 1:2 -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sici3">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after($sici2,$level2),':')">
+ <xsl:value-of select="substring(substring-after($sici2,$level2),2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($sici2,$level2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="level3">
+ <xsl:choose>
+ <xsl:when test="contains($sici3,'&lt;')">
+ <!-- 2<4 -->
+ <xsl:value-of select="substring-before($sici3,'&lt;')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$sici3"/>
+ <!-- 3 -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="page">
+ <xsl:if test="contains(text(),'&lt;')">
+ <xsl:value-of select="substring-after(text(),'&lt;')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="$level1">
+ <detail level="1">
+ <number>
+ <xsl:value-of select="$level1"/>
+ </number>
+ </detail>
+ </xsl:if>
+ <xsl:if test="$level2">
+ <detail level="2">
+ <number>
+ <xsl:value-of select="$level2"/>
+ </number>
+ </detail>
+ </xsl:if>
+ <xsl:if test="$level3">
+ <detail level="3">
+ <number>
+ <xsl:value-of select="$level3"/>
+ </number>
+ </detail>
+ </xsl:if>
+ <xsl:if test="$page">
+ <extent unit="page">
+ <start>
+ <xsl:value-of select="$page"/>
+ </start>
+ </extent>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="getLanguage">
+ <xsl:param name="langString"/>
+ <xsl:param name="controlField008-35-37"/>
+ <xsl:variable name="length" select="string-length($langString)"/>
+ <xsl:choose>
+ <xsl:when test="$length=0"/>
+ <xsl:when test="$controlField008-35-37=substring($langString,1,3)">
+ <xsl:call-template name="getLanguage">
+ <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
+ <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="substring($langString,1,3)"/>
+ </languageTerm>
+ </language>
+ <xsl:call-template name="getLanguage">
+ <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
+ <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="isoLanguage">
+ <xsl:param name="currentLanguage"/>
+ <xsl:param name="usedLanguages"/>
+ <xsl:param name="remainingLanguages"/>
+ <xsl:choose>
+ <xsl:when test="string-length($currentLanguage)=0"/>
+ <xsl:when test="not(contains($usedLanguages, $currentLanguage))">
+ <language>
+ <languageTerm authority="iso639-2b" type="code">
+ <xsl:value-of select="$currentLanguage"/>
+ </languageTerm>
+ </language>
+ <xsl:call-template name="isoLanguage">
+ <xsl:with-param name="currentLanguage">
+ <xsl:value-of select="substring($remainingLanguages,1,3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
+ </xsl:with-param>
+ <xsl:with-param name="remainingLanguages">
+ <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="isoLanguage">
+ <xsl:with-param name="currentLanguage">
+ <xsl:value-of select="substring($remainingLanguages,1,3)"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
+ </xsl:with-param>
+ <xsl:with-param name="remainingLanguages">
+ <xsl:value-of select="substring($remainingLanguages,4,string-length($remainingLanguages))"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="chopBrackets">
+ <xsl:param name="chopString"/>
+ <xsl:variable name="string">
+ <xsl:call-template name="chopPunctuation">
+ <xsl:with-param name="chopString" select="$chopString"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="substring($string, 1,1)='['">
+ <xsl:value-of select="substring($string,2, string-length($string)-2)"/>
+ </xsl:if>
+ <xsl:if test="substring($string, 1,1)!='['">
+ <xsl:value-of select="$string"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="rfcLanguages">
+ <xsl:param name="nodeNum"/>
+ <xsl:param name="usedLanguages"/>
+ <xsl:param name="controlField008-35-37"/>
+ <!-- ??? xalan -->
+
+ <xsl:variable name="currentLanguage" select="marc:subfield[position()=$nodeNum]/text()"/>
+ <xsl:choose>
+ <xsl:when test="not($currentLanguage)"/>
+ <xsl:when test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
+ <xsl:if test="not(contains($usedLanguages,$currentLanguage))">
+ <language>
+ <languageTerm authority="rfc3066" type="code">
+ <xsl:value-of select="$currentLanguage"/>
+ </languageTerm>
+ </language>
+ </xsl:if>
+ <xsl:call-template name="rfcLanguages">
+ <!-- ??? xalan -->
+ <xsl:with-param name="nodeNum">
+ <xsl:value-of select="$nodeNum+1"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:value-of select="concat($usedLanguages,'|',$currentLanguage)"/>
+ </xsl:with-param>
+ <xsl:with-param name="controlField008-35-37">
+ <xsl:value-of select="$controlField008-35-37"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="rfcLanguages">
+ <xsl:with-param name="nodeNum">
+ <xsl:value-of select="$nodeNum+1"/>
+ </xsl:with-param>
+ <xsl:with-param name="usedLanguages">
+ <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
+ </xsl:with-param>
+ <xsl:with-param name="controlField008-35-37">
+ <xsl:value-of select="$controlField008-35-37"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- added for Tellico, don't print unrecognized datafields -->
+ <xsl:template match="marc:datafield">
+ </xsl:template>
+
+</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
+<metaInformation>
+<scenarios ><scenario default="no" name="Apr 02 Test" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\test_files\v3.xml" htmlbaseurl="" outputurl="file://n:\temp\x.xml" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="v3Test1" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\test_files\v3.xml" htmlbaseurl="" outputurl="file://n:\jackie\test_files\modsv3Converted.xml" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="Scenario1" userelativepaths="yes" externalpreview="no" url="file://n:\ckeith\DESKTOP\test.xml" htmlbaseurl="" outputurl="" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="yes" name="Test" userelativepaths="yes" externalpreview="no" url="file://n:\jackie\MARCXML\marcxmlfile.xml" htmlbaseurl="" outputurl="" processortype="xalan" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
+</metaInformation>
+-->
diff --git a/xslt/amazon2tellico.xsl b/xslt/amazon2tellico.xsl
new file mode 100644
index 0000000..065886a
--- /dev/null
+++ b/xslt/amazon2tellico.xsl
@@ -0,0 +1,590 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2007-10-29"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing Amazon Web Services data.
+
+ Copyright (C) 2004-2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+
+<!-- need to figure out what type of collection -->
+<xsl:variable name="args" select="//aws:OperationRequest/aws:Arguments"/>
+<xsl:variable name="tmp">
+ <xsl:choose>
+ <!-- SearchIndex is mode, unless doing ISBN or UPC search -->
+ <xsl:when test="$args/aws:Argument[@Name='SearchIndex']">
+ <xsl:value-of select="$args/aws:Argument[@Name='SearchIndex']/@Value"/>
+ </xsl:when>
+ <!-- only happens for books -->
+ <xsl:when test="$args/aws:Argument[@Name='Operation']/@Value='ItemLookup'">
+ <xsl:text>Books</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+</xsl:variable>
+<!-- France might have DVD instead of Video -->
+<xsl:variable name="mode">
+ <xsl:choose>
+ <xsl:when test="$tmp='DVD'">
+ <xsl:text>Video</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tmp"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<!-- for lower-casing -->
+<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="Amazon Import">
+ <xsl:attribute name="type">
+ <xsl:choose>
+ <xsl:when test="$mode='Books'">
+ <xsl:text>2</xsl:text>
+ </xsl:when>
+ <xsl:when test="$mode='Video'">
+ <xsl:text>3</xsl:text>
+ </xsl:when>
+ <!-- also can be pop-music-de -->
+ <xsl:when test="$mode='Music'">
+ <xsl:text>4</xsl:text>
+ </xsl:when>
+ <xsl:when test="$mode='VideoGames'">
+ <xsl:text>11</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <fields>
+ <field name="_default"/>
+ <field flags="0" title="Amazon Link" category="General" format="4" type="7" name="amazon" i18n="true"/>
+ <!-- the amazon importer will actually download the images and ignore these fields -->
+ <field flags="0" title="Small Image" category="Images" format="4" type="7" name="small-image"/>
+ <field flags="0" title="Medium Image" category="Images" format="4" type="7" name="medium-image"/>
+ <field flags="0" title="Large Image" category="Images" format="4" type="7" name="large-image"/>
+ </fields>
+ <xsl:for-each select="//aws:Items/aws:Item">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="aws:Item">
+ <entry>
+ <amazon>
+ <xsl:value-of select="aws:DetailPageURL"/>
+ </amazon>
+
+ <small-image>
+ <xsl:value-of select="aws:SmallImage/aws:URL"/>
+ </small-image>
+
+ <medium-image>
+ <xsl:value-of select="aws:MediumImage/aws:URL"/>
+ </medium-image>
+
+ <large-image>
+ <xsl:value-of select="aws:LargeImage/aws:URL"/>
+ </large-image>
+
+ <xsl:choose>
+ <xsl:when test="$mode='Books'">
+ <comments>
+ <xsl:value-of select="aws:EditorialReviews/aws:EditorialReview/aws:Content"/>
+ </comments>
+
+ <keywords i18n="true">
+ <xsl:for-each select="aws:BrowseNodes/aws:BrowseNode">
+ <keyword>
+ <xsl:call-template name="nodes">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+ </xsl:when>
+
+ <xsl:when test="$mode='Music'">
+ <comments>
+ <xsl:value-of select="aws:EditorialReviews/aws:EditorialReview[1]/aws:Content"/>
+ </comments>
+
+ <tracks>
+ <!-- too hard to know which artist goes with which track, just grab first -->
+ <xsl:variable name="artist" select="aws:ItemAttributes/aws:Artist[1]"/>
+ <xsl:for-each select="aws:Tracks//aws:Track">
+ <track>
+ <xsl:value-of select="."/>
+ <xsl:text>::</xsl:text>
+ <!-- too hard to know which artist goes with which track, just grab first -->
+ <xsl:value-of select="$artist"/>
+ </track>
+ </xsl:for-each>
+ </tracks>
+
+ <!-- these get cleaned up within Tellico itself -->
+ <genres i18n="true">
+ <xsl:for-each select="aws:BrowseNodes/aws:BrowseNode">
+ <genre>
+ <xsl:call-template name="nodes">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </genre>
+ </xsl:for-each>
+ </genres>
+ </xsl:when>
+
+ <xsl:when test="$mode='Video'">
+ <plot>
+ <xsl:value-of select="aws:EditorialReviews/aws:EditorialReview[1]/aws:Content"/>
+ </plot>
+
+ <!-- these get cleaned up within Tellico itself -->
+ <genres i18n="true">
+ <xsl:for-each select="aws:BrowseNodes/aws:BrowseNode">
+ <genre>
+ <xsl:call-template name="nodes">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </genre>
+ </xsl:for-each>
+ </genres>
+ </xsl:when>
+
+ <xsl:when test="$mode='VideoGames'">
+ <description>
+ <xsl:value-of select="aws:EditorialReviews/aws:EditorialReview[1]/aws:Content"/>
+ </description>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates select="aws:ItemAttributes"/>
+ </entry>
+</xsl:template>
+
+<xsl:template match="aws:ItemAttributes">
+ <title>
+ <xsl:value-of select="aws:Title"/>
+ </title>
+
+ <languages>
+ <xsl:for-each select="aws:Languages/aws:Language[not(aws:Name=preceding-sibling::aws:Language/aws:Name)]">
+ <language>
+ <xsl:value-of select="aws:Name"/>
+ </language>
+ </xsl:for-each>
+ </languages>
+
+ <xsl:choose>
+ <!-- book collection stuff -->
+ <xsl:when test="$mode='Books'">
+ <authors>
+ <xsl:for-each select="aws:Author">
+ <author>
+ <xsl:value-of select="."/>
+ </author>
+ </xsl:for-each>
+ </authors>
+
+ <isbn>
+ <!-- the EAN is the isbn-13 value for books -->
+ <xsl:choose>
+ <xsl:when test="aws:ISBN">
+ <xsl:value-of select="aws:ISBN"/>
+ </xsl:when>
+ <xsl:when test="aws:EAN">
+ <xsl:value-of select="aws:EAN"/>
+ </xsl:when>
+ </xsl:choose>
+ </isbn>
+
+ <publisher>
+ <xsl:value-of select="aws:Publisher"/>
+ </publisher>
+
+ <editors>
+ <xsl:for-each select="aws:Creator[@Role='Editor']">
+ <editor>
+ <xsl:value-of select="."/>
+ </editor>
+ </xsl:for-each>
+ </editors>
+
+ <binding i18n="true">
+ <xsl:choose>
+ <xsl:when test="aws:Binding='Hardcover'">
+ <xsl:text>Hardback</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(aws:Binding, 'Paperback')">
+ <xsl:text>Paperback</xsl:text>
+ </xsl:when>
+ <!-- specifically for France -->
+ <xsl:when test="aws:Binding='Broché' or aws:Binding='Poche'">
+ <xsl:text>Souple</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="aws:Binding"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </binding>
+
+ <pub_year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="aws:PublicationDate"/>
+ </xsl:call-template>
+ </pub_year>
+
+ <edition>
+ <xsl:value-of select="aws:Edition"/>
+ </edition>
+
+ <pages>
+ <xsl:value-of select="aws:NumberOfPages"/>
+ </pages>
+ </xsl:when>
+
+ <!-- music collection stuff -->
+ <xsl:when test="$mode='Music'">
+ <artists>
+ <xsl:for-each select="aws:Artist">
+ <artist>
+ <xsl:value-of select="."/>
+ </artist>
+ </xsl:for-each>
+ <!-- only add composers if no artist -->
+ <xsl:if test="not(aws:Artist)">
+ <xsl:for-each select="aws:Creator[@Role='Composer']">
+ <artist>
+ <xsl:value-of select="."/>
+ </artist>
+ </xsl:for-each>
+ </xsl:if>
+ </artists>
+
+ <year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="aws:ReleaseDate"/>
+ </xsl:call-template>
+ </year>
+
+ <labels>
+ <label>
+ <xsl:value-of select="aws:Label"/>
+ </label>
+ </labels>
+
+ <medium i18n="true">
+ <xsl:variable name="medium" select="aws:Binding"/>
+ <xsl:choose>
+ <xsl:when test="$medium='Audio CD'">
+ <xsl:text>Compact Disc</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>
+ <xsl:value-of select="$medium"/>
+ </xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </medium>
+ </xsl:when>
+
+ <!-- video collection stuff -->
+ <xsl:when test="$mode='Video'">
+ <directors>
+ <xsl:for-each select="aws:Director">
+ <director>
+ <xsl:value-of select="."/>
+ </director>
+ </xsl:for-each>
+ </directors>
+
+ <casts>
+ <!-- special case for french, there might be more actors than aws:Actor elements -->
+ <xsl:for-each select="aws:Creator[@Role='Acteur']">
+ <!-- cast is a 2-column table -->
+ <cast>
+ <column>
+ <xsl:value-of select="."/>
+ </column>
+ </cast>
+ </xsl:for-each>
+ <!-- assume only add actor if no creators -->
+ <xsl:if test="not(aws:Creator[@Role='Acteur'])">
+ <xsl:for-each select="aws:Actor">
+ <!-- cast is a 2-column table -->
+ <cast>
+ <column>
+ <xsl:value-of select="."/>
+ </column>
+ </cast>
+ </xsl:for-each>
+ </xsl:if>
+ </casts>
+
+ <year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="aws:TheatricalReleaseDate"/>
+ </xsl:call-template>
+ </year>
+
+ <medium i18n="true">
+ <xsl:variable name="medium" select="aws:ProductGroup"/>
+ <xsl:choose>
+ <xsl:when test="$medium='Video'">
+ <xsl:text>VHS</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(translate($medium,$lcletters,$ucletters),'blu-ray')">
+ <xsl:text>Blu-ray</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$medium"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </medium>
+
+ <color i18n="true">
+ <xsl:choose>
+ <xsl:when test="aws:Format[.='Black &amp; White']">
+ <xsl:text>Black &amp; White</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Color</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </color>
+
+ <aspect-ratios>
+ <xsl:for-each select="aws:AspectRatio">
+ <aspect-ratio>
+ <xsl:value-of select="."/>
+ </aspect-ratio>
+ </xsl:for-each>
+ </aspect-ratios>
+
+ <xsl:if test="aws:Format[.='Widescreen']">
+ <widescreen>
+ <xsl:text>true</xsl:text>
+ </widescreen>
+ </xsl:if>
+
+ <languages>
+ <xsl:for-each select="aws:Languages/aws:Language[not(aws:Name=preceding-sibling::aws:Language/aws:Name)]">
+ <language>
+ <xsl:value-of select="aws:Name"/>
+ </language>
+ </xsl:for-each>
+ </languages>
+
+ <audio-tracks>
+ <xsl:choose>
+ <xsl:when test="aws:Languages/aws:Language/aws:AudioFormat[starts-with(.,'Dolby')]">
+ <audio-track>
+ <xsl:value-of select="aws:Languages/aws:Language/aws:AudioFormat[starts-with(.,'Dolby')][1]"/>
+ </audio-track>
+ </xsl:when>
+ <xsl:when test="aws:Format[starts-with(.,'Dolby')]">
+ <audio-track>
+ <xsl:value-of select="aws:Format[starts-with(.,'Dolby')][1]"/>
+ </audio-track>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="aws:Languages/aws:Language/aws:AudioFormat[starts-with(.,'DTS')]">
+ <audio-track>
+ <xsl:value-of select="aws:Languages/aws:Language/aws:AudioFormat[starts-with(.,'DTS')][1]"/>
+ </audio-track>
+ </xsl:if>
+ </audio-tracks>
+
+ <certification i18n="true">
+ <xsl:variable name="mpaa" select="aws:AudienceRating"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($mpaa, 'PG-13')">
+ <xsl:text>PG-13 (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test="starts-with($mpaa, 'PG')">
+ <xsl:text>PG (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test="starts-with($mpaa, 'R')">
+ <xsl:text>R (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test="starts-with($mpaa, 'G')">
+ <xsl:text>G (USA)</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>
+ <xsl:value-of select="$mpaa"/>
+ </xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </certification>
+
+ <studios>
+ <studio>
+ <xsl:value-of select="aws:Studio"/>
+ </studio>
+ </studios>
+
+ <xsl:if test="aws:RegionCode">
+ <region i18n="true">
+ <xsl:value-of select="concat('Region ', aws:RegionCode)"/>
+ </region>
+ </xsl:if>
+
+ <xsl:if test="aws:RunningTime[@Units='minutes']">
+ <running-time>
+ <xsl:value-of select="aws:RunningTime[@Units='minutes']"/>
+ </running-time>
+ </xsl:if>
+
+ </xsl:when>
+
+ <!-- video game collection stuff -->
+ <xsl:when test="$mode='VideoGames'">
+ <publisher>
+ <xsl:value-of select="aws:Publisher"/>
+ </publisher>
+
+ <!-- assume year is last four characters of ReleaseDate -->
+ <year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="aws:ReleaseDate"/>
+ </xsl:call-template>
+ </year>
+
+ <!-- assume that the only time there are multiple platforms is when it's for multiple versions of windows -->
+ <platform i18n="true">
+ <xsl:call-template name="platform">
+ <xsl:with-param name="value" select="aws:Platform"/>
+ </xsl:call-template>
+ </platform>
+
+ <genres i18n="true">
+ <xsl:for-each select="aws:Feature[starts-with(., 'Genre:')]">
+ <genre>
+ <xsl:value-of select="substring(., 7)"/> <!-- ends with a space -->
+ </genre>
+ </xsl:for-each>
+ </genres>
+
+ <certification i18n="true">
+ <xsl:choose>
+ <xsl:when test="aws:ESRBAgeRating = 'Rating Pending'">
+ <xsl:text>Pending</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="aws:ESRBAgeRating"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </certification>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="nodes">
+ <xsl:param name="node"/>
+
+ <xsl:variable name="firstNode" select="$node/aws:Name"/>
+
+ <xsl:variable name="tailNodes">
+ <xsl:choose>
+ <xsl:when test="$node/aws:Ancestors/aws:BrowseNode[1]/aws:Name">
+ <xsl:call-template name="nodes">
+ <xsl:with-param name="node" select="$node/aws:Ancestors/aws:BrowseNode[1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="string-length($firstNode)">
+ <xsl:choose>
+ <xsl:when test="string-length($tailNodes)">
+ <xsl:value-of select="concat($tailNodes, '/', $firstNode)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$firstNode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="string-length($tailNodes)">
+ <xsl:value-of select="$tailNodes"/>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="year">
+ <xsl:param name="value"/>
+ <xsl:variable name="numbers">
+ <xsl:value-of select="translate($value, translate($value, '0123456789', ''), '')"/>
+ </xsl:variable>
+ <!-- assume that Amazon always encodes the date with the 4-digit year first -->
+ <xsl:value-of select="substring($numbers, 0, 5)"/>
+</xsl:template>
+
+<xsl:template name="platform">
+ <xsl:param name="value"/>
+ <xsl:variable name="lcvalue">
+ <xsl:value-of select="translate($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+ 'abcdefghijklmnopqrstuvwxyz')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($lcvalue, '360')">
+ <xsl:text>Xbox 360</xsl:text>
+ </xsl:when>
+ <xsl:when test="starts-with($lcvalue, 'x')">
+ <xsl:text>Xbox</xsl:text> <!-- as defined in the default field -->
+ </xsl:when>
+ <xsl:when test="contains($lcvalue, 'wii')">
+ <xsl:text>Nintendo Wii</xsl:text> <!-- as defined in the default field -->
+ </xsl:when>
+ <xsl:when test="$lcvalue = 'sony psp'">
+ <xsl:text>PSP</xsl:text> <!-- as defined in the default field -->
+ </xsl:when>
+ <xsl:when test="starts-with($lcvalue, 'windows')">
+ <xsl:text>Windows</xsl:text> <!-- as defined in the default field -->
+ </xsl:when>
+ <xsl:when test="starts-with($lcvalue, 'mac')">
+ <xsl:text>Mac OS</xsl:text> <!-- as defined in the default field -->
+ </xsl:when>
+ <xsl:when test="$lcvalue = 'sega dreamcast'">
+ <xsl:text>Dreamcast</xsl:text> <!-- as defined in the default field -->
+ </xsl:when>
+ <xsl:when test="starts-with($lcvalue, 'playstation')">
+ <xsl:choose>
+ <xsl:when test="contains($lcvalue, '3')">
+ <xsl:text>PlayStation3</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($lcvalue, '2')">
+ <xsl:text>PlayStation2</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/arxiv2tellico.xsl b/xslt/arxiv2tellico.xsl
new file mode 100644
index 0000000..8028e6c
--- /dev/null
+++ b/xslt/arxiv2tellico.xsl
@@ -0,0 +1,277 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:arxiv="http://arxiv.org/schemas/atom"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:c="uri:category"
+ exclude-result-prefixes="atom arxiv"
+ extension-element-prefixes="str exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing data from crossref.org
+
+ See http://www.crossref.org/schema/queryResultSchema/crossref_query_output2.0.7.xsd
+
+ Copyright (C) 2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- lookup table for categories -->
+<c:categories>
+ <c:category id="astro-ph">Astrophysics</c:category>
+ <c:category id="cond-mat">Condensed Matter</c:category>
+ <c:category id="cond-mat.dis-nn">Disordered Systems and Neural Networks</c:category>
+ <c:category id="cond-mat.mtrl-sci">Materials Science</c:category>
+ <c:category id="cond-mat.mes-hall">Mesoscopic Systems and Quantum Hall Effect</c:category>
+ <c:category id="cond-mat.other">Other</c:category>
+ <c:category id="cond-mat.soft">Soft Condensed Matter</c:category>
+ <c:category id="cond-mat.stat-mech">Statistical Mechanics</c:category>
+ <c:category id="cond-mat.str-el">Strongly Correlated Electrons</c:category>
+ <c:category id="cond-mat.supr-con">Superconductivity</c:category>
+ <c:category id="gr-qc">General Relativity and Quantum Cosmology</c:category>
+ <c:category id="hep-ex">High Energy Physics - Experiment</c:category>
+ <c:category id="hep-lat">High Energy Physics - Lattice</c:category>
+ <c:category id="hep-ph">High Energy Physics - Phenomenology</c:category>
+ <c:category id="hep-th">High Energy Physics - Theory</c:category>
+ <c:category id="math-ph">Mathematical Physics</c:category>
+ <c:category id="nucl-ex">Nuclear Experiment</c:category>
+ <c:category id="nucl-th">Nuclear Theory</c:category>
+ <c:category id="physics">Physics</c:category>
+ <c:category id="physics.acc-ph">Accelerator Physics</c:category>
+ <c:category id="physics.ao-ph">Atmospheric and Oceanic Physics</c:category>
+ <c:category id="physics.atom-ph">Atomic Physics</c:category>
+ <c:category id="physics.atm-clus">Atomic and Molecular Clusters</c:category>
+ <c:category id="physics.bio-ph">Biological Physics</c:category>
+ <c:category id="physics.chem-ph">Chemical Physics</c:category>
+ <c:category id="physics.class-ph">Classical Physics</c:category>
+ <c:category id="physics.comp-ph">Computational Physics</c:category>
+ <c:category id="physics.data-an">Data Analysis, Statistics and Probability</c:category>
+ <c:category id="physics.flu-dyn">Fluid Dynamics</c:category>
+ <c:category id="physics.gen-ph">General Physics</c:category>
+ <c:category id="physics.geo-ph">Geophysics</c:category>
+ <c:category id="physics.hist-ph">History of Physics</c:category>
+ <c:category id="physics.ins-det">Instrumentation and Detectors</c:category>
+ <c:category id="physics.med-ph">Medical Physics</c:category>
+ <c:category id="physics.optics">Optics</c:category>
+ <c:category id="physics.ed-ph">Physics Education</c:category>
+ <c:category id="physics.soc-ph">Physics and Society</c:category>
+ <c:category id="physics.plasm-ph">Plasma Physics</c:category>
+ <c:category id="physics.pop-ph">Popular Physics</c:category>
+ <c:category id="physics.space-ph">Space Physics</c:category>
+ <c:category id="quant-ph">Quantum Physics</c:category>
+ <c:category id="math">Mathematics</c:category>
+ <c:category id="math.AG">Algebraic Geometry</c:category>
+ <c:category id="math.AT">Algebraic Topology</c:category>
+ <c:category id="math.AP">Analysis of PDEs</c:category>
+ <c:category id="math.CT">Category Theory</c:category>
+ <c:category id="math.CA">Classical Analysis and ODEs</c:category>
+ <c:category id="math.CO">Combinatorics</c:category>
+ <c:category id="math.AC">Commutative Algebra</c:category>
+ <c:category id="math.CV">Complex Variables</c:category>
+ <c:category id="math.DG">Differential Geometry</c:category>
+ <c:category id="math.DS">Dynamical Systems</c:category>
+ <c:category id="math.FA">Functional Analysis</c:category>
+ <c:category id="math.GM">General Mathematics</c:category>
+ <c:category id="math.GN">General Topology</c:category>
+ <c:category id="math.GT">Geometric Topology</c:category>
+ <c:category id="math.GR">Group Theory</c:category>
+ <c:category id="math.HO">History and Overview</c:category>
+ <c:category id="math.IT">Information Theory</c:category>
+ <c:category id="math.KT">K-Theory and Homology</c:category>
+ <c:category id="math.LO">Logic</c:category>
+ <c:category id="math.MP">Mathematical Physics</c:category>
+ <c:category id="math.MG">Metric Geometry</c:category>
+ <c:category id="math.NT">Number Theory</c:category>
+ <c:category id="math.NA">Numerical Analysis</c:category>
+ <c:category id="math.OA">Operator Algebras</c:category>
+ <c:category id="math.OC">Optimization and Control</c:category>
+ <c:category id="math.PR">Probability</c:category>
+ <c:category id="math.QA">Quantum Algebra</c:category>
+ <c:category id="math.RT">Representation Theory</c:category>
+ <c:category id="math.RA">Rings and Algebras</c:category>
+ <c:category id="math.SP">Spectral Theory</c:category>
+ <c:category id="math.ST">Statistics</c:category>
+ <c:category id="math.SG">Symplectic Geometry</c:category>
+ <c:category id="nlin">Nonlinear Sciences</c:category>
+ <c:category id="nlin.AO">Adaptation and Self-Organizing Systems</c:category>
+ <c:category id="nlin.CG">Cellular Automata and Lattice Gases</c:category>
+ <c:category id="nlin.CD">Chaotic Dynamics</c:category>
+ <c:category id="nlin.SI">Exactly Solvable and Integrable Systems</c:category>
+ <c:category id="nlin.PS">Pattern Formation and Solitons</c:category>
+ <c:category id="cs.AR">Architecture</c:category>
+ <c:category id="cs.AI">Artificial Intelligence</c:category>
+ <c:category id="cs.CL">Computation and Language</c:category>
+ <c:category id="cs.CC">Computational Complexity</c:category>
+ <c:category id="cs.CE">Computational Engineering, Finance, and Science</c:category>
+ <c:category id="cs.CG">Computational Geometry</c:category>
+ <c:category id="cs.GT">Computer Science and Game Theory</c:category>
+ <c:category id="cs.CV">Computer Vision and Pattern Recognition</c:category>
+ <c:category id="cs.CY">Computers and Society</c:category>
+ <c:category id="cs.CR">Cryptography and Security</c:category>
+ <c:category id="cs.DS">Data Structures and Algorithms</c:category>
+ <c:category id="cs.DB">Databases</c:category>
+ <c:category id="cs.DL">Digital Libraries</c:category>
+ <c:category id="cs.DM">Discrete Mathematics</c:category>
+ <c:category id="cs.DC">Distributed, Parallel, and Cluster Computing</c:category>
+ <c:category id="cs.GL">General Literature</c:category>
+ <c:category id="cs.GR">Graphics</c:category>
+ <c:category id="cs.HC">Human-Computer Interaction</c:category>
+ <c:category id="cs.IR">Information Retrieval</c:category>
+ <c:category id="cs.IT">Information Theory</c:category>
+ <c:category id="cs.LG">Learning</c:category>
+ <c:category id="cs.LO">Logic in Computer Science</c:category>
+ <c:category id="cs.MS">Mathematical Software</c:category>
+ <c:category id="cs.MA">Multiagent Systems</c:category>
+ <c:category id="cs.MM">Multimedia</c:category>
+ <c:category id="cs.NI">Networking and Internet Architecture</c:category>
+ <c:category id="cs.NE">Neural and Evolutionary Computing</c:category>
+ <c:category id="cs.NA">Numerical Analysis</c:category>
+ <c:category id="cs.OS">Operating Systems</c:category>
+ <c:category id="cs.OH">Other</c:category>
+ <c:category id="cs.PF">Performance</c:category>
+ <c:category id="cs.PL">Programming Languages</c:category>
+ <c:category id="cs.RO">Robotics</c:category>
+ <c:category id="cs.SE">Software Engineering</c:category>
+ <c:category id="cs.SD">Sound</c:category>
+ <c:category id="cs.SC">Symbolic Computation</c:category>
+ <c:category id="q-bio">Quantitative Biology</c:category>
+ <c:category id="q-bio.BM">Biomolecules</c:category>
+ <c:category id="q-bio.CB">Cell Behavior</c:category>
+ <c:category id="q-bio.GN">Genomics</c:category>
+ <c:category id="q-bio.MN">Molecular Networks</c:category>
+ <c:category id="q-bio.NC">Neurons and Cognition</c:category>
+ <c:category id="q-bio.OT">Other</c:category>
+ <c:category id="q-bio.PE">Populations and Evolution</c:category>
+ <c:category id="q-bio.QM">Quantitative Methods</c:category>
+ <c:category id="q-bio.SC">Subcellular Processes</c:category>
+ <c:category id="q-bio.TO">Tissues and Organs</c:category>
+ <c:category id="stat">Statistics</c:category>
+ <c:category id="stat.AP">Applications</c:category>
+ <c:category id="stat.CO">Computation</c:category>
+ <c:category id="stat.ML">Machine Learning</c:category>
+ <c:category id="stat.ME">Methodology</c:category>
+ <c:category id="stat.TH">Theory</c:category>
+</c:categories>
+<xsl:key name="categories" match="c:category" use="@id"/>
+<xsl:variable name="categories-top" select="document('')/*/c:categories"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="Arxiv Search" type="5">
+ <fields>
+ <field name="_default"/>
+ <field flags="0" title="arXiv ID" category="Publishing" format="4" type="1" name="arxiv" description="arXiv ID"/>
+ </fields>
+ <xsl:apply-templates select="atom:feed/atom:entry"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="atom:entry">
+ <entry>
+
+ <title>
+ <xsl:value-of select="normalize-space(atom:title)"/>
+ </title>
+
+ <entry-type>
+ <xsl:text>article</xsl:text>
+ </entry-type>
+
+ <authors>
+ <xsl:for-each select="atom:author">
+ <author>
+ <xsl:value-of select="normalize-space(atom:name)"/>
+ </author>
+ </xsl:for-each>
+ </authors>
+
+ <abstract>
+ <xsl:value-of select="normalize-space(atom:summary)"/>
+ </abstract>
+
+ <note>
+ <xsl:value-of select="normalize-space(arxiv:comment)"/>
+ </note>
+
+ <keywords>
+ <xsl:for-each select="atom:category">
+ <keyword>
+ <xsl:apply-templates select="$categories-top">
+ <xsl:with-param name="cat" select="@term"/>
+ </xsl:apply-templates>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+
+ <url>
+ <xsl:choose>
+ <xsl:when test="atom:link[@title='pdf']">
+ <xsl:value-of select="atom:link[@title='pdf']/@href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="atom:link[1]/@href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </url>
+
+ <doi>
+ <xsl:value-of select="arxiv:doi"/>
+ </doi>
+
+ <xsl:call-template name="journal_ref">
+ <xsl:with-param name="value" select="arxiv:journal_ref"/>
+ </xsl:call-template>
+
+ <arxiv>
+ <!-- remove http://arxiv.org/abs/ from beginning -->
+ <xsl:value-of select="substring(atom:id, string-length('http://arxiv.org/abs/')+1)"/>
+ </arxiv>
+
+ </entry>
+
+</xsl:template>
+
+<xsl:template name="journal_ref">
+ <xsl:param name="value"/>
+
+ <journal>
+ <xsl:value-of select="substring-before($value, '(')"/>
+ </journal>
+
+ <xsl:variable name="after1" select="substring-after($value, '(')"/>
+ <xsl:variable name="year" select="substring-before($after1, ')')"/>
+ <year>
+ <xsl:value-of select="normalize-space($year)"/>
+ </year>
+
+ <xsl:variable name="after2" select="substring-after($after1, ')')"/>
+ <pages>
+ <xsl:value-of select="normalize-space($after2)"/>
+ </pages>
+</xsl:template>
+
+<xsl:template match="c:categories">
+ <xsl:param name="cat"/>
+ <xsl:variable name="c" select="key('categories', $cat)"/>
+ <xsl:if test="$c">
+ <xsl:value-of select="$c"/>
+ </xsl:if>
+ <xsl:if test="not($c)">
+ <xsl:value-of select="$cat"/>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/bluray-logo.png b/xslt/bluray-logo.png
new file mode 100644
index 0000000..62ae5c9
--- /dev/null
+++ b/xslt/bluray-logo.png
Binary files differ
diff --git a/xslt/cassette-logo.png b/xslt/cassette-logo.png
new file mode 100644
index 0000000..ea88f46
--- /dev/null
+++ b/xslt/cassette-logo.png
Binary files differ
diff --git a/xslt/cd-logo.png b/xslt/cd-logo.png
new file mode 100644
index 0000000..c55d2e8
--- /dev/null
+++ b/xslt/cd-logo.png
Binary files differ
diff --git a/xslt/crossref2tellico.xsl b/xslt/crossref2tellico.xsl
new file mode 100644
index 0000000..17cddd3
--- /dev/null
+++ b/xslt/crossref2tellico.xsl
@@ -0,0 +1,121 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:cr="http://www.crossref.org/qrschema/2.0"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ exclude-result-prefixes="cr"
+ extension-element-prefixes="str exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing data from crossref.org
+
+ See http://www.crossref.org/schema/queryResultSchema/crossref_query_output2.0.7.xsd
+
+ Copyright (C) 2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="CrossRef Import" type="5">
+ <fields>
+ <field name="_default"/>
+
+ <xsl:if test=".//cr:issn">
+ <field flags="0" title="ISSN" category="Publishing" format="4" type="1" name="issn" i18n="true"/>
+ </xsl:if>
+
+ </fields>
+ <xsl:apply-templates select="cr:crossref_result/cr:query_result/cr:body/cr:query"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="cr:query">
+ <entry>
+
+ <title>
+ <xsl:value-of select="cr:article_title"/>
+ </title>
+
+ <booktitle>
+ <xsl:value-of select="cr:volume_title"/>
+ </booktitle>
+
+ <entry-type>
+ <xsl:choose>
+ <xsl:when test="cr:doi/@type = 'conference_paper'">
+ <xsl:text>inproceedings</xsl:text>
+ </xsl:when>
+ <xsl:when test="cr:doi/@type = 'book_title'">
+ <xsl:text>book</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>article</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </entry-type>
+
+ <year>
+ <xsl:value-of select="cr:year"/>
+ </year>
+
+ <doi>
+ <xsl:value-of select="cr:doi"/>
+ </doi>
+
+ <pages>
+ <xsl:value-of select="cr:first_page"/>
+ </pages>
+
+ <journal>
+ <xsl:value-of select="cr:journal_title"/>
+ </journal>
+
+ <volume>
+ <xsl:value-of select="cr:volume"/>
+ </volume>
+
+ <isbn>
+ <xsl:value-of select="cr:isbn"/>
+ </isbn>
+
+ <issn>
+ <xsl:choose>
+ <xsl:when test="cr:issn[@type='print']">
+ <xsl:value-of select="cr:issn[@type='print']"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="cr:issn[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </issn>
+
+ <authors>
+ <xsl:for-each select="cr:author">
+ <author>
+ <xsl:value-of select="."/>
+ </author>
+ </xsl:for-each>
+ </authors>
+
+ <series>
+ <xsl:value-of select="cr:series_title"/>
+ </series>
+
+ </entry>
+
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/delicious2tellico.xsl b/xslt/delicious2tellico.xsl
new file mode 100644
index 0000000..e185d58
--- /dev/null
+++ b/xslt/delicious2tellico.xsl
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing Delicious Library data.
+
+ Copyright (C) 2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tc:tellico syntaxVersion="10">
+ <tc:collection title="Delicious Library Import" type="2">
+ <tc:fields>
+ <tc:field name="_default"/>
+ <tc:field flags="0" title="Amazon Link" category="General" format="4" type="7" name="amazon" i18n="true"/>
+ <tc:field flags="0" title="UUID" category="General" format="0" type="1" name="uuid"/>
+ </tc:fields>
+ <xsl:for-each select="library/items/book">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </tc:collection>
+ </tc:tellico>
+</xsl:template>
+
+<xsl:template match="book">
+ <tc:entry>
+ <tc:uuid>
+ <xsl:value-of select="@uuid"/>
+ </tc:uuid>
+
+ <tc:amazon>
+ <xsl:if test="@asin">
+ <xsl:value-of select="concat('http://www.amazon.com/dp/',@asin,'/?tag=tellico-20')"/>
+ </xsl:if>
+ </tc:amazon>
+
+ <tc:title>
+ <xsl:choose>
+ <xsl:when test="contains(@title, ':')">
+ <xsl:value-of select="substring-before(@title,':')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@title"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tc:title>
+
+ <tc:subtitle>
+ <xsl:value-of select="substring-after(@title,':')"/>
+ </tc:subtitle>
+
+ <xsl:call-template name="split">
+ <xsl:with-param name="name" select="'tc:author'"/>
+ <xsl:with-param name="value" select="@author"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="split">
+ <xsl:with-param name="name" select="'tc:genre'"/>
+ <xsl:with-param name="value" select="@genre"/>
+ <xsl:with-param name="i18n" select="true()"/>
+ </xsl:call-template>
+
+ <tc:publisher>
+ <xsl:value-of select="@publisher"/>
+ </tc:publisher>
+
+ <tc:isbn>
+ <xsl:value-of select="@asin"/>
+ </tc:isbn>
+
+ <tc:binding i18n="true">
+ <xsl:choose>
+ <xsl:when test="contains(@aspect, 'Hardcover')">
+ <xsl:text>Hardback</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(@aspect, 'Paperback')">
+ <xsl:text>Paperback</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@aspect"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tc:binding>
+
+ <tc:pub_year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="@published"/>
+ </xsl:call-template>
+ </tc:pub_year>
+
+ <tc:pages>
+ <xsl:value-of select="@pages"/>
+ </tc:pages>
+
+ <tc:pur_price>
+ <xsl:value-of select="@price"/>
+ </tc:pur_price>
+
+ <tc:pur_date>
+ <xsl:value-of select="@purchaseDate"/>
+ </tc:pur_date>
+
+ <tc:rating>
+ <!-- tellico automatically rounds down -->
+ <xsl:value-of select="netrating"/>
+ </tc:rating>
+
+ <xsl:call-template name="split">
+ <xsl:with-param name="name" select="'tc:nationality'"/>
+ <xsl:with-param name="value" select="@country"/>
+ </xsl:call-template>
+
+ <tc:comments>
+ <!-- it gets cleaned up inside of Tellico -->
+ <xsl:value-of select="description"/>
+ </tc:comments>
+
+ </tc:entry>
+</xsl:template>
+
+<xsl:template name="split">
+ <xsl:param name="name"/>
+ <xsl:param name="value"/>
+ <xsl:param name="i18n" value="false()"/>
+
+ <xsl:element name="{concat($name,'s')}">
+ <xsl:for-each select="str:split($value, '&#10;')">
+ <xsl:element name="{$name}">
+
+ <xsl:if test="$i18n">
+ <xsl:attribute name="i18n">true</xsl:attribute>
+ </xsl:if>
+
+ <xsl:value-of select="."/>
+
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="year">
+ <xsl:param name="value"/>
+ <xsl:variable name="numbers">
+ <xsl:value-of select="translate($value, translate($value, '0123456789', ''), '')"/>
+ </xsl:variable>
+ <!-- assume that Amazon always encodes the date with the 4-digit year last -->
+ <xsl:value-of select="substring($numbers, string-length($numbers)-3, 4)"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/discogs2tellico.xsl b/xslt/discogs2tellico.xsl
new file mode 100644
index 0000000..3f5539e
--- /dev/null
+++ b/xslt/discogs2tellico.xsl
@@ -0,0 +1,206 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing Discogs release search data.
+
+ Copyright (C) 2008 Robby Stephenson [email protected]
+ Roman L. Senn - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="Discogs API" type="4"> <!-- 4 is music -->
+ <fields>
+ <field name="_default"/>
+ <!-- the importer will actually download the image and ignore this field -->
+ <field flags="0" title="Discogs ID" category="General" format="4" type="1" name="discogs-id"/>
+ <field flags="0" title="Discogs Link" category="General" format="4" type="7" name="discogs"/>
+ <field flags="7" title="Nationality" category="General" format="0" type="1" name="nationality" i18n="true"/>
+ <xsl:if test="contains(resp/release/extraartists/artist/role, 'Producer')">
+ <field flags="7" title="Producer" category="General" format="2" type="1" name="producer" i18n="true"/>
+ </xsl:if>
+
+ </fields>
+ <xsl:apply-templates select="/resp/searchresults/result[@type='release'] | resp/artist | resp/release"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="resp/searchresults/result">
+ <entry>
+ <title>
+ <xsl:value-of select="substring-after(title,' - ')"/>
+ </title>
+
+ <artists>
+ <artist>
+ <xsl:value-of select="substring-before(title,' - ')"/>
+ </artist>
+ </artists>
+
+ <labels>
+ <label>
+ <xsl:value-of select="substring-before(substring-after(normalize-space(summary),'Label: '),' Catalog#:')"/>
+ </label>
+ </labels>
+
+ <comments>
+ <xsl:value-of select="summary"/>
+ </comments>
+
+ <discogs>
+ <xsl:value-of select="uri"/>
+ </discogs>
+
+ <discogs-id>
+ <xsl:variable name="tokens" select="str:tokenize(uri, '/')"/>
+ <xsl:value-of select="$tokens[count($tokens)]"/>
+ </discogs-id>
+ </entry>
+</xsl:template>
+
+<xsl:template match="resp/artist">
+ <xsl:for-each select="releases/release">
+ <entry>
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+
+ <artists>
+ <artist>
+ <xsl:value-of select="../../name"/>
+ </artist>
+ </artists>
+
+ <labels>
+ <label>
+ <xsl:value-of select="label"/>
+ </label>
+ </labels>
+
+ <discogs-id>
+ <xsl:value-of select="@id"/>
+ </discogs-id>
+
+ </entry>
+ </xsl:for-each>
+
+</xsl:template>
+
+<xsl:template match="resp/release">
+ <entry>
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+
+ <artists>
+ <xsl:for-each select="artists/artist">
+ <artist>
+ <xsl:value-of select="."/>
+ </artist>
+ </xsl:for-each>
+ </artists>
+
+ <labels>
+ <xsl:for-each select="labels/label">
+ <label>
+ <xsl:value-of select="@name"/>
+ </label>
+ </xsl:for-each>
+ </labels>
+
+ <genres i18n="true">
+ <xsl:for-each select="genres/genre">
+ <genre>
+ <xsl:value-of select="."/>
+ </genre>
+ </xsl:for-each>
+ </genres>
+
+ <keywords i18n="true">
+ <xsl:for-each select="styles/style">
+ <keyword>
+ <xsl:value-of select="."/>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+
+ <discogs-id>
+ <xsl:value-of select="@id"/>
+ </discogs-id>
+
+ <comments>
+ <xsl:value-of select="notes"/>
+ </comments>
+
+ <medium i18n="true">
+ <xsl:variable name="medium" select="formats/format[1]/@name"/>
+ <xsl:choose>
+ <xsl:when test="$medium='CD'">
+ <xsl:text>Compact Disc</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$medium"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </medium>
+
+ <year>
+ <xsl:value-of select="substring(released,0,5)"/>
+ </year>
+
+ <tracks>
+ <xsl:for-each select="tracklist/track">
+ <xsl:sort select="position" data-type="number"/>
+ <track>
+ <column><xsl:value-of select="title"/></column>
+ <column><xsl:value-of select="../../artists/artist[1]"/></column>
+ <column><xsl:value-of select="duration"/></column>
+ </track>
+ </xsl:for-each>
+ </tracks>
+
+ <producers>
+ <xsl:for-each select="extraartists/artist[contains(role, 'Producer')]">
+ <producer>
+ <xsl:value-of select="name"/>
+ </producer>
+ </xsl:for-each>
+ </producers>
+
+ <nationalitys>
+ <nationality>
+ <xsl:value-of select="country"/>
+ </nationality>
+ </nationalitys>
+
+ <cover>
+ <xsl:for-each select="images/image">
+ <xsl:sort select="type"/> <!-- 'primary' before 'secondary' -->
+ <xsl:sort select="height*width" data-type="number" order="descending"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="@uri150"/><!-- I wish I could put a 'break' statement here -->
+ <!-- use small image -->
+ </xsl:if>
+ </xsl:for-each>
+ </cover>
+
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/dvd-logo.png b/xslt/dvd-logo.png
new file mode 100644
index 0000000..982b1b2
--- /dev/null
+++ b/xslt/dvd-logo.png
Binary files differ
diff --git a/xslt/entry-templates/Album.xsl b/xslt/entry-templates/Album.xsl
new file mode 100644
index 0000000..9b6e6f0
--- /dev/null
+++ b/xslt/entry-templates/Album.xsl
@@ -0,0 +1,497 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Entry template for videos
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ Known Issues:
+ o If there is more an one image, there's a lot of white space under
+ the top tables.
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+<xsl:param name="font"/> <!-- font family -->
+<xsl:param name="fontsize"/> <!-- font size -->
+<xsl:param name="fgcolor"/> <!-- foreground color -->
+<xsl:param name="bgcolor"/> <!-- background color -->
+<xsl:param name="color1"/> <!-- highlighted text color -->
+<xsl:param name="color2"/> <!-- highlighted background color -->
+
+<xsl:param name="collection-file"/> <!-- might have a link to parent collection -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="fieldsByCat" match="tc:field" use="@category"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- all the categories -->
+<xsl:variable name="categories" select="/tc:tellico/tc:collection/tc:fields/tc:field[generate-id(.)=generate-id(key('fieldsByCat',@category)[1])]/@category"/>
+<!-- all the tracks -->
+<xsl:variable name="tracks" select="/tc:tellico/tc:collection/tc:fields/tc:field[starts-with(@name,'track')]"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<!-- The default layout is pretty boring, but catches every field value in
+ the entry. The title is in the top H1 element. -->
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ margin: .2em 1%;
+ padding: 0;
+ font-family: "<xsl:value-of select="$font"/>", Arial, Helvetica, sans-serif;
+ font-size: <xsl:value-of select="$fontsize"/>pt;
+ background-color: <xsl:value-of select="$bgcolor"/>;
+ color: <xsl:value-of select="$fgcolor"/>;
+ line-height: 1.6;
+ }
+ #banner {
+ padding-bottom: .2em;
+ margin-bottom: .2em;
+ }
+ img#logo {
+ padding-top: .3em; /* match h1 */
+ }
+ h1 {
+ color: <xsl:value-of select="$color1"/>;
+ background-color: <xsl:value-of select="$color2"/>;
+ background-image: url(<xsl:value-of select="concat($imgdir, 'gradient_header.png')"/>);
+ background-repeat: repeat-x;
+ font-size: 1.8em;
+ text-align: left;
+ padding: .1em .5em;
+ margin: 0;
+ font-weight: bold;
+ }
+ span.title {
+ font-style: italic
+ }
+ img {
+ padding-right: 6px;
+ padding-bottom: 6px;
+ border: 0px;
+ }
+ table.category {
+ margin-bottom: 6px;
+ float: left;
+ }
+ tr.category {
+ font-weight: bold;
+ font-size: 1.2em;
+ color: #fff;
+ background-color: #666;
+ text-align: center;
+ }
+ th {
+ font-weight: bold;
+ text-align: left;
+ color: black;
+ background: #ccc;
+ }
+ td.fieldValue {
+ color: black;
+ background: #ddd;
+ }
+ th, td.fieldValue {
+ padding: .1em .3em;
+ }
+ p {
+ margin-top: 0px;
+ text-align: justify;
+ }
+ img {
+ border: 0px solid;
+ }
+ <!-- since text is our own color, links have to be, too -->
+ a {
+ color: #006;
+ }
+ p.navigation {
+ font-weight: bold;
+ text-align: center;
+ clear: both;
+ }
+ </style>
+ <title>
+ <xsl:value-of select="tc:collection/tc:entry[1]//tc:title[1]"/>
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ <xsl:value-of select="tc:collection/@title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection[1]"/>
+ <xsl:if test="$collection-file">
+ <p class="navigation">
+ <a href="{$collection-file}">&lt;&lt; <xsl:value-of select="tc:collection/@title"/></a>
+ </p>
+ </xsl:if>
+ </body>
+ </html>
+</xsl:template>
+
+<!-- type 3 is video collections -->
+<!-- warn user that this template is meant for videos only. -->
+<xsl:template match="tc:collection[@type!=4]">
+ <h1><i18n>This template is meant for music collections only.</i18n></h1>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type=4]">
+ <xsl:apply-templates select="tc:entry[1]"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+ <xsl:variable name="titleCat" select="key('fieldsByName','title')/@category"/>
+
+ <!-- the top table has images in the left cell and main fields in the right.
+ 2 images can be on the left -->
+ <table width="100%" class="category">
+ <tr>
+ <!-- now, show all the images in the entry, type 10 -->
+ <xsl:variable name="images" select="../tc:fields/tc:field[@type=10]"/>
+ <!-- only insert cell if at least one image -->
+ <xsl:if test="$entry/*[local-name(.) = $images[1]/@name]">
+ <td valign="top" rowspan="2">
+ <xsl:for-each select="$images">
+
+ <!-- images will never be multiple, so no need to check for that -->
+ <!-- find the value of the image field in the entry -->
+ <xsl:variable name="image" select="$entry/*[local-name(.) = current()/@name]"/>
+ <!-- check if the value is not empty -->
+ <xsl:if test="$image">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <!-- Amazon license requires the image to be linked to the amazon website -->
+ <xsl:when test="$entry/tc:amazon">
+ <xsl:value-of select="$entry/tc:amazon"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <img alt="">
+ <xsl:attribute name="src">
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- limit to maximum width of 150 and height of 200 -->
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="150"/>
+ <xsl:with-param name="limit-height" select="200"/>
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ </xsl:call-template>
+ </img>
+ </a>
+ </xsl:if>
+ </xsl:for-each>
+ </td>
+ </xsl:if>
+
+ <!-- want all the width we can get -->
+ <td valign="top">
+ <!-- now a nested table with the general fields -->
+ <div id="banner">
+
+ <h1>
+ <xsl:choose>
+ <xsl:when test="count(.//tc:artist) = 1">
+ <xsl:value-of select=".//tc:artist[1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <i18n>(Various)</i18n>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ <span class="title">
+ <xsl:value-of select=".//tc:title[1]"/>
+ </span>
+
+ <!-- Tellico 0.8 had multiple years in the default video collection -->
+ <xsl:if test=".//tc:year">
+ <span class="year">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select=".//tc:year[1]"/>
+ <xsl:text>)</xsl:text>
+ </span>
+ </xsl:if>
+
+ </h1>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+
+ <table width="100%">
+ <xsl:for-each select="key('fieldsByCat', $titleCat)">
+ <xsl:if test="@name != 'title'">
+ <tr>
+ <th>
+ <xsl:value-of select="@title"/>
+ </th>
+ <td class="fieldValue" width="100%">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </table>
+
+ </td>
+ </tr>
+ </table>
+
+ <!-- doo all the track fields first -->
+ <xsl:variable name="artist" select="tc:artists/tc:artist[1]"/>
+ <xsl:for-each select="$tracks">
+ <xsl:variable name="fieldName" select="current()/@name"/>
+ <xsl:call-template name="trackField">
+ <xsl:with-param name="values" select="$entry/*[local-name()=concat($fieldName,'s')]"/>
+ <xsl:with-param name="name" select="$fieldName"/>
+ <xsl:with-param name="artist" select="$artist"/>
+ </xsl:call-template>
+ <!-- special case for tracks, since they're usually long tables.
+ clear after every 2nd table -->
+ <xsl:if test="position() mod 2 = 0">
+ <br style="clear:left" />
+ </xsl:if>
+ </xsl:for-each>
+
+ <!-- now for every thing else -->
+ <!-- write categories other than general and images -->
+ <xsl:for-each select="$categories[. != $titleCat and
+ not(starts-with(key('fieldsByCat',.)[1]/@name,'track')) and
+ key('fieldsByCat',.)[1]/@type != 10]">
+
+ <xsl:variable name="category" select="."/>
+ <xsl:variable name="fields" select="key('fieldsByCat', $category)"/>
+ <xsl:variable name="first-type" select="$fields[1]/@type"/>
+
+ <xsl:variable name="n" select="count($entry//*[key('fieldsByName',local-name(.))/@category=$category])"/>
+
+ <!-- only output if there are field values in this category -->
+ <xsl:if test="$n &gt; 0">
+ <table width="50%" class="category">
+ <tr class="category">
+ <td colspan="2">
+ <xsl:attribute name="colspan">
+ <xsl:if test="$first-type = 2">1</xsl:if>
+ <xsl:if test="not($first-type = 2)">2</xsl:if>
+ </xsl:attribute>
+ <xsl:value-of select="."/>
+ </td>
+ </tr>
+ <xsl:for-each select="$fields">
+ <xsl:if test="$entry//*[local-name(.)=current()/@name]">
+ <tr>
+ <xsl:choose>
+ <!-- paragraphs -->
+ <xsl:when test="@type = 2">
+ <td class="fieldValue" width="100%">
+ <p>
+ <xsl:value-of select="$entry/*[local-name(.)=current()/@name]" disable-output-escaping="yes"/>
+ </p>
+ </td>
+ </xsl:when>
+
+ <!-- tables are field type 8 -->
+ <!-- ok to put category name inside div instead of table here -->
+ <xsl:when test="@type = 8">
+ <td>
+ <!-- look at number of columns -->
+ <xsl:choose>
+ <xsl:when test="tc:prop[@name = 'columns'] &gt; 1">
+ <table>
+ <xsl:if test="tc:prop[@name = 'column1']">
+ <thead>
+ <tr>
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="max" select="tc:prop[@name = 'columns']"/>
+ <xsl:with-param name="elem" select="'th'"/>
+ <xsl:with-param name="field" select="."/>
+ </xsl:call-template>
+ </tr>
+ </thead>
+ </xsl:if>
+ <tbody>
+ <xsl:for-each select="$entry//*[local-name(.) = current()/@name]">
+ <tr>
+ <xsl:for-each select="tc:column">
+ <td>
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <ul>
+ <xsl:for-each select="$entry//*[local-name(.) = current()/@name]">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:when>
+
+ <!-- everything else -->
+ <xsl:otherwise>
+ <th>
+ <xsl:value-of select="@title"/>
+ </th>
+ <td class="fieldValue" width="100%">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </table>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="trackField">
+ <xsl:param name="values"/>
+ <xsl:param name="name"/>
+ <xsl:param name="artist"/>
+ <xsl:variable name="field" select="key('fieldsByName', $name)"/>
+ <table width="50%" class="category">
+ <xsl:variable name="cols" select="count($values/*[1]/tc:column)"/>
+
+ <tr class="category">
+ <td colspan="{$cols}">
+ <xsl:value-of select="$field/@category"/>
+ </td>
+ </tr>
+ <xsl:if test="$field/tc:prop[@name = 'column1']">
+ <tr>
+ <th colspan="2" style="text-align:center">
+ <xsl:value-of select="$field/tc:prop[@name = 'column1']"/>
+ <xsl:if test="not($values/*[1]/tc:column[2] = $artist)">
+ <xsl:text> / </xsl:text>
+ <em><xsl:value-of select="$field/tc:prop[@name = 'column2']"/></em>
+ </xsl:if>
+ </th>
+ <th style="text-align:center">
+ <xsl:value-of select="$field/tc:prop[@name = 'column3']"/>
+ </th>
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="4"/>
+ <xsl:with-param name="max" select="$cols"/>
+ <xsl:with-param name="elem" select="'th'"/>
+ <xsl:with-param name="field" select="$field"/>
+ </xsl:call-template>
+
+ </tr>
+ </xsl:if>
+
+ <xsl:for-each select="$values/*">
+ <tr>
+ <th style="text-align:center">
+ <xsl:value-of select="format-number(position(), '00')"/>
+ </th>
+ <xsl:choose>
+ <!-- a three column table could have an empty third column -->
+ <xsl:when test="$cols &gt; 1">
+ <!-- if it has three columns, assume first is title,
+ second is artist and third is track length. -->
+ <td class="fieldValue">
+ <xsl:if test="string-length(tc:column[1])">
+ <xsl:value-of select="tc:column[1]"/>
+ </xsl:if>
+ <xsl:if test="string-length(tc:column[2]) and not(tc:column[2] = $artist)">
+ <xsl:text> / </xsl:text>
+ <em><xsl:value-of select="tc:column[2]"/></em>
+ </xsl:if>
+ </td>
+ <td class="fieldValue" style="text-align: right; padding-right: 10px">
+ <em><xsl:value-of select="tc:column[3]"/></em>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td class="fieldValue">
+ <xsl:value-of select="."/>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ </xsl:for-each>
+
+ <!-- if it has multiple columns,
+ and the final one has a ':', add the time together -->
+ <!-- it should still work if the first row itself doesn't contain a ':' -->
+ <xsl:if test="$cols &gt; 1 and
+ count($values/*[contains(tc:column[number($cols)], ':')])">
+ <tr>
+ <th colspan="2" style="text-align: right; padding-right: 10px;">
+ <strong><i18n>Total:</i18n> </strong>
+ </th>
+ <td class="fieldValue" style="text-align: right; padding-right: 10px">
+ <em>
+ <xsl:call-template name="sumTime">
+ <xsl:with-param name="nodes" select="$values//tc:column[number($cols)]"/>
+ </xsl:call-template>
+ </em>
+ </td>
+ </tr>
+ </xsl:if>
+ </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/entry-templates/Compact.xsl b/xslt/entry-templates/Compact.xsl
new file mode 100644
index 0000000..f523d68
--- /dev/null
+++ b/xslt/entry-templates/Compact.xsl
@@ -0,0 +1,294 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - compact template for viewing entry data
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ The drop-shadow effect is based on the "A List Apart" method
+ at http://www.alistapart.com/articles/cssdropshadows/
+
+ Known Issues:
+ o Dependent titles have no value in the entry element.
+ o Bool and URL fields are assumed to never have multiple values.
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+<xsl:param name="font"/> <!-- font family -->
+<xsl:param name="fontsize"/> <!-- font size -->
+<xsl:param name="fgcolor"/> <!-- foreground color -->
+<xsl:param name="bgcolor"/> <!-- background color -->
+
+<xsl:param name="collection-file"/> <!-- might have a link to parent collection -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<!-- The default layout is pretty boring, but catches every field value in
+ the entry. The title is in the top H1 element. -->
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ margin: 0px;
+ padding: 0px;
+ font-family: <xsl:value-of select="$font"/>;
+ font-size: <xsl:value-of select="$fontsize"/>pt;
+ color: <xsl:value-of select="$fgcolor"/>;
+ background-color: <xsl:value-of select="$bgcolor"/>;
+ }
+ #content {
+ padding-right: 160px;
+ }
+ #images {
+ margin: 6px 5px 0px 5px;
+ float: right;
+ min-width: 150px;
+ }
+ div.img-shadow {
+ float: left;
+ background: url(<xsl:value-of select="concat($datadir,'shadowAlpha.png')"/>) no-repeat bottom right;
+ margin: 10px 0 0 10px;
+ }
+ div.img-shadow img {
+ display: block;
+ position: relative;
+ border: 1px solid #a9a9a9;
+ margin: -6px 6px 6px -6px;
+ }
+ table {
+ border-collapse: collapse;
+ border-spacing: 0px;
+ }
+ th.fieldName {
+ font-weight: bold;
+ text-align: left;
+ padding: 0px 4px 0px 2px;
+ white-space: nowrap;
+ }
+ td.fieldValue {
+ text-align: left;
+ padding: 0px 10px 0px 2px;
+ }
+ td.column1 {
+ text-align: left;
+ padding: 0px;
+ }
+ td.column2 {
+ font-style: italic;
+ text-align: left;
+ padding: 0px 10px;
+ }
+ p {
+ margin-top: 0px;
+ text-align: left;
+ }
+ ul {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px 0px 0px 20px;
+ }
+ img {
+ border: 0px;
+ }
+ p.navigation {
+ font-weight: bold;
+ text-align: center;
+ clear: both;
+ }
+ </style>
+ <title>
+ <xsl:value-of select="tc:collection/tc:entry[1]//tc:title[1]"/>
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ <xsl:value-of select="tc:collection/@title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection[1]"/>
+ <xsl:if test="$collection-file">
+ <p class="navigation">
+ <a href="{$collection-file}">&lt;&lt; <xsl:value-of select="tc:collection/@title"/></a>
+ </p>
+ </xsl:if>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <xsl:apply-templates select="tc:entry[1]"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+
+ <!-- all the images are in a div, aligned to the right side and floated-->
+ <div id="images">
+ <!-- images are field type 10 -->
+ <xsl:for-each select="../tc:fields/tc:field[@type=10]">
+
+ <!-- find the value of the image field in the entry -->
+ <xsl:variable name="image" select="$entry/*[local-name(.) = current()/@name]"/>
+ <!-- check if the value is not empty -->
+ <xsl:if test="$image">
+ <div class="img-shadow">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <!-- Amazon license requires the image to be linked to the amazon website -->
+ <xsl:when test="$entry/tc:amazon">
+ <xsl:value-of select="$entry/tc:amazon"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <img alt="">
+ <xsl:attribute name="src">
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- limit to maximum width of 150 and height of 200 -->
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="150"/>
+ <xsl:with-param name="limit-height" select="200"/>
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ </xsl:call-template>
+ </img>
+ </a>
+ </div>
+ <br/> <!-- needed since the img-shadow block floats -->
+ </xsl:if>
+ </xsl:for-each>
+ </div>
+
+ <!-- all the data is in the content block -->
+ <div id="content">
+
+ <!-- now for all the rest of the data -->
+ <!-- iterate over the categories, but skip images -->
+ <table>
+ <tbody>
+ <xsl:for-each select="../tc:fields/tc:field[@type!=10]">
+ <xsl:variable name="field" select="."/>
+
+ <xsl:if test="$entry//*[local-name(.) = $field/@name]">
+ <tr>
+ <th class="fieldName" valign="top">
+ <xsl:value-of select="@title"/>
+ <xsl:text>:</xsl:text>
+ </th>
+
+ <td class="fieldValue">
+ <!-- ok, big xsl:choose loop for field type -->
+ <xsl:choose>
+
+ <!-- paragraphs are field type 2 -->
+ <xsl:when test="@type = 2">
+ <p>
+ <xsl:value-of select="$entry/*[local-name(.) = $field/@name]" disable-output-escaping="yes"/>
+ </p>
+ </xsl:when>
+
+ <!-- tables are field type 8 -->
+ <!-- ok to put category name inside div instead of table here -->
+ <xsl:when test="@type = 8">
+ <!-- look at number of columns -->
+ <xsl:choose>
+ <xsl:when test="$field/tc:prop[@name = 'columns'] &gt; 1">
+ <table>
+ <tbody>
+ <xsl:for-each select="$entry//*[local-name(.) = $field/@name]">
+ <tr>
+ <xsl:for-each select="tc:column">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <td class="column1">
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td class="column2">
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <ul>
+ <xsl:for-each select="$entry//*[local-name(.) = $field/@name]">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$field/@name"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </div>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/entry-templates/Default.xsl b/xslt/entry-templates/Default.xsl
new file mode 100644
index 0000000..fcd01fd
--- /dev/null
+++ b/xslt/entry-templates/Default.xsl
@@ -0,0 +1,346 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - classic template for viewing entry data
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ Known Issues:
+ o Dependent titles have no value in the entry element.
+ o Bool and URL fields are assumed to never have multiple values.
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+<xsl:param name="font"/> <!-- font family -->
+<xsl:param name="fontsize"/> <!-- font size -->
+<xsl:param name="fgcolor"/> <!-- foreground color -->
+<xsl:param name="bgcolor"/> <!-- background color -->
+<xsl:param name="color1"/> <!-- highlighted text color -->
+<xsl:param name="color2"/> <!-- highlighted background color -->
+
+<xsl:param name="collection-file"/> <!-- might have a link to parent collection -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="fieldsByCat" match="tc:field" use="@category"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- all the categories -->
+<xsl:variable name="categories" select="/tc:tellico/tc:collection/tc:fields/tc:field[generate-id(.)=generate-id(key('fieldsByCat',@category)[1])]/@category"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<!-- The default layout is pretty boring, but catches every field value in
+ the entry. The title is in the top H1 element. -->
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ margin: 4px;
+ padding: 0px;
+ font-family: "<xsl:value-of select="$font"/>";
+ font-size: <xsl:value-of select="$fontsize"/>pt;
+ color: <xsl:value-of select="$fgcolor"/>;
+ background-color: <xsl:value-of select="$bgcolor"/>;
+ }
+ h1.title {
+ font-size: 1.8em;
+ padding: 0px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ margin: 0px;
+ text-align: center;
+ font-weight: bold;
+ }
+ img {
+ padding-right: 10px;
+ border: 0px;
+ }
+ table.category {
+ margin-bottom: 1em;
+ float: left;
+ }
+ tr.category {
+ font-weight: bold;
+ font-size: 1.2em;
+ color: <xsl:value-of select="$color1"/>;
+ background-color: <xsl:value-of select="$color2"/>;
+ text-align: center;
+ }
+ th {
+ font-weight: bold;
+ text-align: left;
+ color: #fff;
+ background-color: #666;
+ padding-left: 3px;
+ padding-right: 3px;
+ }
+ td {
+ padding: 0 .2em;
+ }
+ p {
+ margin-top: 0px;
+ text-align: justify;
+ }
+ img {
+ border: 0px solid;
+ }
+ p.navigation {
+ clear: both;
+ font-weight: bold;
+ text-align: center;
+ clear: both;
+ }
+ </style>
+ <title>
+ <xsl:value-of select="tc:collection/tc:entry[1]//tc:title[1]"/>
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ <xsl:value-of select="tc:collection/@title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection[1]"/>
+ <xsl:if test="$collection-file">
+ <p class="navigation">
+ <a href="{$collection-file}">&lt;&lt; <xsl:value-of select="tc:collection/@title"/></a>
+ </p>
+ </xsl:if>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <xsl:apply-templates select="tc:entry[1]"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+
+ <!-- first, show the title -->
+ <xsl:if test=".//tc:title">
+ <h1>
+ <xsl:for-each select=".//tc:title">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() &lt; last()">
+ <br/>
+ </xsl:if>
+ </xsl:for-each>
+ </h1>
+ </xsl:if>
+
+ <!-- put the general category and all images in top table, one cell for each -->
+ <xsl:variable name="cat1" select="key('fieldsByName','title')/@category"/>
+ <table width="100%">
+ <tr>
+ <td valign="top">
+ <!-- show the general group, or more accurately, the title's group -->
+ <table class="category" width="100%">
+ <tr class="category">
+ <td colspan="2">
+ <xsl:value-of select="$cat1"/>
+ </td>
+ </tr>
+ <xsl:for-each select="key('fieldsByCat', $cat1)">
+ <xsl:if test="@name!='title'">
+ <tr>
+ <th>
+ <xsl:value-of select="@title"/>
+ </th>
+ <td width="75%">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </table>
+ </td>
+ <!-- now, show all the images in the entry, type 10 -->
+ <xsl:variable name="images" select="../tc:fields/tc:field[@type=10]"/>
+ <xsl:if test="count($images) &gt; 0">
+ <!-- now, show all the images in the entry, type 10 -->
+ <xsl:for-each select="$images">
+
+ <!-- images will never be multiple, so no need to check for that -->
+ <!-- find the value of the image field in the entry -->
+ <xsl:variable name="image" select="$entry/*[local-name(.) = current()/@name]"/>
+ <!-- check if the value is not empty -->
+ <xsl:if test="$image">
+ <td valign="top">
+ <table class="category">
+ <tr class="category">
+ <td>
+ <xsl:value-of select="current()/@title"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <!-- Amazon license requires the image to be linked to the amazon website -->
+ <xsl:when test="$entry/tc:amazon">
+ <xsl:value-of select="$entry/tc:amazon"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <img alt="">
+ <xsl:attribute name="src">
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- limit to maximum width of 150 of height of 200 -->
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="150"/>
+ <xsl:with-param name="limit-height" select="200"/>
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ </xsl:call-template>
+ </img>
+ </a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </tr>
+ </table>
+
+ <!-- write categories other than general and images -->
+ <xsl:for-each select="$categories[. != $cat1 and
+ key('fieldsByCat',.)[1]/@type!=10]">
+ <table width="50%" class="category">
+ <tr class="category">
+ <td colspan="2">
+ <xsl:value-of select="."/>
+ </td>
+ </tr>
+ <xsl:for-each select="key('fieldsByCat', .)">
+ <tr>
+ <xsl:choose>
+ <!-- paragraphs -->
+ <xsl:when test="@type = 2">
+ <td>
+ <p>
+ <xsl:value-of select="$entry/*[local-name(.)=current()/@name]" disable-output-escaping="yes"/>
+ </p>
+ </td>
+ </xsl:when>
+
+ <!-- tables are field type 8 -->
+ <!-- ok to put category name inside div instead of table here -->
+ <xsl:when test="@type = 8">
+ <td>
+ <!-- look at number of columns -->
+ <xsl:choose>
+ <xsl:when test="tc:prop[@name = 'columns'] &gt; 1">
+ <table width="100%">
+ <xsl:if test="tc:prop[@name = 'column1']">
+ <thead>
+ <tr>
+ <th width="50%">
+ <xsl:value-of select="tc:prop[@name = 'column1']"/>
+ </th>
+ <th width="50%">
+ <xsl:value-of select="tc:prop[@name = 'column2']"/>
+ </th>
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="3"/>
+ <xsl:with-param name="max" select="tc:prop[@name = 'columns']"/>
+ <xsl:with-param name="elem" select="'th'"/>
+ <xsl:with-param name="field" select="."/>
+ </xsl:call-template>
+ </tr>
+ </thead>
+ </xsl:if>
+ <tbody>
+ <xsl:for-each select="$entry//*[local-name(.) = current()/@name]">
+ <tr>
+ <xsl:for-each select="tc:column">
+ <td width="{floor(100 div count(../tc:column))}%">
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <ul>
+ <xsl:for-each select="$entry//*[local-name(.) = current()/@name]">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:when>
+
+ <!-- everything else -->
+ <xsl:otherwise>
+ <th>
+ <xsl:value-of select="@title"/>
+ </th>
+ <td>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/entry-templates/Fancy.xsl b/xslt/entry-templates/Fancy.xsl
new file mode 100644
index 0000000..875309f
--- /dev/null
+++ b/xslt/entry-templates/Fancy.xsl
@@ -0,0 +1,444 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - fancy template for viewing entry data
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ The drop-shadow effect is based on the "A List Apart" method
+ at http://www.alistapart.com/articles/cssdropshadows/
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+<xsl:param name="font"/> <!-- font family -->
+<xsl:param name="fontsize"/> <!-- font size -->
+<xsl:param name="fgcolor"/> <!-- foreground color -->
+<xsl:param name="bgcolor"/> <!-- background color -->
+<xsl:param name="color1"/> <!-- highlighted text color -->
+<xsl:param name="color2"/> <!-- highlighted background color -->
+
+<xsl:param name="collection-file"/> <!-- might have a link to parent collection -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="fieldsByCat" match="tc:field" use="@category"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:variable name="image-width" select="'150'"/>
+<xsl:variable name="image-height" select="'200'"/>
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- all the categories -->
+<xsl:variable name="categories" select="/tc:tellico/tc:collection/tc:fields/tc:field[generate-id(.)=generate-id(key('fieldsByCat',@category)[1])]/@category"/>
+<!-- layout changes depending on whether there are images or not -->
+<xsl:variable name="num-images" select="count(tc:tellico/tc:collection/tc:entry[1]/*[key('fieldsByName',local-name(.))/@type = 10])"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<!-- The default layout is pretty boring, but catches every field value in
+ the entry. The title is in the top H1 element. -->
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ margin: 0px;
+ padding: 0px;
+ font-family: "<xsl:value-of select="$font"/>";
+ font-size: <xsl:value-of select="$fontsize"/>pt;
+ color: <xsl:value-of select="$fgcolor"/>;
+ background-color: <xsl:value-of select="$bgcolor"/>;
+ background-image: url(<xsl:value-of select="concat($imgdir, 'gradient_bg.png')"/>);
+ background-repeat: repeat;
+ }
+ h1 {
+ margin: 0px;
+ padding: 0px;
+ font-size: 1.8em;
+ color: <xsl:value-of select="$color1"/>;
+ background-color: <xsl:value-of select="$color2"/>;
+ background-image: url(<xsl:value-of select="concat($imgdir, 'gradient_header.png')"/>);
+ background-repeat: repeat-x;
+ border-bottom: 1px outset black;
+ text-align: center;
+ }
+ <xsl:if test="$num-images &gt; 0">
+ div#images {
+ margin: 10px 5px 0px 5px;
+ float: right;
+ min-width: <xsl:value-of select="$image-width"/>px; /* min-width instead of width, stylesheet actually scales image */
+ }
+ </xsl:if>
+ div.img-shadow {
+ float: left;
+ background: url(<xsl:value-of select="concat($datadir,'shadowAlpha.png')"/>) no-repeat bottom right;
+ margin: 6px 0 10px 10px;
+ clear: left;
+ }
+ div.img-shadow img {
+ display: block;
+ position: relative;
+ border: 1px solid #a9a9a9;
+ margin: -6px 6px 6px -6px;
+ }
+ h3 {
+ text-align: center;
+ font-size: 1.1em;
+ }
+ div#content {
+ padding-left: 1%;
+ padding-right: 1%;
+ }
+ div.category {
+ padding: 0px 0px 0px 4px;
+ margin: 8px;
+ border: 1px solid <xsl:value-of select="$fgcolor"/>;
+ text-align: center;
+ /* if background is grey, text has to be black */
+ color: #000;
+ background-color: #ccc;
+ min-height: 1em;
+ overflow: hidden;
+ }
+ h2 {
+ color: <xsl:value-of select="$color1"/>;
+ background-color: <xsl:value-of select="$color2"/>;
+ background-image: url(<xsl:value-of select="concat($imgdir, 'gradient_header.png')"/>);
+ background-repeat: repeat-x;
+ border-bottom: 1px outset;
+ border-color: <xsl:value-of select="$fgcolor"/>;
+ padding: 0px 8px 0px 0px;
+ margin: 0px 0px 2px -4px; /* -4px to match .category padding */
+ font-size: 1.0em;
+ top: -1px;
+ font-style: normal;
+ text-align: right;
+ }
+ table {
+ border-collapse: collapse;
+ border-spacing: 0px;
+ max-width: 100%;
+ }
+ tr.table-columns {
+ font-style: italic;
+ }
+ th.fieldName {
+ font-weight: bolder;
+ text-align: left;
+ padding: 0px 4px 0px 2px;
+ white-space: nowrap;
+ }
+ td.fieldValue {
+ text-align: left;
+ padding: 0px 10px 0px 2px;
+ vertical-align: top;
+ width: 90%; /* nowrap is set on the fieldName column, so just want enough width to take the rest */
+ }
+ td.column1 {
+ font-weight: bold;
+ text-align: left;
+ padding: 0px 2px 0px 2px;
+/* white-space: nowrap;*/
+ }
+ td.column2 {
+ font-style: italic;
+ text-align: left;
+ padding: 0px 10px 0px 10px;
+/* width: 90%; nowrap is set on the fieldName column, so just want enough width to take the rest */
+ }
+ p {
+ margin: 2px 10px 2px 0;
+ padding: 0px;
+ text-align: justify;
+ font-size: 90%;
+ }
+ ul {
+ text-align: left;
+ margin: 0px 0px 0px 0px;
+ padding-left: 20px;
+ }
+ img {
+ border: 0px;
+ }
+ p.navigation {
+ font-weight: bold;
+ text-align: center;
+ clear: both;
+ }
+ </style>
+ <title>
+ <xsl:value-of select="tc:collection[1]/tc:entry[1]//tc:title[1]"/>
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ <xsl:value-of select="tc:collection[1]/@title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection[1]"/>
+ <xsl:if test="$collection-file">
+ <p class="navigation">
+ <a href="{$collection-file}">&lt;&lt; <xsl:value-of select="tc:collection/@title"/></a>
+ </p>
+ </xsl:if>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <xsl:apply-templates select="tc:entry[1]"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+
+ <!-- first, show the title -->
+ <xsl:if test=".//tc:title">
+ <h1>
+ <xsl:for-each select=".//tc:title">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() &lt; last()">
+ <br/>
+ </xsl:if>
+ </xsl:for-each>
+ </h1>
+ </xsl:if>
+
+ <!-- all the images are in a div, aligned to the right side and floated -->
+ <!-- only want this div if there are any images in the entry -->
+ <xsl:if test="$num-images &gt; 0">
+ <div id="images">
+ <!-- images are field type 10 -->
+ <xsl:for-each select="../tc:fields/tc:field[@type=10]">
+
+ <!-- find the value of the image field in the entry -->
+ <xsl:variable name="image" select="$entry/*[local-name(.) = current()/@name]"/>
+ <!-- check if the value is not empty -->
+ <xsl:if test="$image">
+ <div class="img-shadow">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <!-- Amazon license requires the image to be linked to the amazon website -->
+ <xsl:when test="$entry/tc:amazon">
+ <xsl:value-of select="$entry/tc:amazon"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <img alt="" style="vertical-align:bottom;">
+ <xsl:attribute name="src">
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- limit to maximum width of 150 and height of 200 -->
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ </xsl:call-template>
+ </img>
+ </a>
+ </div>
+ <br/> <!-- needed since the img-shadow block floats -->
+ </xsl:if>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+
+ <!-- all the data is in the content block -->
+ <div id="content">
+ <!-- now for all the rest of the data -->
+ <!-- iterate over the categories, but skip paragraphs and images -->
+ <xsl:for-each select="$categories[key('fieldsByCat',.)[1]/@type != 2 and key('fieldsByCat',.)[1]/@type != 10]">
+ <xsl:call-template name="output-category">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="category" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <!-- now do paragraphs -->
+ <xsl:for-each select="$categories[key('fieldsByCat',.)[1]/@type = 2]">
+ <xsl:call-template name="output-category">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="category" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+
+ </div>
+
+</xsl:template>
+
+<xsl:template name="output-category">
+ <xsl:param name="entry"/>
+ <xsl:param name="category"/>
+
+ <xsl:variable name="fields" select="key('fieldsByCat', $category)"/>
+ <xsl:variable name="first-type" select="$fields[1]/@type"/>
+
+ <xsl:variable name="n" select="count($entry//*[key('fieldsByName',local-name(.))/@category=$category])"/>
+ <!-- only output if there are fields in this category
+ also, special case, don't output empty paragraphs -->
+ <xsl:if test="$n &gt; 0 and (not($first-type = 2) or $entry/*[local-name(.) = $fields[1]/@name])">
+ <div class="container">
+ <xsl:if test="$num-images = 0 and $first-type != 2">
+ <xsl:attribute name="style">
+ <xsl:text>width: 50%; </xsl:text>
+ <!-- two columns of divs -->
+ <xsl:choose>
+ <xsl:when test="$categories[. = $category and position() mod 2 = 1]">
+ <xsl:text>float: left; clear: both;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>float: right;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$num-images = 0 and $first-type = 2">
+ <xsl:attribute name="style">
+ <xsl:text>width: 100%; float: left; clear: both;</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <div class="category">
+
+ <h2>
+ <xsl:value-of select="$category"/>
+ </h2>
+ <!-- ok, big xsl:choose loop for field type -->
+ <xsl:choose>
+
+ <!-- paragraphs are field type 2 -->
+ <xsl:when test="$first-type = 2">
+ <p>
+ <!-- disabling the output escaping allows html -->
+ <xsl:value-of select="$entry/*[local-name(.) = $fields[1]/@name]" disable-output-escaping="yes"/>
+ </p>
+ </xsl:when>
+
+ <!-- tables are field type 8 -->
+ <!-- ok to put category name inside div instead of table here -->
+ <xsl:when test="$first-type = 8">
+ <!-- look at number of columns -->
+ <xsl:choose>
+ <xsl:when test="$fields[1]/tc:prop[@name = 'columns'] &gt; 1">
+ <table width="100%">
+ <xsl:if test="$fields[1]/tc:prop[@name = 'column1']">
+ <thead>
+ <tr class="table-columns">
+ <th width="50%">
+ <xsl:value-of select="$fields[1]/tc:prop[@name = 'column1']"/>
+ </th>
+ <th width="50%">
+ <xsl:value-of select="$fields[1]/tc:prop[@name = 'column2']"/>
+ </th>
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="3"/>
+ <xsl:with-param name="max" select="$fields[1]/tc:prop[@name = 'columns']"/>
+ <xsl:with-param name="elem" select="'th'"/>
+ <xsl:with-param name="field" select="$fields[1]"/>
+ </xsl:call-template>
+ </tr>
+ </thead>
+ </xsl:if>
+ <tbody>
+ <xsl:for-each select="$entry//*[local-name(.) = $fields[1]/@name]">
+ <tr>
+ <xsl:for-each select="tc:column">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <td class="column1">
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td class="column2">
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <ul>
+ <xsl:for-each select="$entry//*[local-name(.) = $fields[1]/@name]">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <table>
+ <tbody>
+ <!-- already used title, so skip it -->
+ <xsl:for-each select="$fields[@name != 'title']">
+ <tr>
+ <th class="fieldName" valign="top">
+ <xsl:value-of select="@title"/>
+ <xsl:text>:</xsl:text>
+ </th>
+ <td class="fieldValue">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </div>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/entry-templates/Makefile.am b/xslt/entry-templates/Makefile.am
new file mode 100644
index 0000000..5b1b875
--- /dev/null
+++ b/xslt/entry-templates/Makefile.am
@@ -0,0 +1,17 @@
+####### kdevelop will overwrite this part!!! (begin)##########
+
+
+EXTRA_DIST = Default.xsl Video.xsl Album.xsl Fancy.xsl Compact.xsl
+
+####### kdevelop will overwrite this part!!! (end)############
+
+xsldir = $(kde_datadir)/tellico/entry-templates
+xsl_DATA = Default.xsl Video.xsl Album.xsl Fancy.xsl Compact.xsl
+
+KDE_OPTIONS = noautodist
+
+CLEANFILES = *~
+
+# probably a better way to do this
+uninstall-hook:
+ -if [ -d $(xsldir) ]; then rmdir $(xsldir); fi
diff --git a/xslt/entry-templates/Video.xsl b/xslt/entry-templates/Video.xsl
new file mode 100644
index 0000000..c74e88e
--- /dev/null
+++ b/xslt/entry-templates/Video.xsl
@@ -0,0 +1,512 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Entry template for videos
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ Known Issues:
+ o If there is more an one image, there's a lot of white space under
+ the top tables.
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+<xsl:param name="font"/> <!-- font family -->
+<xsl:param name="fontsize"/> <!-- font size -->
+<xsl:param name="fgcolor"/> <!-- foreground color -->
+<xsl:param name="bgcolor"/> <!-- background color -->
+<xsl:param name="color1"/> <!-- highlighted text color -->
+<xsl:param name="color2"/> <!-- highlighted background color -->
+
+<xsl:param name="collection-file"/> <!-- might have a link to parent collection -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="fieldsByCat" match="tc:field" use="@category"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- all the categories -->
+<xsl:variable name="categories" select="/tc:tellico/tc:collection/tc:fields/tc:field[generate-id(.)=generate-id(key('fieldsByCat',@category)[1])]/@category"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<!-- The default layout is pretty boring, but catches every field value in
+ the entry. The title is in the top H1 element. -->
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ margin: .2em 1%;
+ padding: 0;
+ font-family: "<xsl:value-of select="$font"/>", Arial, Helvetica, sans-serif;
+ font-size: <xsl:value-of select="$fontsize"/>pt;
+ color: <xsl:value-of select="$fgcolor"/>;
+ background: <xsl:value-of select="$bgcolor"/>;
+ line-height: 1.6;
+ }
+ div#banner {
+ padding-bottom: .1em;
+ margin-bottom: .4em;
+ border-bottom: .2em ridge <xsl:value-of select="$color2"/>;
+ }
+ img#logo {
+ padding-left: .5em;
+ padding-top: .4em;
+ float: right;
+ }
+ h1 {
+ color: <xsl:value-of select="$color2"/>;
+ font-size: 1.8em;
+ text-align: left;
+ padding: .2em;
+ margin: 0;
+ font-weight: bold;
+ }
+ span.year {
+ font-size: 0.8em;
+ }
+ span.country {
+ font-style: italic;
+ }
+ h2 {
+ font-size: 1.2em;
+ margin: 0;
+ padding: 0;
+ padding-left: .2em;
+ }
+ img {
+ padding-right: 1em;
+ padding-bottom: 1em;
+ }
+ table.category {
+ margin-right: 1%;
+ margin-bottom: 1em;
+ float: left;
+ border-collapse: collapse;
+ border-spacing: 0px;
+ }
+ tr.category {
+ font-weight: bold;
+ font-size: 1.2em;
+ color: <xsl:value-of select="$color1"/>;
+ background: <xsl:value-of select="$color2"/>;
+ text-align: center;
+ }
+ /* there seems to be a khtml bug, in 3.4.x at least, repeat-x doesn't
+ work on the tr element, so have to put it on the th element */
+ tr.category th {
+ background-image: url(<xsl:value-of select="concat($imgdir, 'gradient_header.png')"/>);
+ background-repeat: repeat-x;
+ }
+ th {
+ font-weight: bold;
+ text-align: left;
+ color: <xsl:value-of select="$color2"/>;
+ background <xsl:value-of select="$color1"/>;
+ padding: 0px 0.2em 0px 0.2em;
+ white-space: nowrap;
+ }
+ thead th {
+ color: <xsl:value-of select="$color1"/>;
+ background <xsl:value-of select="$color2"/>;
+ text-align: center;
+ }
+ td {
+ padding: 0px 0.2em 0px 0.2em;
+ }
+ td.role {
+ font-style: italic;
+ }
+ p {
+ margin-top: 0;
+ text-align: justify;
+ font-size: .9em;
+ }
+ ul {
+ margin-top: .3em;
+ margin-bottom: .3em;
+ margin-left: 0;
+ padding: 0 0 0 1.5em;
+ }
+ img {
+ border: 0px;
+ }
+ p.navigation {
+ font-weight: bold;
+ text-align: center;
+ clear: both;
+ }
+ </style>
+ <title>
+ <xsl:value-of select="tc:collection/tc:entry[1]//tc:title[1]"/>
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ <xsl:value-of select="tc:collection/@title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection[1]"/>
+ <xsl:if test="$collection-file">
+ <p class="navigation">
+ <a href="{$collection-file}">&lt;&lt; <xsl:value-of select="tc:collection/@title"/></a>
+ </p>
+ </xsl:if>
+ </body>
+ </html>
+</xsl:template>
+
+<!-- type 3 is video collections -->
+<!-- warn user that this template is meant for videos only. -->
+<xsl:template match="tc:collection[@type!=3]">
+ <h1><i18n>This template is meant for video collections only.</i18n></h1>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type=3]">
+ <xsl:apply-templates select="tc:entry[1]"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+ <xsl:variable name="titleCat" select="key('fieldsByName','title')/@category"/>
+ <!-- there might not be a cast -->
+ <xsl:variable name="castCat">
+ <xsl:choose>
+ <xsl:when test="tc:casts">
+ <xsl:value-of select="key('fieldsByName','cast')/@category"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <div id="banner">
+ <!-- do format logo -->
+ <xsl:choose>
+ <xsl:when test="$datadir and tc:medium = 'DVD'">
+ <img width="74" height="30" id="logo" alt="(DVD)">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($datadir,'dvd-logo.png')"/>
+ </xsl:attribute>
+ </img>
+ </xsl:when>
+ <xsl:when test="$datadir and tc:medium = 'VHS'">
+ <img width="56" height="30" id="logo" alt="(VHS)">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($datadir,'vhs-logo.png')"/>
+ </xsl:attribute>
+ </img>
+ </xsl:when>
+ <xsl:when test="$datadir and tc:medium = 'Blu-ray'">
+ <img width="56" height="30" id="logo" alt="(Blu-ray)">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($datadir,'bluray-logo.png')"/>
+ </xsl:attribute>
+ </img>
+ </xsl:when>
+ <xsl:when test="$datadir and tc:medium = 'HD DVD'">
+ <img width="119" height="30" id="logo" alt="(HD DVD)">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($datadir,'hddvd-logo.png')"/>
+ </xsl:attribute>
+ </img>
+ </xsl:when>
+ </xsl:choose>
+
+ <!-- title block -->
+ <h1>
+ <xsl:value-of select=".//tc:title[1]"/>
+ <xsl:if test="tc:widescreen"><xsl:text/>
+ <xsl:text>&#xa0;&#8211; </xsl:text><xsl:value-of select="key('fieldsByName', 'widescreen')/@title"/><xsl:text/>
+ </xsl:if>
+ <xsl:if test="tc:directors-cut"><xsl:text/>
+ <xsl:text>&#xa0;&#8211; </xsl:text><xsl:value-of select="key('fieldsByName', 'directors-cut')/@title"/><xsl:text/>
+ </xsl:if>
+ <xsl:if test=".//tc:year|.//tc:nationality">
+ <span class="year">
+ <xsl:text> (</xsl:text>
+ <xsl:if test=".//tc:year">
+ <xsl:value-of select=".//tc:year[1]"/>
+ </xsl:if>
+ <xsl:if test=".//tc:nationality">
+ <xsl:if test=".//tc:year">
+ <xsl:text>&#xa0;&#8211; </xsl:text>
+ </xsl:if>
+ <span class="country">
+ <xsl:value-of select=".//tc:nationality[1]"/>
+ </span>
+ </xsl:if>
+ <xsl:text>)</xsl:text>
+ </span>
+ </xsl:if>
+ </h1>
+
+ </div>
+
+ <!-- the images and the rest of the categories are each in a table in a table cell -->
+ <table class="category" width="100%">
+ <tbody>
+ <tr>
+ <td valign="top">
+
+ <!-- now, show all the images in the entry, field type 10 -->
+ <xsl:variable name="images" select="../tc:fields/tc:field[@type=10]"/>
+ <xsl:if test="count($images) &gt; 0">
+ <table>
+ <tbody>
+ <!-- now, show all the images in the entry, type 10 -->
+ <xsl:for-each select="$images">
+ <tr>
+ <td>
+
+ <!-- images will never be multiple, so no need to check for that -->
+ <!-- find the value of the image field in the entry -->
+ <xsl:variable name="image" select="$entry/*[local-name(.) = current()/@name]"/>
+ <!-- check if the value is not empty -->
+ <xsl:if test="$image">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <!-- Amazon license requires the image to be linked to the amazon website -->
+ <xsl:when test="$entry/tc:amazon">
+ <xsl:value-of select="$entry/tc:amazon"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <img alt="">
+ <xsl:attribute name="src">
+ <xsl:call-template name="image-link">
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ <xsl:with-param name="dir" select="$imgdir"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- limit to maximum width of 200 of height of 300 -->
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="200"/>
+ <xsl:with-param name="limit-height" select="300"/>
+ <xsl:with-param name="image" select="key('imagesById', $image)"/>
+ </xsl:call-template>
+ </img>
+ </a>
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:if>
+ </td>
+
+ <td valign="top">
+
+ <!-- show the general group, or more accurately, the title's group -->
+ <table width="49%" class="category">
+ <thead>
+ <tr class="category">
+ <th colspan="2">
+ <xsl:value-of select="$titleCat"/>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- the year and nationality have already been shown, but the film
+ might have multiple values, so go ahead and show them again -->
+ <xsl:for-each select="key('fieldsByCat', $titleCat)">
+ <xsl:if test="@name != 'title'">
+ <tr>
+ <th>
+ <xsl:value-of select="@title"/>
+ </th>
+ <td>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </tbody>
+ </table>
+
+ <!-- now for the cast -->
+ <xsl:if test="tc:casts">
+ <xsl:variable name="castField" select="key('fieldsByName', 'cast')"/>
+ <table width="49%" class="category">
+ <thead>
+ <tr class="category">
+ <th colspan="2">
+ <xsl:value-of select="$castField/@title"/>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:if test="$castField/tc:prop[@name = 'column1']">
+ <xsl:variable name="castCols" select="$castField/tc:prop[@name = 'columns']"/>
+ <tr>
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="max" select="$castCols"/>
+ <xsl:with-param name="elem" select="'th'"/>
+ <xsl:with-param name="field" select="$castField"/>
+ </xsl:call-template>
+ </tr>
+ </xsl:if>
+ <xsl:for-each select="$entry/tc:casts/tc:cast">
+ <tr>
+ <xsl:for-each select="tc:column">
+ <td>
+ <xsl:if test="position() = 1">
+ <xsl:attribute name="class">person</xsl:attribute><xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="position() &gt; 1">
+ <xsl:attribute name="class">role</xsl:attribute><xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:if>
+
+ <!-- now for every thing else -->
+ <!-- write categories other than general and images -->
+ <!-- $castcat might be empty, be careful -->
+ <xsl:for-each select="$categories[. != $titleCat and
+ ($castCat = '' or . != $castCat) and
+ key('fieldsByCat',.)[1]/@type != 10]">
+ <table width="49%" class="category">
+ <thead>
+ <tr class="category">
+ <th colspan="2">
+ <xsl:value-of select="."/>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:for-each select="key('fieldsByCat', .)[@name != 'directors-cut' and
+ @name != 'widescreen']">
+ <tr>
+ <xsl:choose>
+ <!-- paragraphs -->
+ <xsl:when test="@type=2">
+ <td colspan="2">
+ <p>
+ <xsl:value-of select="$entry/*[local-name(.)=current()/@name]" disable-output-escaping="yes"/>
+ </p>
+ </td>
+ </xsl:when>
+
+ <!-- tables are field type 8 -->
+ <!-- ok to put category name inside div instead of table here -->
+ <xsl:when test="@type = 8">
+ <td colspan="2">
+ <!-- look at number of columns -->
+ <xsl:choose>
+ <xsl:when test="tc:prop[@name = 'columns'] &gt; 1">
+ <table>
+ <xsl:if test="tc:prop[@name = 'column1']">
+ <thead>
+ <tr>
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="max" select="tc:prop[@name = 'columns']"/>
+ <xsl:with-param name="elem" select="'th'"/>
+ <xsl:with-param name="field" select="."/>
+ </xsl:call-template>
+ </tr>
+ </thead>
+ </xsl:if>
+ <tbody>
+ <xsl:for-each select="$entry//*[local-name(.) = current()/@name]">
+ <tr>
+ <xsl:for-each select="tc:column">
+ <td width="{100 div count(../tc:column)}%">
+ <xsl:value-of select="."/>
+ <xsl:text>&#160;</xsl:text>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <ul>
+ <xsl:for-each select="$entry//*[local-name(.) = current()/@name]">
+ <li>
+ <xsl:value-of select="."/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:when>
+
+ <!-- everything else -->
+ <xsl:otherwise>
+ <th>
+ <xsl:value-of select="@title"/>
+ </th>
+ <td>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="@name"/>
+ </xsl:call-template>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:for-each>
+</td>
+</tr>
+</tbody>
+</table>
+
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/gcstar2tellico.xsl b/xslt/gcstar2tellico.xsl
new file mode 100644
index 0000000..a45df87
--- /dev/null
+++ b/xslt/gcstar2tellico.xsl
@@ -0,0 +1,503 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing GCstar data.
+
+ Copyright (C) 2007-2008 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V9.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v9/tellico.dtd"/>
+
+<xsl:variable name="coll">
+ <xsl:choose>
+ <xsl:when test="/collection[1]/@type='GCbooks'">
+ <xsl:text>2</xsl:text>
+ </xsl:when>
+ <xsl:when test="/collection[1]/@type='GCfilms'">
+ <xsl:text>3</xsl:text>
+ </xsl:when>
+ <xsl:when test="/collection[1]/@type='GCmusics'">
+ <xsl:text>4</xsl:text>
+ </xsl:when>
+ <xsl:when test="/collection[1]/@type='GCwines'">
+ <xsl:text>7</xsl:text>
+ </xsl:when>
+ <xsl:when test="/collection[1]/@type='GCcoins'">
+ <xsl:text>8</xsl:text>
+ </xsl:when>
+ <xsl:when test="/collection[1]/@type='GCgames'">
+ <xsl:text>11</xsl:text>
+ </xsl:when>
+ <xsl:when test="/collection[1]/@type='GCboardgames'">
+ <xsl:text>13</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:template match="/">
+ <tc:tellico syntaxVersion="9">
+ <xsl:apply-templates select="collection"/>
+ </tc:tellico>
+</xsl:template>
+
+<xsl:template match="collection">
+ <tc:collection title="GCstar Import" type="{$coll}">
+ <tc:fields>
+ <tc:field name="_default"/>
+ <tc:field flags="0" title="Favorite" category="Personal" format="4" type="4" name="favorite" i18n="true"/>
+ <xsl:if test="item/@web or item/@webPage">
+ <tc:field flags="0" title="URL" category="General" format="4" type="7" name="url" i18n="true"/>
+ </xsl:if>
+ <xsl:if test="item/@location">
+ <tc:field flags="6" title="Location" category="Personal" format="4" type="1" name="location" i18n="true"/>
+ </xsl:if>
+ <xsl:if test="item/@composer">
+ <tc:field flags="7" title="Composer" category="General" format="2" type="1" name="composer" i18n="true"/>
+ </xsl:if>
+ <xsl:if test="item/@producer">
+ <tc:field flags="7" title="Producer" category="General" format="2" type="1" name="producer" i18n="true"/>
+ </xsl:if>
+ <xsl:if test="@type='GCmusics' and item/@format">
+ <tc:field flags="7" title="Format" category="General" format="0" type="1" name="format" i18n="true"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@type='GCfilms'">
+ <tc:field flags="8" title="Original Title" category="General" format="1" type="1" name="origtitle" i18n="true"/>
+ <tc:field flags="0" title="Seen" category="Personal" format="4" type="4" name="seen" i18n="true"/>
+ </xsl:when>
+ </xsl:choose>
+ </tc:fields>
+ <xsl:apply-templates select="item"/>
+ </tc:collection>
+</xsl:template>
+
+<xsl:template match="item">
+ <!-- For GCstar 1.2, the XML schema changed to use attributes for all
+ the 'simple' value types. The workaround here is to parse all
+ the attributes and elements. For each attribute, a dummy
+ element is created with the same name as the attribute, and
+ that dummy element is then parsed. This way, I can use the same
+ stylesheet for either format without having to repeat a lot
+ of XPath expression. -->
+ <!-- simplicity, the id will either be an attribute or an element -->
+ <tc:entry id="{concat(id,@id)}">
+ <xsl:apply-templates select="@*|*"/>
+ </tc:entry>
+</xsl:template>
+
+<xsl:template match="item/@*">
+ <xsl:variable name="dummies">
+ <xsl:element name="{local-name(.)}">
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:variable>
+ <xsl:for-each select="exsl:node-set($dummies)/*">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- the easy one matches identical local names -->
+<xsl:template match="title|isbn|edition|pages|label|platform|location">
+ <xsl:element name="{concat('tc:',local-name())}">
+ <xsl:value-of select="."/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="original">
+ <tc:origtitle><xsl:value-of select="."/></tc:origtitle>
+</xsl:template>
+
+<xsl:template match="author|authors|language|genre|artist|composer|producer">
+ <xsl:variable name="tag">
+ <xsl:choose>
+ <xsl:when test="local-name() = 'authors'">
+ <xsl:text>author</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="local-name()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="line">
+ <xsl:element name="{concat('tc:',$tag,'s')}">
+ <xsl:for-each select="line">
+ <xsl:element name="{concat('tc:',$tag)}">
+ <xsl:attribute name="i18n">true</xsl:attribute>
+ <xsl:value-of select="col[1]"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:element name="{concat('tc:',$tag)}">
+ <xsl:attribute name="i18n">true</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:otherwise>
+
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="format">
+ <xsl:choose>
+ <xsl:when test="$coll = 2">
+ <tc:binding i18n="true">
+ <xsl:choose>
+ <xsl:when test="contains(., 'Paperback')">
+ <xsl:text>Paperback</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tc:binding>
+ </xsl:when>
+ <xsl:when test="$coll = 3">
+ <tc:medium i18n="true"><xsl:value-of select="."/></tc:medium>
+ </xsl:when>
+ <xsl:when test="$coll = 4">
+ <tc:format i18n="true"><xsl:value-of select="."/></tc:format>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="country">
+ <xsl:if test="$coll != 8">
+ <tc:nationalitys>
+ <xsl:for-each select="str:tokenize(., ',/;')">
+ <tc:nationality i18n="true">
+ <xsl:value-of select="normalize-space(.)"/>
+ </tc:nationality>
+ </xsl:for-each>
+ </tc:nationalitys>
+ </xsl:if>
+ <xsl:if test="$coll = 8">
+ <tc:country><xsl:value-of select="."/></tc:country>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="actors">
+ <tc:casts>
+ <xsl:for-each select="line">
+ <tc:cast>
+ <tc:column>
+ <xsl:value-of select="col[1]"/>
+ </tc:column>
+ <tc:column>
+ <xsl:value-of select="col[2]"/>
+ </tc:column>
+ </tc:cast>
+ </xsl:for-each>
+ </tc:casts>
+</xsl:template>
+
+<xsl:template match="director">
+ <tc:directors>
+ <tc:director>
+ <xsl:value-of select="."/>
+ </tc:director>
+ </tc:directors>
+</xsl:template>
+
+<xsl:template match="translator">
+ <tc:translators>
+ <tc:translator>
+ <xsl:value-of select="."/>
+ </tc:translator>
+ </tc:translators>
+</xsl:template>
+
+<xsl:template match="audio">
+ <tc:languages>
+ <xsl:for-each select="line">
+ <tc:language>
+ <xsl:value-of select="col[1]"/>
+ </tc:language>
+ </xsl:for-each>
+ </tc:languages>
+ <tc:audio-tracks>
+ <xsl:for-each select="line">
+ <tc:audio-track>
+ <xsl:value-of select="col[2]"/>
+ </tc:audio-track>
+ </xsl:for-each>
+ </tc:audio-tracks>
+</xsl:template>
+
+<xsl:template match="synopsis">
+ <tc:plot><xsl:value-of select="."/></tc:plot>
+</xsl:template>
+
+<xsl:template match="comment">
+ <tc:comments><xsl:value-of select="."/></tc:comments>
+</xsl:template>
+
+<xsl:template match="image|boxpic">
+ <tc:cover><xsl:value-of select="."/></tc:cover>
+</xsl:template>
+
+<xsl:template match="web|webPage">
+ <tc:url><xsl:value-of select="."/></tc:url>
+</xsl:template>
+
+<xsl:template match="rating">
+ <xsl:if test=". &gt; 0">
+ <tc:rating><xsl:value-of select="floor(. div 2)"/></tc:rating>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="age">
+ <tc:certification i18n="true">
+ <xsl:choose>
+ <xsl:when test=". = 1">
+ <xsl:text>U (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 2">
+ <xsl:text>G (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test=". &lt; 6">
+ <xsl:text>PG (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test=". &lt; 14">
+ <xsl:text>PG-13 (USA)</xsl:text>
+ </xsl:when>
+ <xsl:when test=". &lt; 18">
+ <xsl:text>R (USA)</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </tc:certification>
+</xsl:template>
+
+<xsl:template match="time">
+ <tc:running-time>
+ <xsl:value-of select="translate(.,translate(.,'0123456789',''),'')"/>
+ </tc:running-time>
+</xsl:template>
+
+<xsl:template match="video">
+ <tc:format i18n="true">
+ <xsl:value-of select="translate(.,'abcdefghijklmnopqrstuvwxyz',
+ 'ABCDEFGHIJKLMNOPQRSTUCWXYZ')"/>
+ </tc:format>
+</xsl:template>
+
+<xsl:template match="borrower">
+ <xsl:if test="string-length(.) &gt; 0 and . != 'none'">
+ <tc:loaned>true</tc:loaned>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="read">
+ <xsl:if test=". &gt; 0">
+ <tc:read>true</tc:read>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="seen">
+ <xsl:if test=". &gt; 0">
+ <tc:seen>true</tc:seen>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="favourite">
+ <xsl:if test=". &gt; 0">
+ <tc:favorite>true</tc:favorite>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="publication">
+ <tc:pub_year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="."/>
+ </xsl:call-template>
+ </tc:pub_year>
+</xsl:template>
+
+<xsl:template match="aquisition">
+ <tc:pur_date><xsl:value-of select="."/></tc:pur_date>
+</xsl:template>
+
+<xsl:template match="added">
+ <xsl:if test="not(../acquisition)">
+ <tc:pur_date><xsl:value-of select="."/></tc:pur_date>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="serie">
+ <tc:series><xsl:value-of select="."/></tc:series>
+</xsl:template>
+
+<xsl:template match="comments">
+ <tc:comments>
+ <xsl:if test="$coll = 2">
+ &lt;br/&gt;
+ <xsl:value-of select="../description"/>
+ &lt;br/&gt;
+ </xsl:if>
+ <xsl:value-of select="."/>
+ </tc:comments>
+</xsl:template>
+
+<xsl:template match="description">
+ <xsl:if test="$coll != 2">
+ <tc:description><xsl:value-of select="."/></tc:description>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="year|date|release|released">
+ <tc:year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="."/>
+ </xsl:call-template>
+ </tc:year>
+</xsl:template>
+
+<xsl:template match="tracks">
+ <tc:tracks>
+ <xsl:for-each select="line">
+ <tc:track>
+ <tc:column>
+ <xsl:value-of select="col[2]"/>
+ </tc:column>
+ <tc:column>
+ <xsl:value-of select="../../artist"/>
+ </tc:column>
+ <tc:column>
+ <xsl:value-of select="col[3]"/>
+ </tc:column>
+ </tc:track>
+ </xsl:for-each>
+ </tc:tracks>
+</xsl:template>
+
+<xsl:template match="name">
+ <tc:title><xsl:value-of select="."/></tc:title>
+</xsl:template>
+
+<xsl:template match="completion">
+ <xsl:if test=". &gt; 99">
+ <tc:completed>true</tc:completed>
+ </xsl:if>
+</xsl:template>
+<xsl:template match="*"/>
+
+<xsl:template match="editor|publisher">
+ <tc:publishers>
+ <tc:publisher>
+ <xsl:value-of select="."/>
+ </tc:publisher>
+ </tc:publishers>
+</xsl:template>
+
+<xsl:template match="tags">
+ <tc:keywords>
+ <xsl:for-each select="line">
+ <tc:keyword>
+ <xsl:value-of select="col[1]"/>
+ </tc:keyword>
+ </xsl:for-each>
+ </tc:keywords>
+</xsl:template>
+
+<xsl:template match="subt">
+ <tc:subtitles>
+ <xsl:for-each select="line">
+ <tc:subtitle>
+ <xsl:value-of select="col[1]"/>
+ </tc:subtitle>
+ </xsl:for-each>
+ </tc:subtitles>
+</xsl:template>
+
+<xsl:template match="currency">
+ <tc:type><xsl:value-of select="."/></tc:type>
+</xsl:template>
+
+<xsl:template match="value">
+ <tc:denomination><xsl:value-of select="."/></tc:denomination>
+</xsl:template>
+
+<xsl:template match="estimate">
+ <tc:pur_price><xsl:value-of select="."/></tc:pur_price>
+</xsl:template>
+
+<xsl:template match="front">
+ <tc:obverse><xsl:value-of select="."/></tc:obverse>
+</xsl:template>
+
+<xsl:template match="back">
+ <tc:reverse><xsl:value-of select="."/></tc:reverse>
+</xsl:template>
+
+<xsl:template match="publishedby">
+ <tc:publishers>
+ <xsl:for-each select="str:tokenize(., ',/;')">
+ <tc:publisher>
+ <xsl:value-of select="normalize-space(.)"/>
+ </tc:publisher>
+ </xsl:for-each>
+ </tc:publishers>
+</xsl:template>
+
+<xsl:template match="designedby">
+ <tc:designers>
+ <xsl:for-each select="str:tokenize(., ',/;')">
+ <tc:designer>
+ <xsl:value-of select="normalize-space(.)"/>
+ </tc:designer>
+ </xsl:for-each>
+ </tc:designers>
+</xsl:template>
+
+<xsl:template match="players">
+ <tc:num-players>
+ <!-- need to parse ranges, like 2-6 -->
+ <xsl:for-each select="str:tokenize(., ',/;')">
+ <tc:num-player>
+ <xsl:value-of select="normalize-space(.)"/>
+ </tc:num-player>
+ </xsl:for-each>
+ </tc:num-players>
+</xsl:template>
+
+<xsl:template name="year">
+ <xsl:param name="value"/>
+ <!-- want to find a 4-digit number to treat as the year -->
+ <xsl:variable name="nondigits" select="translate($value,'0123456789','')"/>
+ <xsl:choose>
+
+ <xsl:when test="string-length($nondigits) = 0">
+ <xsl:if test="string-length($value) = 4">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:for-each select="str:tokenize($value,$nondigits)">
+ <xsl:if test="string-length() = 4">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/hddvd-logo.png b/xslt/hddvd-logo.png
new file mode 100644
index 0000000..67da5ad
--- /dev/null
+++ b/xslt/hddvd-logo.png
Binary files differ
diff --git a/xslt/isbndb2tellico.xsl b/xslt/isbndb2tellico.xsl
new file mode 100644
index 0000000..c4152f6
--- /dev/null
+++ b/xslt/isbndb2tellico.xsl
@@ -0,0 +1,205 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:l="uri:langs"
+ extension-element-prefixes="str exsl"
+ exclude-result-prefixes="l"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing data from isbndb.com
+
+ Copyright (C) 2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<l:langs>
+ <l:lang id="ara">Arabic</l:lang>
+ <l:lang id="cat">Catalan</l:lang>
+ <l:lang id="cze">Czech</l:lang>
+ <l:lang id="dut">Dutch</l:lang>
+ <l:lang id="eng">English</l:lang>
+ <l:lang id="fre">French</l:lang>
+ <l:lang id="ger">German</l:lang>
+ <l:lang id="dut">Dutch</l:lang>
+ <l:lang id="heb">Hebrew</l:lang>
+ <l:lang id="gre">Greek</l:lang>
+ <l:lang id="hin">Hindi</l:lang>
+ <l:lang id="hun">Hungarian</l:lang>
+ <l:lang id="ita">Italian</l:lang>
+ <l:lang id="jpn">Japanese</l:lang>
+ <l:lang id="kor">Korean</l:lang>
+ <l:lang id="lat">Latin</l:lang>
+ <l:lang id="lit">Lithuanian</l:lang>
+ <l:lang id="nob">Norwegian Bokm&#229;l</l:lang>
+ <l:lang id="nor">Norwegian</l:lang>
+ <l:lang id="nno">Norwegian Nynorsk</l:lang>
+ <l:lang id="pol">Polish</l:lang>
+ <l:lang id="por">Portuguese</l:lang>
+ <l:lang id="rus">Russian</l:lang>
+ <l:lang id="slo">Slovak</l:lang>
+ <l:lang id="spa">Spanish</l:lang>
+ <l:lang id="swe">Swedish</l:lang>
+ <l:lang id="chi">Chinese</l:lang>
+</l:langs>
+<xsl:key name="langs" match="l:lang" use="@id"/>
+<xsl:variable name="langs-top" select="document('')/*/l:langs"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="ISBNdb.com Import" type="2">
+ <fields>
+ <field name="_default"/>
+ <!-- Here so that we can retrive the real publisher name later, gets removed inside Tellico -->
+ <field name="pub_id" flags="0" title="Publisher Key" category="Publishing" format="0" type="1"/>
+ </fields>
+ <xsl:apply-templates select="ISBNdb/BookList/BookData"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="BookData">
+ <entry>
+
+ <title>
+ <xsl:value-of select="Title"/>
+ </title>
+
+ <isbn>
+ <xsl:value-of select="@isbn"/>
+ </isbn>
+
+ <pub_id>
+ <xsl:value-of select="PublisherText/@publisher_id"/>
+ </pub_id>
+
+ <publisher>
+ <xsl:value-of select="PublisherText"/>
+ </publisher>
+
+ <authors>
+ <xsl:for-each select="Authors/Person">
+ <author>
+ <xsl:value-of select="."/>
+ </author>
+ </xsl:for-each>
+ </authors>
+
+ <keywords>
+ <xsl:for-each select="Subjects/Subject">
+ <xsl:variable name="subject-tokens1">
+ <xsl:call-template name="split-string">
+ <xsl:with-param name="string" select="."/>
+ <xsl:with-param name="pattern" select="' -- '"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="subject-tokens2">
+ <xsl:call-template name="token-union">
+ <xsl:with-param name="tokens" select="exsl:node-set($subject-tokens1)/*"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:for-each select="exsl:node-set($subject-tokens2)/*">
+ <keyword>
+ <xsl:value-of select="normalize-space()"/>
+ </keyword>
+ </xsl:for-each>
+ </xsl:for-each>
+ </keywords>
+
+ <comments>
+ <xsl:value-of select="Details/@physical_description_text"/>
+ <xsl:text>&lt;br/&gt;&lt;br/&gt;</xsl:text>
+ <xsl:value-of select="Summary"/>
+ <xsl:if test="string-length(Summary) &gt; 0 and string-length(Notes) &gt; 0">
+ <xsl:text>&lt;br/&gt;&lt;br/&gt;</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="Notes"/>
+ </comments>
+
+ <xsl:variable name="binding">
+ <xsl:value-of select="substring-before(Details/@edition_info, ';')"/>
+ </xsl:variable>
+ <binding i18n="true">
+ <xsl:choose>
+ <xsl:when test="$binding='Hardcover'">
+ <xsl:text>Hardback</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($binding, 'Paperback')">
+ <xsl:text>Paperback</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$binding"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </binding>
+
+ <languages i18n="true">
+ <language>
+ <xsl:apply-templates select="$langs-top">
+ <xsl:with-param name="lang-id" select="Details/@language"/>
+ </xsl:apply-templates>
+ </language>
+ </languages>
+
+ </entry>
+</xsl:template>
+
+<xsl:template name="split-string">
+ <xsl:param name="string"/>
+ <xsl:param name="pattern"/>
+ <xsl:choose>
+ <xsl:when test="contains($string, $pattern)">
+ <xsl:if test="not(starts-with($string, $pattern))">
+ <token>
+ <xsl:value-of select="substring-before($string, $pattern)"/>
+ </token>
+ </xsl:if>
+ <xsl:call-template name="split-string">
+ <xsl:with-param name="string" select="substring-after($string, $pattern)"/>
+ <xsl:with-param name="pattern" select="$pattern"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <token>
+ <xsl:value-of select="$string"/>
+ </token>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="token-union">
+ <xsl:param name="tokens"/>
+ <xsl:choose>
+ <xsl:when test="not($tokens)"/>
+ <xsl:otherwise>
+ <xsl:copy-of select="exsl:node-set(str:tokenize($tokens[1], ','))"/>
+ <xsl:call-template name="token-union">
+ <xsl:with-param name="tokens" select="$tokens[position() &gt; 1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="l:langs">
+ <xsl:param name="lang-id"/>
+ <xsl:variable name="l" select="key('langs', $lang-id)"/>
+ <xsl:if test="$l">
+ <xsl:value-of select="$l"/>
+ </xsl:if>
+ <xsl:if test="not($l)">
+ <xsl:value-of select="$lang-id"/>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mods2tellico.xsl b/xslt/mods2tellico.xsl
new file mode 100644
index 0000000..d471498
--- /dev/null
+++ b/xslt/mods2tellico.xsl
@@ -0,0 +1,521 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:mods="http://www.loc.gov/mods/v3"
+ xmlns:l="uri:langs"
+ exclude-result-prefixes="mods l"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing MODS files.
+
+ Copyright (C) 2004-2008 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- lookup table for languages -->
+<!-- according to http://www.oasis-open.org/cover/iso639-2-en971019.html -->
+<!-- I just added common ones -->
+<l:langs>
+ <l:lang id="ara">Arabic</l:lang>
+ <l:lang id="cat">Catalan</l:lang>
+ <l:lang id="cze">Czech</l:lang>
+ <l:lang id="dut">Dutch</l:lang>
+ <l:lang id="eng">English</l:lang>
+ <l:lang id="fre">French</l:lang>
+ <l:lang id="ger">German</l:lang>
+ <l:lang id="dut">Dutch</l:lang>
+ <l:lang id="heb">Hebrew</l:lang>
+ <l:lang id="gre">Greek</l:lang>
+ <l:lang id="hin">Hindi</l:lang>
+ <l:lang id="hun">Hungarian</l:lang>
+ <l:lang id="ita">Italian</l:lang>
+ <l:lang id="jpn">Japanese</l:lang>
+ <l:lang id="kor">Korean</l:lang>
+ <l:lang id="lat">Latin</l:lang>
+ <l:lang id="lit">Lithuanian</l:lang>
+ <l:lang id="nob">Norwegian Bokm&#229;l</l:lang>
+ <l:lang id="nor">Norwegian</l:lang>
+ <l:lang id="nno">Norwegian Nynorsk</l:lang>
+ <l:lang id="pol">Polish</l:lang>
+ <l:lang id="por">Portuguese</l:lang>
+ <l:lang id="rus">Russian</l:lang>
+ <l:lang id="slo">Slovak</l:lang>
+ <l:lang id="spa">Spanish</l:lang>
+ <l:lang id="swe">Swedish</l:lang>
+ <l:lang id="chi">Chinese</l:lang>
+</l:langs>
+<xsl:key name="langs" match="l:lang" use="@id"/>
+<xsl:variable name="langs-top" select="document('')/*/l:langs"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<!-- for now, it's a bibtex collection if it has an identifier,
+ book collection if not -->
+<xsl:variable name="type">
+ <xsl:choose>
+ <xsl:when test="count(//mods:mods[string-length(@ID)&gt;0 or mods:identifier[@type='citekey']]) &gt; 0">
+ <xsl:text>bibtex</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>book</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="npubs">
+ <xsl:value-of select="count(//mods:originInfo[count(mods:publisher) &gt; 1])"/>
+</xsl:variable>
+
+<!-- disable default behavior -->
+<xsl:template match="text()|@*"></xsl:template>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="MODS Import">
+ <xsl:attribute name="type">
+ <xsl:choose>
+ <xsl:when test="$type='bibtex'">
+ <xsl:text>5</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type='book'">
+ <xsl:text>2</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <fields>
+ <field name="_default"/>
+ <!-- the default collection does not have multiple publishers -->
+ <xsl:if test="$npubs &gt; 1">
+ <field flags="7" title="Publisher" category="Publishing" format="0" type="1" name="publisher" i18n="true">
+ <prop name="bibtex">publisher</prop>
+ </field>
+ </xsl:if>
+ <!-- default book collection does not include an abstract -->
+ <xsl:if test="$type='book' and .//mods:mods/mods:abstract">
+ <field flags="0" title="Abstract" format="4" type="2" name="abstract" i18n="true">
+ <prop name="bibtex">abstract</prop>
+ </field>
+ </xsl:if>
+ <!-- default book collection does not include an address -->
+ <xsl:if test="$type='book' and .//mods:originInfo/mods:place/mods:placeTerm[@type='text']">
+ <field flags="6" title="Address" category="Publishing" format="4" type="1" name="address" i18n="true">
+ <prop name="bibtex">address</prop>
+ </field>
+ </xsl:if>
+ <!-- add illustrator -->
+ <xsl:if test=".//mods:mods/mods:name[@type='personal']/mods:role/mods:roleTerm[@authority='marcrelator' and @type='code'] = 'ill.'">
+ <field flags="7" title="Illustrator" category="General" format="2" type="1" name="illustrator" i18n="true"/>
+ </xsl:if>
+ <xsl:if test=".//mods:identifier[@type='issn']">
+ <field flags="0" title="ISSN#" category="Publishing" format="4" type="1" name="issn" description="ISSN#" />
+ </xsl:if>
+ </fields>
+<!-- for now, go the route of bibliox, and assume only text records
+ with an originInfo/publisher or identifier[isbn] elements are actually books -->
+<!-- Changed in Tellico 1.1, don't be so strict about the text thing, not every library
+ includes that in the mods output, so just check for publisher
+ Changed in Tellico 1.2.9, allow anything that has typeOfResource='text'
+ //mods:mods[(mods:typeOfResource='text' and -->
+ <xsl:for-each select=".//mods:mods[ mods:typeOfResource='text' or
+ mods:originInfo/mods:publisher or
+ mods:identifier[@type='isbn'] or
+ mods:identifier[@type='lccn'] ]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="mods:mods">
+ <entry>
+
+ <xsl:if test="$type='bibtex'">
+ <entry-type>
+ <xsl:choose>
+ <xsl:when test="mods:genre[@authority='xbib']='article'">
+ <xsl:text>article</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:genre[@authority='xbib']='book'">
+ <xsl:text>book</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:identifier[@type='isbn']">
+ <xsl:text>book</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:genre[@authority='marc']='theses'">
+ <xsl:text>phdthesis</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:relatedItem[@type='host']/mods:genre[@authority='marc']='periodical'">
+ <xsl:text>article</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:relatedItem[@type='host']/mods:genre[@authority='marc']='book'">
+ <xsl:text>inbook</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:relatedItem[@type='host']/mods:name[@type='conference']">
+ <xsl:text>inproceedings</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:relatedItem[@type='host']">
+ <xsl:text>incollection</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>book</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </entry-type>
+
+ <!-- identifier overrides @ID -->
+ <xsl:for-each select="(mods:identifier[@type='citekey']|@ID)[1]">
+ <bibtex-key>
+ <xsl:value-of select="."/>
+ </bibtex-key>
+ </xsl:for-each>
+ </xsl:if>
+
+ <title>
+ <xsl:value-of select="mods:titleInfo/mods:nonSort"/>
+ <xsl:value-of select="mods:titleInfo/mods:title"/>
+ </title>
+
+ <xsl:call-template name="names">
+ <xsl:with-param name="elem" select="'author'"/>
+ <xsl:with-param name="nodes" select="mods:name[mods:role/mods:roleTerm[@authority='marcrelator' and @type='text'] = 'author' or
+ mods:role/mods:roleTerm[@authority='marcrelator' and @type='text'] = 'creator']"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="names">
+ <xsl:with-param name="elem" select="'editor'"/>
+ <xsl:with-param name="nodes" select="mods:name[mods:role/mods:roleTerm[@authority='marcrelator' and @type='text'] = 'editor']"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="names">
+ <xsl:with-param name="elem" select="'illustrator'"/>
+ <xsl:with-param name="nodes" select="mods:name[mods:role/mods:roleTerm[@authority='marcrelator' and @type='code'] = 'ill.']"/>
+ </xsl:call-template>
+
+ <genres i18n="true">
+ <xsl:for-each select="mods:genre">
+ <genre>
+ <xsl:value-of select="."/>
+ </genre>
+ </xsl:for-each>
+ </genres>
+
+ <xsl:choose>
+ <xsl:when test="$npubs &gt; 1">
+ <publishers>
+ <xsl:apply-templates select="mods:originInfo/mods:publisher"/>
+ </publishers>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="mods:originInfo/mods:publisher"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- prefer the marc encoding for year -->
+ <!-- force numbers...is that ok? -->
+ <xsl:variable name="year-type">
+ <xsl:choose>
+ <xsl:when test="$type='bibtex'">
+ <xsl:text>year</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>pub_year</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="mods:originInfo/mods:dateIssued[@encoding='marc']">
+ <xsl:element name="{$year-type}">
+ <xsl:call-template name="numbers">
+ <xsl:with-param name="value" select="mods:originInfo/mods:dateIssued[@encoding='marc'][1]"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="mods:originInfo/mods:dateIssued">
+ <xsl:element name="{$year-type}">
+ <xsl:call-template name="numbers">
+ <xsl:with-param name="value" select="mods:originInfo/mods:dateIssued[1]"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+
+ <languages i18n="true">
+ <xsl:for-each select="mods:language/mods:languageTerm">
+ <language>
+ <xsl:apply-templates select="$langs-top">
+ <xsl:with-param name="lang-id" select="text()"/>
+ </xsl:apply-templates>
+ </language>
+ </xsl:for-each>
+ </languages>
+
+ <comments>
+ <xsl:for-each select="mods:note | mods:physicalDescription/*">
+ <xsl:value-of select="."/>
+ <!-- add separating line, Tellico understands HTML now -->
+ <xsl:text>&lt;br/&gt;&lt;br/&gt;</xsl:text>
+ </xsl:for-each>
+ </comments>
+
+ <keywords i18n="true">
+ <xsl:for-each select="mods:subject/mods:topic">
+ <keyword>
+ <xsl:value-of select="."/>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+
+ <xsl:apply-templates select="mods:relatedItem[@type='host'] |
+ mods:relatedItem[@type='series'] |
+ mods:part |
+ mods:identifier |
+ mods:subTitle |
+ mods:note |
+ mods:abstract |
+ mods:originInfo/mods:place |
+ mods:originInfo/mods:copyrightDate |
+ mods:originInfo/mods:edition |
+ mods:location/mods:url"/>
+
+ </entry>
+</xsl:template>
+
+<xsl:template match="mods:relatedItem">
+ <xsl:variable name="elem">
+ <xsl:choose>
+ <xsl:when test="@type='series'">
+ <xsl:text>series</xsl:text>
+ </xsl:when>
+ <xsl:when test="mods:genre[@authority='marc']='periodical'">
+ <xsl:text>journal</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>booktitle</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$elem}">
+ <xsl:value-of select="mods:titleInfo/mods:nonSort"/>
+ <xsl:value-of select="mods:titleInfo/mods:title"/>
+ <xsl:if test="not(mods:titleInfo) and mods:name[@type='conference']">
+ <xsl:apply-templates select="mods:name[@type='conference']"/>
+ </xsl:if>
+ </xsl:element>
+
+ <xsl:call-template name="names">
+ <xsl:with-param name="elem" select="'editor'"/>
+ <xsl:with-param name="nodes" select="mods:name[mods:role/mods:roleTerm[@authority='marcrelator' and @type='text'] = 'editor']"/>
+ </xsl:call-template>
+
+ <xsl:choose>
+ <xsl:when test="$npubs &gt; 1">
+ <publishers>
+ <xsl:apply-templates select="mods:originInfo/mods:publisher"/>
+ </publishers>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="mods:originInfo/mods:publisher"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="mods:originInfo/mods:dateIssued[@encoding='marc']">
+ <year>
+ <xsl:call-template name="numbers">
+ <xsl:with-param name="value" select="mods:originInfo/mods:dateIssued[@encoding='marc'][1]"/>
+ </xsl:call-template>
+ </year>
+ </xsl:when>
+ <xsl:when test="mods:originInfo/mods:dateIssued">
+ <year>
+ <xsl:call-template name="numbers">
+ <xsl:with-param name="value" select="mods:originInfo/mods:dateIssued[1]"/>
+ </xsl:call-template>
+ </year>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates select="mods:part |
+ mods:originInfo/mods:place |
+ mods:identifier |
+ mods:part |
+ mods:location/mods:url"/>
+
+</xsl:template>
+
+<xsl:template match="mods:part">
+ <xsl:apply-templates select="mods:detail | mods:extent"/>
+</xsl:template>
+
+<xsl:template name="names">
+ <xsl:param name="elem"/>
+ <xsl:param name="nodes"/>
+ <xsl:if test="$nodes">
+ <xsl:element name="{concat($elem,'s')}">
+ <xsl:for-each select="$nodes">
+ <xsl:element name="{$elem}">
+ <xsl:apply-templates select="."/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="mods:name">
+ <!-- specific order -->
+ <xsl:apply-templates select="mods:namePart[@type='given']"/>
+ <xsl:apply-templates select="mods:namePart[@type='family']"/>
+ <xsl:apply-templates select="mods:namePart[not(@type)]"/>
+</xsl:template>
+
+<xsl:template match="mods:namePart">
+ <xsl:value-of select="."/>
+ <!-- assume single-character name parts are initials -->
+ <xsl:if test="string-length()=1">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text> </xsl:text>
+</xsl:template>
+
+<xsl:template match="mods:identifier">
+ <xsl:choose>
+ <xsl:when test="@type='isbn'">
+ <isbn>
+ <xsl:value-of select="."/>
+ </isbn>
+ </xsl:when>
+ <xsl:when test="@type='lccn'">
+ <lccn>
+ <xsl:value-of select="."/>
+ </lccn>
+ </xsl:when>
+ <xsl:when test="@type='doi'">
+ <doi>
+ <xsl:value-of select="."/>
+ </doi>
+ </xsl:when>
+ <xsl:when test="@type='issn'">
+ <issn>
+ <xsl:value-of select="."/>
+ </issn>
+ </xsl:when>
+ <xsl:when test="@type='uri'">
+ <url>
+ <xsl:value-of select="."/>
+ </url>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="mods:subTitle">
+ <subtitle>
+ <xsl:value-of select="."/>
+ </subtitle>
+</xsl:template>
+
+<xsl:template match="mods:publisher">
+ <publisher>
+ <xsl:value-of select="."/>
+ </publisher>
+</xsl:template>
+
+<xsl:template match="mods:copyrightDate">
+ <cr_year>
+ <xsl:call-template name="numbers">
+ <xsl:with-param name="value" select="."/>
+ </xsl:call-template>
+ </cr_year>
+</xsl:template>
+
+<xsl:template match="mods:abstract">
+ <abstract>
+ <xsl:value-of select="."/>
+ </abstract>
+</xsl:template>
+
+<xsl:template match="mods:edition">
+ <edition i18n="true">
+ <xsl:value-of select="."/>
+ </edition>
+</xsl:template>
+
+<xsl:template match="mods:url">
+ <url>
+ <xsl:value-of select="."/>
+ </url>
+</xsl:template>
+
+<xsl:template match="mods:note">
+ <note>
+ <xsl:value-of select="."/>
+ </note>
+</xsl:template>
+
+<xsl:template match="mods:place">
+ <address>
+ <xsl:value-of select="mods:placeTerm[@type='text' or not(@type)][1]"/>
+ </address>
+</xsl:template>
+
+<xsl:template match="mods:detail">
+ <xsl:choose>
+ <xsl:when test="@type='volume'">
+ <volume>
+ <xsl:value-of select="mods:number"/>
+ </volume>
+ </xsl:when>
+ <xsl:when test="@type='issue'">
+ <number>
+ <xsl:value-of select="mods:number"/>
+ </number>
+ </xsl:when>
+ <xsl:when test="@type='number'">
+ <number>
+ <xsl:value-of select="mods:number"/>
+ </number>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="mods:extent">
+ <xsl:if test="@unit='page'">
+ <pages>
+ <xsl:choose>
+ <xsl:when test="mods:start and mods:end">
+ <xsl:value-of select="concat(mods:start,'-',mods:end)"/>
+ </xsl:when>
+ <xsl:when test="mods:list">
+ <xsl:value-of select="mods:list"/>
+ </xsl:when>
+ </xsl:choose>
+ </pages>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="numbers">
+ <xsl:param name="value"/>
+ <xsl:value-of select="translate($value, translate($value, '0123456789', ''), '')"/>
+</xsl:template>
+
+<xsl:template match="l:langs">
+ <xsl:param name="lang-id"/>
+ <xsl:variable name="l" select="key('langs', $lang-id)"/>
+ <xsl:if test="$l">
+ <xsl:value-of select="$l"/>
+ </xsl:if>
+ <xsl:if test="not($l)">
+ <xsl:value-of select="$lang-id"/>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/pubmed2tellico.xsl b/xslt/pubmed2tellico.xsl
new file mode 100644
index 0000000..3f32ec6
--- /dev/null
+++ b/xslt/pubmed2tellico.xsl
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:m="uri:months"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing PubMed data.
+
+ Copyright (C) 2005 Michaël Zugaro <[email protected]>
+ 2005-2006 Robby Stephenson <[email protected]>
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- lookup table for months -->
+<m:months>
+ <m:month id="Jan">1</m:month>
+ <m:month id="Feb">2</m:month>
+ <m:month id="Mar">3</m:month>
+ <m:month id="Apr">4</m:month>
+ <m:month id="May">5</m:month>
+ <m:month id="Jun">6</m:month>
+ <m:month id="Jul">7</m:month>
+ <m:month id="Aug">8</m:month>
+ <m:month id="Sep">9</m:month>
+ <m:month id="Oct">10</m:month>
+ <m:month id="Nov">11</m:month>
+ <m:month id="Dec">12</m:month>
+ <!-- months in other languages could be added easily -->
+</m:months>
+<xsl:key name="months" match="m:month" use="@id"/>
+<xsl:variable name="months-top" select="document('')/*/m:months"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="PubMed Import" type="5">
+ <fields>
+ <field name="_default"/>
+ <field flags="0" title="Institution" category="Institution" format="4" type="2" name="institution" i18n="true">
+ <prop name="bibtex">institution</prop>
+ </field>
+ <field flags="0" title="Pubmed" category="Publishing" format="4" type="1" name="pmid" description="Pubmed" i18n="true" />
+ </fields>
+ <xsl:apply-templates select="/PubmedArticleSet/PubmedArticle"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="PubmedArticle">
+ <entry>
+ <xsl:apply-templates select="MedlineCitation"/>
+ <xsl:apply-templates select="PubmedData"/>
+ </entry>
+</xsl:template>
+
+<xsl:template match="MedlineCitation">
+ <entry-type>
+ <xsl:text>article</xsl:text>
+ </entry-type>
+
+ <volume>
+ <xsl:value-of select="Article/Journal/JournalIssue/Volume"/>
+ </volume>
+
+ <number>
+ <xsl:value-of select="Article/Journal/JournalIssue/Issue"/>
+ </number>
+
+ <xsl:variable name="year">
+ <xsl:variable name="year1" select="Article/Journal/JournalIssue/PubDate/Year"/>
+ <xsl:variable name="year2" select="Article/Journal/JournalIssue/PubDate/MedlineDate"/>
+ <xsl:choose>
+ <xsl:when test="string-length($year1) != 0">
+ <xsl:value-of select="$year1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($year2,1,4)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <year>
+ <xsl:value-of select="$year"/>
+ </year>
+
+ <month>
+ <xsl:apply-templates select="$months-top">
+ <xsl:with-param name="month-id" select="Article/Journal/JournalIssue/PubDate/Month"/>
+ </xsl:apply-templates>
+ </month>
+
+ <title>
+ <xsl:value-of select="Article/ArticleTitle"/>
+ </title>
+
+ <pages>
+ <xsl:value-of select="Article/Pagination/MedlinePgn"/>
+ </pages>
+
+ <abstract>
+ <xsl:value-of select="Article/Abstract/AbstractText"/>
+ </abstract>
+
+ <institution>
+ <xsl:value-of select="Article/Affiliation"/>
+ </institution>
+
+ <authors>
+ <xsl:for-each select="Article/AuthorList/Author">
+ <author>
+ <xsl:choose>
+ <xsl:when test="ForeName">
+ <xsl:value-of select="concat(ForeName, ' ')"/>
+ </xsl:when>
+ <xsl:when test="FirstName">
+ <xsl:value-of select="concat(FirstName, ' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="TransformInitials">
+ <xsl:with-param name="initials" select="Initials"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="LastName"/>
+ </author>
+ </xsl:for-each>
+ </authors>
+
+ <journal>
+ <xsl:if test="Article/Journal/Title">
+ <xsl:value-of select="Article/Journal/Title"/>
+ </xsl:if>
+ <xsl:if test="not(Article/Journal/Title)">
+ <xsl:value-of select="MedlineJournalInfo/MedlineTA"/>
+ </xsl:if>
+ </journal>
+
+ <keywords>
+ <xsl:for-each select="MeshHeadingList/MeshHeading/QualifierName[@MajorTopicYN='Y'] | MeshHeadingList/MeshHeading/DescriptorName">
+ <keyword>
+ <xsl:value-of select="."/>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+
+ <pmid>
+ <xsl:value-of select="PMID"/>
+ </pmid>
+
+</xsl:template>
+
+<xsl:template match="PubmedData">
+ <doi>
+ <xsl:value-of select="ArticleIdList/ArticleId[@IdType='doi']"/>
+ </doi>
+</xsl:template>
+
+<xsl:template name="TransformInitials">
+ <xsl:param name="initials"/>
+ <xsl:variable name="n" select="string-length($initials)"/>
+ <xsl:if test="$n &gt;= 1">
+ <xsl:value-of select="substring($initials,1,1)"/>
+ <xsl:text>. </xsl:text>
+ <xsl:call-template name="TransformInitials">
+ <xsl:with-param name="initials" select="substring($initials,2,$n - 1)"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="m:months">
+ <xsl:param name="month-id"/>
+ <xsl:variable name="m" select="key('months', $month-id)"/>
+ <xsl:if test="$m">
+ <xsl:value-of select="$m"/>
+ </xsl:if>
+ <xsl:if test="not($m)">
+ <xsl:value-of select="$month-id"/>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/record-logo.png b/xslt/record-logo.png
new file mode 100644
index 0000000..956c03e
--- /dev/null
+++ b/xslt/record-logo.png
Binary files differ
diff --git a/xslt/referencer2tellico.xsl b/xslt/referencer2tellico.xsl
new file mode 100644
index 0000000..5bb90be
--- /dev/null
+++ b/xslt/referencer2tellico.xsl
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="str exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing data Referencer
+
+ Copyright (C) 2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:key name="tags" match="/library/taglist/tag" use="uid"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="Referencer Import" type="5">
+ <fields>
+ <field name="_default"/>
+ </fields>
+ <xsl:apply-templates select="library/doclist/doc"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="doc">
+ <entry>
+
+ <title>
+ <xsl:value-of select="bib_title"/>
+ </title>
+
+ <entry-type>
+ <xsl:value-of select="translate(bib_type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+ 'abcdefghijklmnopqrstuvwxyz')"/>
+ </entry-type>
+
+ <bibtex-key>
+ <xsl:value-of select="key"/>
+ </bibtex-key>
+
+ <year>
+ <xsl:value-of select="bib_year"/>
+ </year>
+
+ <doi>
+ <xsl:value-of select="bib_doi"/>
+ </doi>
+
+ <pages>
+ <xsl:value-of select="bib_pages"/>
+ </pages>
+
+ <journal>
+ <xsl:value-of select="bib_journal"/>
+ </journal>
+
+ <number>
+ <xsl:value-of select="bib_number"/>
+ </number>
+
+ <volume>
+ <xsl:value-of select="bib_volume"/>
+ </volume>
+
+ <url>
+ <xsl:value-of select="filename"/>
+ </url>
+
+ <authors>
+ <xsl:for-each select="str:tokenize(bib_authors, ',/;')">
+ <xsl:call-template name="author_split">
+ <xsl:with-param name="value" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </authors>
+
+ <keywords>
+ <xsl:for-each select="tagged">
+ <keyword i18n="true">
+ <xsl:value-of select="key('tags', .)/name"/>
+ </keyword>
+ </xsl:for-each>
+ </keywords>
+
+</entry>
+
+</xsl:template>
+
+<xsl:template name="author_split">
+ <xsl:param name="value"/>
+ <xsl:if test="string-length($value) &gt; 0">
+ <xsl:variable name="before" select="substring-before($value, ' and ')"/>
+ <author>
+ <xsl:if test="string-length($before) &gt; 0">
+ <xsl:value-of select="normalize-space($before)"/>
+ </xsl:if>
+ <xsl:if test="string-length($before) = 0">
+ <xsl:value-of select="normalize-space($value)"/>
+ </xsl:if>
+ </author>
+ <xsl:call-template name="author_split">
+ <xsl:with-param name="value" select="substring-after($value, ' and ')"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/report-templates/Column_View.xsl b/xslt/report-templates/Column_View.xsl
new file mode 100644
index 0000000..3b007fe
--- /dev/null
+++ b/xslt/report-templates/Column_View.xsl
@@ -0,0 +1,310 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:dyn="http://exslt.org/dynamic"
+ extension-element-prefixes="str dyn"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Column View Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- To choose which fields of each entry are printed, change the
+ string to a space separated list of field names. To know what
+ fields are available, check the Tellico data file for <field>
+ elements. -->
+<xsl:param name="column-names" select="'title'"/>
+<xsl:variable name="columns" select="str:tokenize($column-names)"/>
+
+<!-- set the maximum image size -->
+<xsl:param name="image-height" select="'100'"/>
+<xsl:param name="image-width" select="'100'"/>
+
+<!-- Up to three fields may be used for sorting. -->
+<xsl:param name="sort-name1" select="'title'"/>
+<xsl:param name="sort-name2" select="''"/>
+<xsl:param name="sort-name3" select="''"/>
+<!-- This is the title just beside the collection name. It will
+ automatically list which fields are used for sorting. -->
+<xsl:param name="sort-title" select="''"/>
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data files are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<!-- In case the field has multiple values, only sort by first one -->
+<xsl:variable name="sort1">
+ <xsl:if test="string-length($sort-name1) &gt; 0">
+ <xsl:value-of select="concat('.//tc:', $sort-name1, '[1]')"/>
+ </xsl:if>
+</xsl:variable>
+
+<xsl:variable name="sort1-type">
+ <xsl:choose>
+ <xsl:when test=".//tc:field[@name=$sort-name1]/@type = 6">number</xsl:when>
+ <xsl:otherwise>text</xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="sort2">
+ <xsl:if test="string-length($sort-name2) &gt; 0">
+ <xsl:value-of select="concat('.//tc:', $sort-name2, '[1]')"/>
+ </xsl:if>
+</xsl:variable>
+
+<xsl:variable name="sort2-type">
+ <xsl:choose>
+ <xsl:when test=".//tc:field[@name=$sort-name2]/@type = 6">number</xsl:when>
+ <xsl:otherwise>text</xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="sort3">
+ <xsl:if test="string-length($sort-name3) &gt; 0">
+ <xsl:value-of select="concat('.//tc:', $sort-name3, '[1]')"/>
+ </xsl:if>
+</xsl:variable>
+
+<xsl:variable name="sort3-type">
+ <xsl:choose>
+ <xsl:when test=".//tc:field[@name=$sort-name3]/@type = 6">number</xsl:when>
+ <xsl:otherwise>text</xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ <xsl:if test="count($columns) &gt; 3">
+ font-size: 80%;
+ </xsl:if>
+ background-color: #fff;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ th {
+ color: #000;
+ background-color: #ccc;
+ border: 1px solid #999;
+ font-size: 1.1em;
+ font-weight: bold;
+ padding-left: 4px;
+ padding-right: 4px;
+ }
+ tr.r0 {
+ }
+ tr.r1 {
+ background-color: #eee;
+ }
+ td.field {
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-left: 10px;
+ padding-right: 5px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <table>
+ <!-- always print headers -->
+ <thead>
+ <tr>
+ <xsl:variable name="fields" select="tc:fields"/>
+ <xsl:for-each select="$columns">
+ <th>
+ <xsl:call-template name="field-title">
+ <xsl:with-param name="fields" select="$fields"/>
+ <xsl:with-param name="name" select="."/>
+ </xsl:call-template>
+ </th>
+ </xsl:for-each>
+ </tr>
+ </thead>
+
+ <tbody>
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort1)" data-type="{$sort1-type}"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort2)" data-type="{$sort2-type}"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort3)" data-type="{$sort3-type}"/>
+ <tr class="r{position() mod 2}">
+ <xsl:apply-templates select="."/>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+</xsl:template>
+
+<xsl:template name="field-title">
+ <xsl:param name="fields"/>
+ <xsl:param name="name"/>
+ <!-- remove namespace portion of qname -->
+ <xsl:variable name="name-tokens" select="str:tokenize($name, ':')"/>
+ <!-- the header is the title attribute of the field node whose
+ name equals the column name -->
+ <xsl:value-of select="$fields/tc:field[@name = $name-tokens[last()]]/@title"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <!-- stick all the descendants into a variable -->
+ <xsl:variable name="current" select="descendant::*"/>
+ <xsl:variable name="entry" select="."/>
+
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+
+ <!-- find all descendants whose name matches the column name -->
+ <xsl:variable name="numvalues" select="count($current[local-name() = $column])"/>
+ <!-- if the field node exists, output its value, otherwise put in a space -->
+ <td class="field">
+ <xsl:choose>
+ <!-- when there is at least one value... -->
+ <xsl:when test="$numvalues &gt; 1">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="$numvalues = 1">
+ <xsl:for-each select="$current[local-name() = $column]">
+
+ <xsl:variable name="field" select="key('fieldsByName', $column)"/>
+ <xsl:choose>
+
+ <!-- boolean and number values -->
+ <xsl:when test="$field/@type=4 or $field/@type=6">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- next, check for images -->
+ <xsl:when test="$field/@type=10">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <img>
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($imgdir, .)"/>
+ </xsl:attribute>
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="key('imagesById', .)"/>
+ </xsl:call-template>
+ </img>
+ </xsl:when>
+
+ <!-- if it's a date, format with hyphens -->
+ <xsl:when test="$field/@type=12">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- handle URL here, so no link created -->
+ <xsl:when test="$field/@type=7">
+ <xsl:value-of select="."/>
+ </xsl:when>
+
+ <!-- finally, it's just a regular value -->
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Group_Summary.xsl b/xslt/report-templates/Group_Summary.xsl
new file mode 100644
index 0000000..9058f78
--- /dev/null
+++ b/xslt/report-templates/Group_Summary.xsl
@@ -0,0 +1,323 @@
+<?xml version="1.0"?>
+<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:dyn="http://exslt.org/dynamic"
+ extension-element-prefixes="exsl dyn"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Collection Summary Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:variable name="limit" select="5"/>
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ background-color: #fff;
+ color: #000;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ div.field {
+ margin-left: auto;
+ margin-right: auto;
+ margin-bottom: 20px;
+ width: 750px;
+ background-color: #ddd;
+ border: solid 1px #999;
+ overflow: auto;
+ padding: 0px 0px 0px 0px;
+ }
+ h2 {
+ font-size: 125%;
+ border-bottom: solid 1px #999;
+ text-align: center;
+ margin-top: 5px;
+ margin-bottom: 0px;
+ }
+ h3 {
+ font-size: 0.9em;
+ color: #666;
+ text-align: right;
+ padding-right: 4px;
+ margin-top: -1.1em;
+ margin-bottom: 0px;
+ }
+ h4 {
+ text-align: center;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ padding: 10px 0px 10px 0px;
+ }
+ div.row {
+ margin: 0px 0px 0px 0px;
+ padding: 0px 0px 0px 0px;
+ border: solid 1px transparent;
+ clear: left;
+ overflow: auto;
+ line-height: 120%;
+ }
+ div.group {
+ text-align: left;
+ margin: 0px 0px 0px 0px;
+ padding: 0px 10px 0px 4px;
+ float: left;
+ }
+ span.bar {
+ width: 590px;
+ margin: 1px 2px 1px 150px;
+ position: absolute;
+ float: left;
+ border-left: solid 5px #ddd; /* padding of a sort */
+ }
+ span.bar span {
+ border-top: outset 1px #669;
+ border-right: outset 2px #003;
+ border-bottom: outset 2px #003;
+ border-left: outset 2px #669;
+ float: left;
+ position: absolute;
+ background-color: #336;
+ color: white;
+ padding-right: 4px;
+ padding-bottom: 2px;
+ font-size: 0.9em;
+ line-height: 0.9em;
+ text-align: right;
+ font-style: italic;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ <i18n>: Group Summary</i18n>
+ </h1>
+
+ <xsl:variable name="coll" select="."/>
+
+ <table>
+ <tbody>
+ <tr>
+ <th><i18n>Total number of fields:</i18n></th>
+ <th style="padding-right: 50px; color: #006;">
+ <xsl:value-of select="count(tc:fields/tc:field)"/>
+ </th>
+ <th><i18n>Total number of entries:</i18n></th>
+ <th style="color:#006;">
+ <xsl:value-of select="count(tc:entry)"/>
+ </th>
+ </tr>
+ </tbody>
+ </table>
+ <!-- grouping flag is second bit from right -->
+ <xsl:for-each select="tc:fields/tc:field[boolean(floor(@flags div 2) mod 2)]">
+ <xsl:call-template name="output-group">
+ <xsl:with-param name="coll" select="$coll"/>
+ <xsl:with-param name="fieldname" select="@name"/>
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <!--
+ <h4><a href="http://www.periapsis.org/tellico/"><i18n>Generated by Tellico</i18n></a></h4>
+-->
+</xsl:template>
+
+<xsl:template name="output-group">
+ <xsl:param name="coll"/>
+ <xsl:param name="fieldname"/>
+
+ <xsl:variable name="str">
+ <xsl:choose>
+ <xsl:when test="boolean(floor(key('fieldsByName', $fieldname)/@flags mod 2))">
+ <xsl:choose>
+ <xsl:when test="key('fieldsByName', $fieldname)/@type=8">
+ <xsl:value-of select="concat('$coll/tc:entry/tc:',$fieldname,'s/tc:',$fieldname,'/tc:column[1]')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('$coll/tc:entry/tc:',$fieldname,'s/tc:',$fieldname)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('$coll/tc:entry/tc:',$fieldname)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="values" select="dyn:evaluate($str)"/>
+
+ <xsl:variable name="listing">
+ <xsl:for-each select="$values[not(. = preceding::*)]">
+ <!-- speed sorting by ignoring groups with a count of 1 -->
+ <xsl:variable name="c" select="count($values[. = current()])"/>
+ <xsl:if test="$c &gt; 1">
+ <group>
+ <xsl:attribute name="name">
+ <xsl:call-template name="text-value"/>
+ </xsl:attribute>
+ <xsl:attribute name="count">
+ <xsl:value-of select="$c"/>
+ </xsl:attribute>
+ </group>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="groups" select="exsl:node-set($listing)/group"/>
+ <xsl:variable name="total" select="count($groups)"/>
+
+ <xsl:variable name="max">
+ <xsl:call-template name="max-count">
+ <xsl:with-param name="nodes" select="$groups"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$total &gt; 2">
+
+ <div class="field">
+ <h2>
+ <xsl:value-of select="key('fieldsByName', $fieldname)/@title"/>
+ </h2>
+
+ <xsl:for-each select="$groups">
+ <xsl:sort lang="$lang" select="@count" data-type="number" order="descending" />
+ <xsl:sort lang="$lang" select="@name"/>
+ <xsl:if test="position() &lt;= $limit">
+ <div class="row">
+ <div class="group">
+ <xsl:value-of select="@name"/>
+ </div>
+ <span class="bar">
+ <span>
+ <xsl:attribute name="style">
+ <xsl:text>padding-left:</xsl:text>
+ <!-- the 540 is rather arbitrarily dependent on font-size, seem to work -->
+ <xsl:value-of select="floor(540 * @count div $max)"/>
+ <xsl:text>px;</xsl:text>
+ </xsl:attribute>
+ (<xsl:value-of select="@count"/>)
+ </span>
+ </span>
+ </div>
+ </xsl:if>
+ </xsl:for-each>
+
+ <h3>
+ <i18n>Distinct values: </i18n><xsl:value-of select="$total"/>
+ </h3>
+ </div>
+
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="max-count">
+ <xsl:param name="nodes" select="/.."/>
+ <xsl:param name="max"/>
+
+ <xsl:variable name="count" select="count($nodes)"/>
+ <xsl:variable name="aNode" select="$nodes[ceiling($count div 2)]"/>
+
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select="number($max)"/>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:call-template name="max-count">
+
+ <xsl:with-param name="nodes" select="$nodes[not(@count &lt;= number($aNode/@count))]"/>
+ <xsl:with-param name="max">
+ <xsl:choose>
+ <xsl:when test="not($max) or $aNode/@count &gt; $max">
+ <xsl:value-of select="$aNode/@count"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="text-value">
+ <xsl:choose>
+ <xsl:when test="text()">
+ <xsl:value-of select="text()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="..//tc:column[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Group_View.xsl b/xslt/report-templates/Group_View.xsl
new file mode 100644
index 0000000..123559e
--- /dev/null
+++ b/xslt/report-templates/Group_View.xsl
@@ -0,0 +1,284 @@
+<?xml version="1.0"?>
+<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Group View Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<!-- To choose which fields of each entry are printed, change the
+ string to a space separated list of field names. To know what
+ fields are available, check the Tellico data file for <field>
+ elements. -->
+<xsl:param name="column-names" select="'title'"/>
+<xsl:variable name="columns" select="str:tokenize($column-names)"/>
+
+<!-- If you want the header row printed, showing which fields
+ are printed, change this to true(), otherwise false() -->
+<xsl:param name="show-headers" select="true()"/>
+
+<!-- set the maximum image size -->
+<xsl:param name="image-height" select="'100'"/>
+<xsl:param name="image-width" select="'100'"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data files are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+<xsl:key name="entriesById" match="tc:entry" use="@id"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ <xsl:if test="count($columns) &gt; 3">
+ font-size: 80%;
+ </xsl:if>
+ background-color: #fff;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ td.groupName {
+ margin-top: 10px;
+ margin-bottom: 2px;
+ padding-left: 4px;
+ background: #ccc;
+ font-size: 1.1em;
+ font-weight: bolder;
+ }
+ td.fieldName {
+ margin-top: 10px;
+ margin-bottom: 2px;
+ color: #666;
+ background-color: #ccc;
+ font-size: 1em;
+ text-align: center;
+ font-style: italic;
+ padding-left: 4px;
+ padding-right: 4px;
+ }
+ tr.r0 {
+ }
+ tr.r1 {
+ background-color: #eee;
+ }
+ td.field {
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-left: 10px;
+ padding-right: 5px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <table>
+ <tbody>
+ <xsl:variable name="fields" select="tc:fields"/>
+ <xsl:for-each select="tc:group">
+ <xsl:sort lang="$lang" select="@title"/>
+ <tr>
+ <td class="groupName">
+ <xsl:value-of select="@title"/>
+ </td>
+ <xsl:for-each select="$columns[position() &gt; 1]">
+ <td class="fieldName">
+ <xsl:call-template name="field-title">
+ <xsl:with-param name="fields" select="$fields"/>
+ <xsl:with-param name="name" select="."/>
+ </xsl:call-template>
+ </td>
+ </xsl:for-each>
+ </tr>
+
+ <xsl:for-each select="key('entriesById', tc:entryRef/@id)">
+ <tr class="r{position() mod 2}">
+ <xsl:apply-templates select="."/>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ </tbody>
+ </table>
+</xsl:template>
+
+<xsl:template name="field-title">
+ <xsl:param name="fields"/>
+ <xsl:param name="name"/>
+ <xsl:variable name="name-tokens" select="str:tokenize($name, ':')"/>
+ <!-- the header is the title field of the field node whose name equals the column name -->
+ <xsl:choose>
+ <xsl:when test="$fields">
+ <xsl:value-of select="$fields/tc:field[@name = $name-tokens[last()]]/@title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name-tokens[last()]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <!-- stick all the descendants into a variable -->
+ <xsl:variable name="current" select="descendant::*"/>
+ <xsl:variable name="entry" select="."/>
+
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+
+ <!-- find all descendants whose name matches the column name -->
+ <xsl:variable name="numvalues" select="count($current[local-name() = $column])"/>
+ <!-- if the field node exists, output its value, otherwise put in a space -->
+ <td class="field">
+ <xsl:choose>
+ <!-- when there is at least one value... -->
+ <xsl:when test="$numvalues &gt; 1">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="$numvalues = 1">
+ <xsl:for-each select="$current[local-name() = $column]">
+
+ <xsl:variable name="field" select="key('fieldsByName', $column)"/>
+ <xsl:choose>
+
+ <!-- boolean values end up as 'true', output 'X' -->
+ <xsl:when test="$field/@type=4 or $field/@type=6">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- next, check for images -->
+ <xsl:when test="$field/@type=10">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <img>
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($imgdir, .)"/>
+ </xsl:attribute>
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="key('imagesById', .)"/>
+ </xsl:call-template>
+ </img>
+ </xsl:when>
+
+ <!-- if it's a date, format with hyphens -->
+ <xsl:when test="$field/@type=12">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- handle URL here, so no link created -->
+ <xsl:when test="$field/@type=7">
+ <xsl:value-of select="."/>
+ </xsl:when>
+
+ <!-- finally, it's just a regular value -->
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Image_List.xsl b/xslt/report-templates/Image_List.xsl
new file mode 100644
index 0000000..78c596f
--- /dev/null
+++ b/xslt/report-templates/Image_List.xsl
@@ -0,0 +1,250 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="str"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Image List Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<!-- To choose which fields of each entry are printed, change the
+ string to a space separated list of field names. To know what
+ fields are available, check the Tellico data file for <field>
+ elements. -->
+<xsl:param name="column-names" select="'title'"/>
+<xsl:variable name="columns" select="str:tokenize($column-names)"/>
+
+<!-- set the maximum image size -->
+<xsl:param name="image-height" select="'150'"/>
+<xsl:param name="image-width" select="'150'"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data files are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ background-color: #fff;
+ color: #000;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ div.r0 {
+ border: 1px inset #666;
+ clear: left;
+ padding: 10px 10px 0px 10px;
+ background-color: #eee;
+ }
+ div.r1 {
+ border: 1px inset #666;
+ clear: left;
+ padding: 10px 10px 0px 10px;
+ background-color: #ddd;
+ }
+ img.float {
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ border: 2px outset #ccc;
+ }
+ td.title {
+ font-size: 1.4em;
+ font-weight: bold;
+ }
+ td.fieldName {
+ color: #666;
+ vertical-align: top;
+ }
+ td.fieldValue {
+ padding-left: 4px;
+ font-weight: bold;
+ vertical-align: top;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <!-- find first image field -->
+ <xsl:variable name="image-field" select="tc:fields/tc:field[@type=10][1]/@name"/>
+
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select=".//tc:title[1]"/>
+ <xsl:variable name="entry" select="."/>
+
+ <div class="r{position() mod 2}">
+ <xsl:variable name="id" select="./*[local-name() = $image-field]"/>
+ <xsl:if test="$id">
+ <img class="float">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($imgdir, $id)"/>
+ </xsl:attribute>
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="key('imagesById', $id)"/>
+ </xsl:call-template>
+ </img>
+ </xsl:if>
+
+ <table>
+ <thead>
+ <tr>
+ <td colspan="2" class="title">
+ <xsl:value-of select=".//tc:title[1]"/>
+ </td>
+ </tr>
+ </thead>
+
+ <tbody>
+ <!-- don't repeat title -->
+ <xsl:for-each select="$columns[. != 'title']">
+ <!-- no other images allowed -->
+ <xsl:if test="$entry/../tc:fields/tc:field[@name = current()]/@type != 10">
+ <xsl:call-template name="field-output">
+ <xsl:with-param name="entry" select="$entry"/>
+ <!-- can't use a key, the context is not the document -->
+ <xsl:with-param name="field" select="$entry/../tc:fields/tc:field[@name = current()]"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+
+ <!-- add all paragraph fields, too -->
+ <xsl:for-each select="../tc:fields/tc:field[@type = 2]">
+ <xsl:call-template name="field-output">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="."/>
+ </xsl:call-template>
+
+ </xsl:for-each>
+ </tbody>
+ </table>
+ <div style="clear: left"/>
+ </div>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="field-output">
+ <xsl:param name="entry"/>
+ <xsl:param name="field"/>
+ <tr>
+ <td class="fieldName">
+ <!-- can't use key here, context is not in document -->
+ <xsl:value-of select="$field/@title"/>
+ <xsl:text>: </xsl:text>
+ </td>
+
+ <td class="fieldValue">
+ <xsl:variable name="numvalues" select="count($entry//*[local-name() = $field/@name])"/>
+
+ <xsl:choose>
+ <xsl:when test="$numvalues &gt; 1">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$field/@name"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="$numvalues = 1">
+ <xsl:choose>
+
+ <!-- boolean values end up as 'true', output 'X' -->
+ <xsl:when test="$field/@type=4 and . = 'true'">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$field/@name"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- handle URL here, so no link created -->
+ <xsl:when test="$field/@type=7">
+ <xsl:value-of select="$entry/*[local-name() = $field/@name]"/>
+ </xsl:when>
+
+ <!-- finally, it's just a regular value -->
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$field/@name"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Loan_View.xsl b/xslt/report-templates/Loan_View.xsl
new file mode 100644
index 0000000..d52f74c
--- /dev/null
+++ b/xslt/report-templates/Loan_View.xsl
@@ -0,0 +1,201 @@
+<?xml version="1.0"?>
+<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Group View Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:key name="entriesById" match="tc:entry" use="@id"/>
+<xsl:key name="loansByDate" match="tc:loan" use="@dueDate"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ background-color: #fff;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ margin-bottom: 30px;
+ }
+ td.groupName {
+ margin-top: 10px;
+ margin-bottom: 2px;
+ padding-left: 4px;
+ background: #ccc;
+ font-size: 1.1em;
+ font-weight: bolder;
+ }
+ td.fieldName {
+ margin-top: 10px;
+ margin-bottom: 2px;
+ color: #666;
+ background-color: #ccc;
+ font-size: 1.1em;
+ text-align: center;
+ font-style: italic;
+ padding-left: 4px;
+ padding-right: 4px;
+ }
+ tr.r0 {
+ }
+ tr.r1 {
+ background-color: #eee;
+ }
+ td.field {
+ margin: 0px;
+ padding: 0px 10px 0px 10px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <table>
+ <tbody>
+ <!-- TODO: this would need to be fixed for multiple collections -->
+ <xsl:for-each select="../tc:borrowers/tc:borrower/tc:loan[generate-id(.)=generate-id(key('loansByDate', @dueDate)[1])]">
+ <xsl:sort lang="$lang" select="@dueDate"/>
+ <tr>
+ <td class="groupName">
+ <xsl:value-of select="@dueDate"/>
+ </td>
+ <td class="fieldName"><i18n>Borrower</i18n></td>
+ <td class="fieldName"><i18n>Loan Date</i18n></td>
+ <td class="fieldName"><i18n>Note</i18n></td>
+ </tr>
+
+ <xsl:for-each select="key('loansByDate', @dueDate)">
+ <tr class="r{position() mod 2}">
+ <td class="field">
+ <xsl:value-of select="key('entriesById', @entryRef)//tc:title"/>
+ </td>
+ <td class="field">
+ <xsl:value-of select="../@name"/>
+ </td>
+ <td class="field">
+ <xsl:value-of select="@loanDate"/>
+ </td>
+ <td class="field">
+ <p><xsl:value-of select="text()"/></p>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ </tbody>
+ </table>
+
+ <table>
+ <tbody>
+ <!-- TODO: this would need to be fixed for multiple collections -->
+ <xsl:for-each select="../tc:borrowers/tc:borrower">
+ <xsl:sort lang="$lang" select="@name"/>
+ <tr>
+ <td class="groupName">
+ <xsl:value-of select="@name"/>
+ </td>
+ <td class="fieldName"><i18n>Loan Date</i18n></td>
+ <td class="fieldName"><i18n>Due Date</i18n></td>
+ <td class="fieldName"><i18n>Note</i18n></td>
+ </tr>
+
+ <xsl:for-each select="tc:loan">
+ <tr class="r{position() mod 2}">
+ <td class="field">
+ <xsl:value-of select="key('entriesById', @entryRef)//tc:title"/>
+ </td>
+ <td class="field">
+ <xsl:value-of select="@loanDate"/>
+ </td>
+ <td class="field">
+ <xsl:value-of select="@dueDate"/>
+ </td>
+ <td class="field">
+ <p><xsl:value-of select="text()"/></p>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ </tbody>
+ </table>
+
+ <!--
+ <h4><a href="http://www.periapsis.org/tellico/"><i18n>Generated by Tellico</i18n></a></h4>
+-->
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Makefile.am b/xslt/report-templates/Makefile.am
new file mode 100644
index 0000000..36c6dca
--- /dev/null
+++ b/xslt/report-templates/Makefile.am
@@ -0,0 +1,21 @@
+####### kdevelop will overwrite this part!!! (begin)##########
+
+
+EXTRA_DIST = Column_View.xsl Title_Listing_(Horizontal).xsl\
+ Title_Listing_(Vertical).xsl Group_View.xsl Image_List.xsl \
+ Loan_View.xsl Group_Summary.xsl Tri-Column.xsl
+
+####### kdevelop will overwrite this part!!! (end)############
+
+xsldir = $(kde_datadir)/tellico/report-templates
+xsl_DATA = Column_View.xsl Title_Listing_(Horizontal).xsl \
+ Title_Listing_(Vertical).xsl Group_View.xsl Image_List.xsl \
+ Loan_View.xsl Group_Summary.xsl Tri-Column.xsl
+
+KDE_OPTIONS = noautodist
+
+CLEANFILES = *~
+
+# probably a better way to do this
+uninstall-hook:
+ -if [ -d $(xsldir) ]; then rmdir $(xsldir); fi
diff --git a/xslt/report-templates/Title_Listing_(Horizontal).xsl b/xslt/report-templates/Title_Listing_(Horizontal).xsl
new file mode 100644
index 0000000..30b9c95
--- /dev/null
+++ b/xslt/report-templates/Title_Listing_(Horizontal).xsl
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Title List Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:param name="num-columns" select="3"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ background-color: #fff;
+ color: #000;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ td {
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-left: 10px;
+ padding-right: 5px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ tr.r0 {
+ background-color: #fff;
+ }
+ tr.r1 {
+ background-color: #eee;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <!-- first, build sorted list -->
+ <xsl:variable name="sorted-entries">
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select=".//tc:title[1]"/>
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <table>
+ <tbody>
+
+<!--
+ <xsl:variable name="nrows"
+ select="ceiling(count(tc:entry) div $num-columns)"/>
+-->
+ <xsl:for-each select="exsl:node-set($sorted-entries)/tc:entry[position() mod $num-columns = 1]">
+ <tr class="r{position() mod 2}">
+ <xsl:apply-templates select=".|following-sibling::tc:entry[position() &lt; $num-columns]"/>
+ </tr>
+ </xsl:for-each>
+
+ </tbody>
+ </table>
+
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <td>
+ <xsl:for-each select=".//tc:title">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() &lt; last()">
+ <xsl:text>; </xsl:text>
+ <br/>
+ </xsl:if>
+ </xsl:for-each>
+</td>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Title_Listing_(Vertical).xsl b/xslt/report-templates/Title_Listing_(Vertical).xsl
new file mode 100644
index 0000000..79b6820
--- /dev/null
+++ b/xslt/report-templates/Title_Listing_(Vertical).xsl
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Title List Report
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:param name="num-columns" select="3"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ background-color: #fff;
+ color: #000;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ td {
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-left: 10px;
+ padding-right: 5px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ tr.r0 {
+ background-color: #fff;
+ }
+ tr.r1 {
+ background-color: #eee;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <table>
+ <tbody>
+
+ <!-- first, build sorted list -->
+ <xsl:variable name="sorted-entries">
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select=".//tc:title[1]"/>
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="nrows"
+ select="ceiling(count(tc:entry) div $num-columns)"/>
+
+ <!--
+ <xsl:for-each select="exsl:node-set($sorted-entries)/tc:entry[position() mod $num-columns = 1]">
+ <tr class="r{position() mod 2}">
+ <xsl:apply-templates select=".|following-sibling::tc:entry[position() &lt; $num-columns]"/>
+ </tr>
+ </xsl:for-each>
+-->
+ <xsl:for-each select="exsl:node-set($sorted-entries)/tc:entry[position() &lt;= $nrows]">
+ <xsl:variable name="idx" select="position()"/>
+ <tr class="r{$idx mod 2}">
+ <xsl:apply-templates select="."/>
+ <xsl:for-each
+ select="exsl:node-set($sorted-entries)/tc:entry[position() &gt;
+ $nrows and position() mod $nrows = ($idx mod $nrows)]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <td>
+ <xsl:for-each select=".//tc:title">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() &lt; last()">
+ <xsl:text>; </xsl:text>
+ <br/>
+ </xsl:if>
+ </xsl:for-each>
+</td>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/report-templates/Tri-Column.xsl b/xslt/report-templates/Tri-Column.xsl
new file mode 100644
index 0000000..d38dd5f
--- /dev/null
+++ b/xslt/report-templates/Tri-Column.xsl
@@ -0,0 +1,234 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - Tri-Column Report
+ Modified from VideoDB
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="../tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<xsl:param name="filename"/>
+<xsl:param name="cdate"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:variable name="image-field" select="tc:tellico/tc:collection[1]/tc:fields/tc:field[@type=10][1]/@name"/>
+
+<!-- set the maximum image size -->
+<xsl:param name="image-height" select="'150'"/>
+<xsl:param name="image-width" select="'150'"/>
+
+<xsl:param name="datadir"/> <!-- dir where Tellico data files are located -->
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ background-color: #fff;
+ color: #000;
+ }
+ #header-left {
+ margin-top: 0;
+ float: left;
+ font-size: 80%;
+ font-style: italic;
+ }
+ #header-right {
+ margin-top: 0;
+ float: right;
+ font-size: 80%;
+ font-style: italic;
+ }
+ h1.colltitle {
+ margin: 0px;
+ padding-bottom: 5px;
+ font-size: 2em;
+ text-align: center;
+ }
+ tr.r0 {
+ border: 1px inset #666;
+ background-color: #eee;
+ }
+ tr.r1 {
+ border: 1px inset #666;
+ background-color: #ddd;
+ }
+ img.float {
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ border: 2px outset #ccc;
+ }
+ td {
+ vertical-align: top;
+ }
+ span.title {
+ font-size: 1.2em;
+ font-weight: bold;
+ }
+ span.info {
+ font-size: 1.1em;
+ font-style italic;
+ color: #006;
+ }
+ span.plot {
+ font-size: 1em;
+ }
+ </style>
+ <title>Tellico</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type!=3]">
+ <h1 class="colltitle">
+ <i18n>This template is meant for video collections only.</i18n>
+ </h1>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type=3]">
+ <p id="header-left"><xsl:value-of select="$filename"/></p>
+ <p id="header-right"><xsl:value-of select="$cdate"/></p>
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ </h1>
+
+ <!-- first, build sorted list -->
+ <xsl:variable name="sorted-entries">
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select=".//tc:title[1]"/>
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- needed for key context -->
+ <xsl:variable name="coll" select="."/>
+
+ <table class="tablelist" cellpadding="0" cellspacing="0" width="100%">
+ <colgroup width="33%"/>
+ <colgroup width="34%"/>
+ <colgroup width="33%"/>
+ <tbody>
+ <!-- three columns -->
+ <!-- have to pass in image width and height because
+ context changes inside the exsl:node-set -->
+ <xsl:variable name="entries" select="exsl:node-set($sorted-entries)/tc:entry"/>
+
+ <xsl:for-each select="$entries[position() mod 3 = 1]">
+ <xsl:variable name="e1" select="."/>
+ <xsl:variable name="e2" select="$e1/following-sibling::tc:entry[position() = 1]"/>
+ <xsl:variable name="e3" select="$e2/following-sibling::tc:entry[position() = 1]"/>
+
+ <tr class="r{position() mod 2}">
+
+ <!-- switch context back to document -->
+ <xsl:for-each select="$coll">
+
+ <td>
+ <xsl:apply-templates select="$e1">
+ <xsl:with-param name="img" select="key('imagesById', $e1/*[local-name() = $image-field])"/>
+ </xsl:apply-templates>
+ </td>
+ <td>
+ <xsl:apply-templates select="$e2">
+ <xsl:with-param name="img" select="key('imagesById', $e2/*[local-name() = $image-field])"/>
+ </xsl:apply-templates>
+ </td>
+ <td>
+ <xsl:apply-templates select="$e3">
+ <xsl:with-param name="img" select="key('imagesById', $e3/*[local-name() = $image-field])"/>
+ </xsl:apply-templates>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+
+ </tbody>
+ </table>
+
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:param name="img"/>
+ <table>
+ <tbody>
+ <tr>
+ <td>
+ <xsl:variable name="id" select="./*[local-name() = $image-field]"/>
+ <xsl:if test="$id">
+ <img class="float" alt=" ">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($imgdir, $id)"/>
+ </xsl:attribute>
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="$img"/>
+ </xsl:call-template>
+ </img>
+ </xsl:if>
+ </td>
+ <td>
+ <span class="title">
+ <xsl:value-of select=".//tc:title[1]"/>
+ </span>
+ <br/>
+ <span class="info">
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select=".//tc:year[1]"/>
+ <xsl:text>; </xsl:text>
+ <xsl:value-of select=".//tc:director[1]"/>
+ <xsl:text>]</xsl:text>
+ </span>
+ <br/>
+ <span class="plot">
+ <xsl:value-of select="normalize-space(substring(./tc:plot, 1, 150))" disable-output-escaping="yes"/>
+ <xsl:text>&#xa0;&#x2026;</xsl:text>
+ </span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</xsl:template>
+
+</xsl:stylesheet>
+
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/shadowAlpha.png b/xslt/shadowAlpha.png
new file mode 100644
index 0000000..a24c9c4
--- /dev/null
+++ b/xslt/shadowAlpha.png
Binary files differ
diff --git a/xslt/tellico-by-author.xsl b/xslt/tellico-by-author.xsl
new file mode 100644
index 0000000..e71948e
--- /dev/null
+++ b/xslt/tellico-by-author.xsl
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ================================================================
+ Tellico XSLT file - sort by author
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with XML data files
+ from the 'tellico' application, which can be found at:
+ http://www.periapsis.org/tellico/
+ ================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:param name="version"/>
+
+<xsl:key name="books" match="tc:book" use=".//tc:author"/>
+<xsl:key name="authors" match="tc:author" use="."/>
+
+<!-- more efficient to specify complete XPath like this than to use //tc:author -->
+<xsl:variable name="unique-authors" select="/tc:tellico/tc:collection/tc:entry/tc:authors/tc:author[generate-id(.)=generate-id(key('authors', .)[1])]"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <title>My Book Collections - sorted by author</title>
+ <style type="text/css">
+ body {
+ background: #999999;
+ margin: 0px;
+ font-family: Verdana, Arial, sans-serif;
+ color: black;
+ }
+ #headerblock {
+ padding-top: 10px;
+ padding-bottom: 10px;
+ margin-bottom: 5px;
+ }
+ .title {
+ padding: 4px;
+ line-height: 18px;
+ font-size: 24px;
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ margin: 0px;
+ }
+ .subtitle {
+ margin-left: 10px;
+ font-size: 12px;
+ }
+ .author {
+ margin-right: 3px;
+ margin-bottom: 2px;
+ background: #eee;
+ font-size: 14px;
+ font-weight: bold;
+ }
+ .books {
+ background: rgb(204,204,204);
+ padding-left: 4px;
+ margin-left: 15px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+ font-size: 12px;
+ }
+ ul {
+ margin: 0px;
+ padding: 0px;
+ }
+ </style>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <div id="headerblock">
+ <div class="title">
+ <xsl:value-of select="@title"/>
+ <xsl:text> </xsl:text>
+ <span class="subtitle">sorted by author</span>
+ </div>
+ </div>
+
+ <!-- first output any with no author -->
+ <xsl:variable name="no-author" select="/tc:tellico/tc:collection/tc:entry[count(tc:authors/tc:author) = 0"/>
+ <xsl:if test="count($no-author) &gt; 0">
+ <div class="author">
+ <xsl:text>(Empty)</xsl:text>
+ </div>
+ <div class="books">
+ <ul>
+ <xsl:for-each select="$no-author">
+ <xsl:sort lang="$lang" select="tc:title"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </xsl:if>
+
+ <xsl:for-each select="$unique-authors">
+ <xsl:sort lang="$lang" select="."/>
+ <div class="author">
+ <xsl:value-of select="."/>
+ </div>
+ <div class="books">
+ <ul>
+ <xsl:for-each select="key('books', .)">
+ <xsl:sort lang="$lang" select="tc:title"/>
+<!-- or sort by series and number -->
+<!-- <xsl:sort select="tc:series"/>
+ <xsl:sort select="tc:series_num"/> -->
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <li>
+ <xsl:value-of select="tc:title"/>
+ </li>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/tellico-by-title.xsl b/xslt/tellico-by-title.xsl
new file mode 100644
index 0000000..de023c4
--- /dev/null
+++ b/xslt/tellico-by-title.xsl
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ================================================================
+ Tellico XSLT file - sort by author
+
+ Copyright (C) 2003-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with XML data files
+ from the 'tellico' application, which can be found at:
+ http://www.periapsis.org/tellico/
+ ================================================================
+-->
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <xsl:if test="@syntaxVersion &lt; '10'">
+ <xsl:message>
+ <xsl:text>This stylesheet was designed for Tellico DTD version </xsl:text>
+ <xsl:value-of select="'7'"/>
+ <xsl:text>or earlier, &#xa;but the input data file is version </xsl:text>
+ <xsl:value-of select="@syntaxVersion"/>
+ <xsl:text>. There might be some &#xa;problems with the output.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+
+ <html>
+ <head>
+ <title>My Book Collections - sorted by title</title>
+ <style type="text/css">
+ body {
+ background: #999;
+ margin: 0px;
+ font-family: Verdana, Arial, sans-serif;
+ color: black;
+ }
+ #headerblock {
+ padding-top: 10px;
+ padding-bottom: 10px;
+ margin-bottom: 5px;
+ }
+ .title {
+ padding: 4px;
+ line-height: 18px;
+ font-size: 24px;
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ margin: 0px;
+ }
+ .subtitle {
+ margin-left: 10px;
+ font-size: 12px;
+ }
+ .books {
+ background: rgb(204,204,204);
+ padding-left: 4px;
+ margin-left: 15px;
+ margin-bottom: 5px;
+ margin-right: 15px;
+ font-size: 12px;
+ }
+ ul {
+ margin: 0px;
+ padding: 0px;
+ }
+ </style>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <div id="headerblock">
+ <div class="title">
+ <xsl:value-of select="@title"/>
+ <xsl:text> </xsl:text>
+ <span class="subtitle">sorted by title</span>
+ </div>
+ </div>
+
+ <div class="books">
+ <ol>
+ <xsl:for-each select="/tc:tellico/tc:collection/tc:entry">
+ <xsl:sort lang="$lang" select="tc:title"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </ol>
+ </div>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <li>
+ <xsl:value-of select="tc:title"/><br/>
+ </li>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/tellico-common.xsl b/xslt/tellico-common.xsl
new file mode 100644
index 0000000..5a75efc
--- /dev/null
+++ b/xslt/tellico-common.xsl
@@ -0,0 +1,307 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - some common templates.
+
+ Copyright (C) 2004-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+ ===================================================================
+-->
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<!-- Template for checking syntax version -->
+<xsl:template name="syntax-version">
+ <xsl:param name="this-version"/>
+ <xsl:param name="data-version"/>
+ <xsl:if test="$data-version &gt; $this-version">
+ <xsl:message>
+ <xsl:text>This stylesheet was designed for Tellico DTD version </xsl:text>
+ <xsl:value-of select="$this-version"/>
+ <xsl:text> or earlier, &#xa;but the input data file is version </xsl:text>
+ <xsl:value-of select="$data-version"/>
+ <xsl:text>. There might be some &#xa;problems with the output.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+</xsl:template>
+
+<!-- template for creating attributes to scale an image to a max boundary size -->
+<xsl:template name="image-size">
+ <xsl:param name="limit-height" select="'0'"/>
+ <xsl:param name="limit-width" select="'0'"/>
+ <xsl:param name="image"/>
+
+ <xsl:variable name="actual-width" select="$image/@width"/>
+ <xsl:variable name="actual-height" select="$image/@height"/>
+
+ <xsl:choose>
+ <xsl:when test="$limit-width &gt; 0 and $limit-height &gt; 0 and
+ ($actual-width &gt; $limit-width or $actual-height &gt; $limit-height)">
+
+ <xsl:choose>
+
+ <xsl:when test="$actual-width * $limit-height &lt; $actual-height * $limit-width">
+ <xsl:attribute name="height">
+ <xsl:value-of select="round($limit-height)"/>
+ </xsl:attribute>
+ <xsl:attribute name="width">
+ <xsl:value-of select="round($actual-width * $limit-height div $actual-height)"/>
+ </xsl:attribute>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:attribute name="width">
+ <xsl:value-of select="round($limit-width)"/>
+ </xsl:attribute>
+ <xsl:attribute name="height">
+ <xsl:value-of select="round($actual-height * $limit-width div $actual-width)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+
+ </xsl:choose>
+
+ </xsl:when>
+
+ <!-- if both are smaller, no change -->
+ <xsl:when test="$actual-width &gt; 0 and $actual-height &gt; 0">
+ <xsl:attribute name="width">
+ <xsl:value-of select="$actual-width"/>
+ </xsl:attribute>
+ <xsl:attribute name="height">
+ <xsl:value-of select="$actual-height"/>
+ </xsl:attribute>
+ </xsl:when>
+
+ </xsl:choose>
+</xsl:template>
+
+<!-- template for outputing most value types -->
+<xsl:template name="simple-field-value">
+ <xsl:param name="entry"/>
+ <xsl:param name="field"/>
+
+ <!-- if the field has multiple values, then there is
+ no child of the entry with the field name -->
+ <xsl:variable name="child" select="$entry/*[local-name(.)=$field]"/>
+ <xsl:choose>
+ <xsl:when test="$child">
+ <xsl:variable name="f" select="$entry/../tc:fields/tc:field[@name = $field]"/>
+
+ <!-- if the field is a bool type, just ouput an X, or use data image -->
+ <xsl:choose>
+ <!-- paragraphs need to have output escaping disabled so HTML works -->
+ <xsl:when test="$f/@type=2">
+ <xsl:value-of select="$child" disable-output-escaping="yes"/>
+ </xsl:when>
+
+ <xsl:when test="$f/@type=4">
+ <img height="14" alt="&#x2713;">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($datadir,'pics/checkmark.png')"/>
+ </xsl:attribute>
+ </img>
+ </xsl:when>
+
+ <!-- if it's a url, then add a hyperlink -->
+ <xsl:when test="$f/@type=7">
+ <a href="{$child}">
+ <!-- The Amazon Web Services license requires the link -->
+ <xsl:choose>
+ <xsl:when test="$field = 'amazon'">
+ <xsl:text>Buy from Amazon.com</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$child"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </a>
+ </xsl:when>
+
+ <!-- if it's a date, format with hyphens -->
+ <xsl:when test="$f/@type=12">
+ <xsl:value-of select="$child/tc:year"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="format-number($child/tc:month,'00')"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="format-number($child/tc:day,'00')"/>
+ </xsl:when>
+
+ <!-- special case for rating -->
+ <xsl:when test="$f/@type=14">
+ <!-- get the number, could be 10, so can't just grab first digit -->
+ <xsl:variable name="n">
+ <xsl:choose>
+ <xsl:when test="number(substring($child,1,1))">
+ <xsl:choose>
+ <xsl:when test="number(substring($child,1,2)) &lt; 11">
+ <xsl:value-of select="number(substring($child,1,2))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(substring($child,1,1))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="false()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$n &gt; 0">
+ <!-- the image is really 18 pixels high, but make it smaller to match default font -->
+ <img height="14">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($datadir,'pics/stars',$n,'.png')"/>
+ </xsl:attribute>
+ <xsl:attribute name="alt">
+ <xsl:value-of select="concat($n,' stars')"/>
+ </xsl:attribute>
+ </img>
+ </xsl:if>
+ <xsl:if test="not($n)">
+ <xsl:value-of select="$child"/>
+ </xsl:if>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:value-of select="$child"/>
+ <!-- hack for running-time in videos -->
+ <!--
+ <xsl:if test="$field='running-time' and key('fieldsByName',$field)/@type=6">
+ <xsl:text> minutes</xsl:text>
+ </xsl:if>
+ -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <!-- now handle fields with multiple values -->
+ <xsl:otherwise>
+ <xsl:for-each select="$entry/*[local-name()=concat($field,'s')]/*">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() != last()">
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="image-link">
+ <xsl:param name="image"/>
+ <xsl:param name="dir"/>
+ <xsl:variable name="id" select="$image/@id"/>
+ <xsl:choose>
+ <xsl:when test="$image/@link = 'true'">
+ <!-- the id _is_ the link -->
+ <xsl:value-of select="$id"/>
+ </xsl:when>
+ <xsl:when test="string-length($dir) &gt; 0">
+ <xsl:value-of select="concat($dir, $id)"/>
+ </xsl:when>
+ <!-- otherwise try $imgdir and $datadir -->
+ <xsl:when test="string-length($datadir) &gt; 0">
+ <xsl:value-of select="concat($datadir, $id)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($imgdir, $id)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="msqueeze">
+ <xsl:param name="str"/>
+ <xsl:param name="len"/>
+
+ <xsl:variable name="slen" select="string-length($str)"/>
+ <xsl:variable name="mid" select="floor($len div 2)"/>
+
+ <xsl:choose>
+ <xsl:when test="$slen &gt; $len">
+ <xsl:value-of select="substring($str, 0, $mid - 2)"/>
+ <xsl:text>[...]</xsl:text>
+ <xsl:value-of select="substring($str, $slen - $mid + 3, $mid - 2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- sums all nodes, assuming they are in MM:SS format -->
+<xsl:template name="sumTime">
+ <xsl:param name="nodes" select="/.."/>
+ <xsl:param name="totalMin" select="0"/>
+ <xsl:param name="totalSec" select="0"/>
+
+ <xsl:choose>
+
+ <xsl:when test="not($nodes)">
+ <xsl:value-of select="$totalMin + floor($totalSec div 60)"/>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="format-number($totalSec mod 60, '00')"/>
+ </xsl:when>
+
+ <xsl:when test="string-length($nodes[1]) &gt; 0">
+ <xsl:variable name="min">
+ <xsl:value-of select="substring-before($nodes[1], ':')"/>
+ </xsl:variable>
+ <xsl:variable name="sec">
+ <xsl:value-of select="substring-after($nodes[1], ':')"/>
+ </xsl:variable>
+ <xsl:call-template name="sumTime">
+ <xsl:with-param name="nodes" select="$nodes[position() != 1]"/>
+ <xsl:with-param name="totalMin" select="$totalMin + $min"/>
+ <xsl:with-param name="totalSec" select="$totalSec + $sec"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:call-template name="sumTime">
+ <xsl:with-param name="nodes" select="$nodes[position() != 1]"/>
+ <xsl:with-param name="totalMin" select="$totalMin"/>
+ <xsl:with-param name="totalSec" select="$totalSec"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="columnTitle">
+ <xsl:param name="index" select="1"/>
+ <xsl:param name="max" select="10"/>
+ <xsl:param name="elem" select="'th'"/>
+ <xsl:param name="style"/>
+ <xsl:param name="field" select="/.."/>
+
+ <xsl:if test="not($index &gt; $max)">
+ <xsl:element name="{$elem}">
+ <xsl:if test="string-length($style)">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$style"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$field/tc:prop[@name = concat('column', $index)]"/>
+ </xsl:element>
+
+ <xsl:call-template name="columnTitle">
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="max" select="$max"/>
+ <xsl:with-param name="elem" select="$elem"/>
+ <xsl:with-param name="style" select="$style"/>
+ <xsl:with-param name="field" select="$field"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/tellico-printing.xsl b/xslt/tellico-printing.xsl
new file mode 100644
index 0000000..bbc8ee4
--- /dev/null
+++ b/xslt/tellico-printing.xsl
@@ -0,0 +1,381 @@
+<?xml version="1.0"?>
+<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for printing
+
+ Copyright (C) 2004-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ The exslt extensions from http://www.exslt.org are required.
+ Specifically, the string and dynamic modules are used. For
+ libxslt, that means the minimum version is 1.0.19.
+
+ This is a horribly messy stylesheet. I would REALLY welcome any
+ recommendations in improving its efficiency.
+
+ There may be problems if this stylesheet is used to transform the
+ actual Tellico data file, since the application re-arranges the
+ DOM for printing. THe primary change is the addition of group
+ elements to speed up grouped printing.
+
+ Any version of this file in the user's home directory, such as
+ $KDEHOME/share/apps/tellico/, will override the system file.
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<!-- To choose which fields of each entry are printed, change the
+ string to a space separated list of field names. To know what
+ fields are available, check the Tellico data file for <field>
+ elements. -->
+<xsl:param name="column-names" select="'title'"/>
+<xsl:variable name="columns" select="str:tokenize($column-names)"/>
+
+<!-- If you want the header row printed, showing which fields
+ are printed, change this to true(), otherwise false() -->
+<xsl:param name="show-headers" select="true()"/>
+
+<!-- set the maximum image size -->
+<xsl:param name="image-height" select="50"/>
+<xsl:param name="image-width" select="50"/>
+
+<!-- This is the title just beside the collection name. It will
+ automatically list which fields are used for sorting. -->
+<xsl:param name="sort-title" select="''"/>
+
+<!--
+ ===================================================================
+ The only thing below here that you might want to change is the CSS
+ governing the appearance of the output HTML.
+ ===================================================================
+-->
+
+<!-- The page-title is used for the HTML title -->
+<xsl:param name="page-title" select="'Tellico'"/>
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="entriesById" match="tc:entry" use="@id"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+
+<xsl:variable name="endl">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ <xsl:if test="count($columns) &gt; 3">
+ font-size: 80%;
+ </xsl:if>
+ background-color: #fff;
+ }
+ #headerblock {
+ padding-top: 10px;
+ padding-bottom: 10px;
+ width: 100%;
+ text-align: center;
+ }
+ div.colltitle {
+ padding: 4px;
+ font-size: 2em;
+ }
+ table {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ td.groupName {
+ margin-top: 10px;
+ margin-bottom: 2px;
+ padding-left: 4px;
+ background: #ccc;
+ font-size: 1.1em;
+ font-weight: bolder;
+ }
+ th {
+ color: #000;
+ background-color: #ccc;
+ border: 1px solid #999;
+ font-size: 1.1em;
+ font-weight: bold;
+ padding-left: 4px;
+ padding-right: 4px;
+ }
+ tr.entry1 {
+ }
+ tr.entry2 {
+ background-color: #eee;
+ }
+ tr.groupEntry1 {
+ }
+ tr.groupEntry2 {
+ background-color: #eee;
+ }
+ td.field {
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-left: 5px;
+ padding-right: 5px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ </style>
+ <title>
+ <xsl:value-of select="$page-title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <div id="headerblock">
+ <div class="colltitle">
+ <xsl:value-of select="@title"/>
+ </div>
+ <div class="sortTitle">
+ <xsl:value-of select="$sort-title"/>
+ </div>
+ </div>
+
+ <table>
+
+ <xsl:if test="$show-headers">
+ <xsl:variable name="fields" select="tc:fields"/>
+ <thead>
+ <tr>
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+ <th>
+ <xsl:call-template name="field-title">
+ <xsl:with-param name="fields" select="$fields"/>
+ <xsl:with-param name="name" select="$column"/>
+ </xsl:call-template>
+ </th>
+ </xsl:for-each>
+ </tr>
+ </thead>
+ </xsl:if>
+
+ <tbody>
+
+ <!-- If the entries are not being grouped, it's easy -->
+ <xsl:if test="not(tc:group)">
+ <xsl:for-each select="tc:entry">
+ <tr>
+ <xsl:choose>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:attribute name="class">
+ <xsl:text>entry1</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:text>entry2</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="."/>
+ </tr>
+ </xsl:for-each>
+ </xsl:if> <!-- end ungrouped output -->
+
+ <!-- If the entries are being grouped, it's a bit more involved -->
+ <xsl:if test="tc:group">
+ <xsl:variable name="coll" select="."/>
+ <xsl:for-each select="tc:group">
+ <tr>
+ <td class="groupName">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="count($columns)"/>
+ </xsl:attribute>
+ <xsl:value-of select="@title"/>
+ </td>
+ </tr>
+ <xsl:for-each select="tc:entryRef">
+ <tr>
+ <xsl:choose>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:attribute name="class">
+ <xsl:text>groupEntry1</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:text>groupEntry2</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="key('entriesById', @id)"/>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+
+ </tbody>
+ </table>
+</xsl:template>
+
+<xsl:template name="field-title">
+ <xsl:param name="fields"/>
+ <xsl:param name="name"/>
+ <xsl:variable name="name-tokens" select="str:tokenize($name, ':')"/>
+ <!-- the header is the title field of the field node whose name equals the column name -->
+ <xsl:choose>
+ <xsl:when test="$fields">
+ <xsl:value-of select="$fields/tc:field[@name = $name-tokens[last()]]/@title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name-tokens[last()]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+ <!-- stick all the descendants into a variable -->
+ <xsl:variable name="current" select="descendant::*"/>
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+ <!-- find all descendants whose name matches the column name -->
+ <xsl:variable name="numvalues" select="count($current[local-name() = $column])"/>
+ <!-- if the field node exists, output its value, otherwise put in a space -->
+ <td class="field">
+ <!-- first column should not be centered -->
+ <!-- nor should rating images be centered -->
+ <xsl:if test="position()=1 or $entry/../tc:fields/tc:field[@name=$column]/@type=14">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: left; padding-left: 10px</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- when there is at least one value... -->
+ <xsl:when test="$numvalues &gt; 1">
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="$numvalues = 1">
+ <xsl:for-each select="$current[local-name() = $column]">
+ <xsl:variable name="field" select="key('fieldsByName', $column)"/>
+
+ <xsl:choose>
+
+ <!-- boolean and number values -->
+ <xsl:when test="$field/@type=4 or $field/@type=6">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- check for multi-column table -->
+ <xsl:when test="$field/@type=8 and $field/tc:prop[@name = 'columns'] &gt; 1">
+ <!-- italicize all columns after the first -->
+ <xsl:value-of select="tc:column[1]"/>
+ <xsl:for-each select="tc:column[position &gt; 1]">
+ <xsl:text> - </xsl:text>
+ <em>
+ <xsl:value-of select="."/>
+ </em>
+ </xsl:for-each>
+ <br/>
+ </xsl:when>
+
+ <!-- next, check for images -->
+ <xsl:when test="$field/@type=10">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <img>
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($imgdir, .)"/>
+ </xsl:attribute>
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="key('imagesById', .)"/>
+ </xsl:call-template>
+ </img>
+ </xsl:when>
+
+ <!-- if it's a date, format with hyphens -->
+ <xsl:when test="$field/@type=12">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="tc:year"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="format-number(tc:month,'00')"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="format-number(tc:day,'00')"/>
+ </xsl:when>
+
+ <!-- paragraphs need to have output escaping disabled so HTML works -->
+ <xsl:when test="$field/@type=2">
+ <xsl:value-of select="." disable-output-escaping="yes"/>
+ </xsl:when>
+
+ <!-- finally, it's just a regular value -->
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/tellico2gcstar.xsl b/xslt/tellico2gcstar.xsl
new file mode 100644
index 0000000..b4cf394
--- /dev/null
+++ b/xslt/tellico2gcstar.xsl
@@ -0,0 +1,286 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:math="http://exslt.org/math"
+ xmlns:a="uri:attribute"
+ exclude-result-prefixes="tc a"
+ extension-element-prefixes="math"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for exporting to GCstar
+
+ Copyright (C) 2008 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at
+ http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- the mapping from gcstar attribute to tellico element is automated here -->
+<!-- @name is the gcstar attribute name, the value is the tellico element local-name() -->
+<!-- bool attributes are special, and some only apply to certain collection types -->
+<a:attributes>
+ <a:attribute name="isbn">isbn</a:attribute>
+ <a:attribute name="title">title</a:attribute>
+ <a:attribute name="publisher">publisher</a:attribute>
+ <a:attribute name="publication">pub_year</a:attribute>
+ <a:attribute name="language">language</a:attribute>
+ <a:attribute name="serie">series</a:attribute>
+ <a:attribute name="edition">edition</a:attribute>
+ <a:attribute name="pages">pages</a:attribute>
+ <a:attribute name="added">pur_date</a:attribute>
+ <a:attribute name="acquisition">pur_date</a:attribute>
+ <a:attribute name="location">location</a:attribute>
+ <a:attribute name="translator">translator</a:attribute>
+ <a:attribute name="artist">artist</a:attribute>
+ <a:attribute name="director">director</a:attribute>
+ <a:attribute name="date">year</a:attribute>
+ <a:attribute name="video">format</a:attribute>
+ <a:attribute name="original">origtitle</a:attribute>
+ <a:attribute name="format">binding</a:attribute>
+ <a:attribute name="format">medium</a:attribute>
+ <a:attribute name="format">format</a:attribute>
+ <a:attribute name="web">url</a:attribute>
+ <a:attribute name="webPage">url</a:attribute>
+ <a:attribute name="read" format="bool" type="GCbooks">read</a:attribute>
+ <a:attribute name="seen" format="bool" type="GCfilms">seen</a:attribute>
+ <a:attribute name="favourite" format="bool">favorite</a:attribute>
+ <a:attribute name="label">label</a:attribute>
+ <a:attribute name="release">year</a:attribute>
+ <a:attribute name="composer">composer</a:attribute>
+ <a:attribute name="producer">producer</a:attribute>
+</a:attributes>
+<xsl:variable name="collType">
+ <xsl:choose>
+ <xsl:when test="tc:tellico/tc:collection/@type=2 or tc:tellico/tc:collection/@type=5">
+ <xsl:text>GCbooks</xsl:text>
+ </xsl:when>
+ <xsl:when test="tc:tellico/tc:collection/@type=3">
+ <xsl:text>GCfilms</xsl:text>
+ </xsl:when>
+ <xsl:when test="tc:tellico/tc:collection/@type=4">
+ <xsl:text>GCmusics</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+</xsl:variable>
+<!-- grab all the applicable attributes once -->
+<xsl:variable name="attributes" select="document('')/*/a:attributes/a:attribute[not(@type) or @type=$collType]"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <xsl:apply-templates select="tc:collection"/>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type&lt;2 or @type&gt;5]">
+ <xsl:message terminate="yes">
+ <xsl:text>GCstar export is not supported for this collection type.</xsl:text>
+ </xsl:message>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type&gt;1 and @type&lt;6]">
+ <collection items="{count(tc:entry)}" type="{$collType}">
+ <information>
+ <maxId>
+ <xsl:value-of select="math:max(tc:entry/@id)"/>
+ </maxId>
+ </information>
+ <xsl:apply-templates select="tc:entry"/>
+ </collection>
+</xsl:template>
+
+<!-- no output for fields or images -->
+<xsl:template match="tc:fields"/>
+<xsl:template match="tc:images"/>
+
+<xsl:template match="tc:entry">
+ <xsl:variable name="entry" select="."/>
+ <item id="{@id}" rating="{tc:rating * 2}">
+ <xsl:for-each select="$attributes">
+ <xsl:call-template name="handle-attribute">
+ <xsl:with-param name="att" select="."/>
+ <xsl:with-param name="entry" select="$entry"/>
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <xsl:if test="tc:running-time">
+ <xsl:attribute name="time">
+ <xsl:value-of select="concat(tc:running-time, ' min')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="tc:nationalitys">
+ <xsl:attribute name="country">
+ <xsl:for-each select="tc:nationalitys/tc:nationality">
+ <xsl:value-of select="."/>
+ <xsl:if test="position() &lt; last()">
+ <xsl:text> / </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="tc:certification">
+ <xsl:attribute name="age">
+ <xsl:choose>
+ <xsl:when test="tc:certification = 'U (USA)'">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="tc:certification = 'G (USA)'">
+ <xsl:text>2</xsl:text>
+ </xsl:when>
+ <xsl:when test="tc:certification = 'PG (USA)'">
+ <xsl:text>5</xsl:text>
+ </xsl:when>
+ <xsl:when test="tc:certification = 'PG-13 (USA)'">
+ <xsl:text>13</xsl:text>
+ </xsl:when>
+ <xsl:when test="tc:certification = 'R (USA)'">
+ <xsl:text>18</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+
+ <!-- for books -->
+ <comments>
+ <xsl:value-of select="tc:comments"/>
+ </comments>
+ <authors>
+ <xsl:call-template name="multiline">
+ <xsl:with-param name="elem" select="tc:authors"/>
+ </xsl:call-template>
+ </authors>
+ <genre>
+ <xsl:call-template name="multiline">
+ <xsl:with-param name="elem" select="tc:genres"/>
+ </xsl:call-template>
+ </genre>
+ <tags>
+ <xsl:call-template name="multiline">
+ <xsl:with-param name="elem" select="tc:keywords"/>
+ </xsl:call-template>
+ </tags>
+
+ <!-- for movies -->
+ <comment> <!-- note the lack of an 's' -->
+ <xsl:value-of select="tc:comments"/>
+ </comment>
+ <synopsis>
+ <xsl:value-of select="tc:plot"/>
+ </synopsis>
+<!--
+ <directors>
+ <xsl:call-template name="multiline">
+ <xsl:with-param name="elem" select="tc:directors"/>
+ </xsl:call-template>
+ </directors>
+-->
+ <actors>
+ <xsl:call-template name="table">
+ <xsl:with-param name="elem" select="tc:casts"/>
+ </xsl:call-template>
+ </actors>
+ <subt>
+ <xsl:call-template name="multiline">
+ <xsl:with-param name="elem" select="tc:subtitles"/>
+ </xsl:call-template>
+ </subt>
+ <xsl:apply-templates select="tc:languages"/>
+
+ <!-- for music -->
+ <xsl:apply-templates select="tc:tracks"/>
+
+ </item>
+</xsl:template>
+
+<xsl:template match="tc:languages">
+ <audio>
+ <xsl:for-each select="tc:language">
+ <line>
+ <col>
+ <xsl:value-of select="."/>
+ </col>
+ <col>
+ <!-- expect a language to always have a track -->
+ <xsl:value-of select="../../tc:audio-tracks/tc:audio-track[position()]"/>
+ </col>
+ </line>
+ </xsl:for-each>
+ </audio>
+</xsl:template>
+
+<xsl:template match="tc:tracks">
+ <tracks>
+ <xsl:for-each select="tc:track">
+ <line>
+ <col>
+ <xsl:value-of select="position()"/>
+ </col>
+ <col>
+ <xsl:value-of select="tc:column[1]"/>
+ </col>
+ <col>
+ <xsl:value-of select="tc:column[3]"/>
+ </col>
+ </line>
+ </xsl:for-each>
+ </tracks>
+</xsl:template>
+
+<xsl:template name="multiline">
+ <xsl:param name="elem"/>
+ <xsl:for-each select="$elem/child::*">
+ <line>
+ <col>
+ <xsl:value-of select="."/>
+ </col>
+ </line>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="table">
+ <xsl:param name="elem"/>
+ <xsl:for-each select="$elem/child::*">
+ <line>
+ <xsl:for-each select="child::*">
+ <col>
+ <xsl:value-of select="."/>
+ </col>
+ </xsl:for-each>
+ </line>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="handle-attribute">
+ <xsl:param name="att"/>
+ <xsl:param name="entry"/>
+ <!-- should technically check namespace, too, but unlikely to match -->
+ <xsl:variable name="value" select="$entry//*[local-name()=$att][1]"/>
+ <xsl:choose>
+ <xsl:when test="$att/@format='bool'">
+ <xsl:attribute name="{$att/@name}">
+ <xsl:value-of select="number($value='true')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="string-length($value) &gt; 0">
+ <xsl:attribute name="{$att/@name}">
+ <xsl:value-of select="$value"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/tellico2html.js b/xslt/tellico2html.js
new file mode 100644
index 0000000..8a3f5df
--- /dev/null
+++ b/xslt/tellico2html.js
@@ -0,0 +1,620 @@
+function showAll() {
+ // for now, assume only 1 table
+ tbl = document.getElementsByTagName("table")[0];
+ bdy = tbl.getElementsByTagName("tbody")[0];
+ rows = bdy.getElementsByTagName("tr");
+ for(i=0;i<rows.length;i++) {
+// rows[i].style.display="table-row";
+ if(i % 2) { rows[i].className='entry0'; }
+ else { rows[i].className='entry1'; }
+ }
+}
+
+function checkQuery() {
+ s = queryVariable("searchText");
+ if(s=="") {
+ return;
+ }
+ doSearch(s);
+}
+
+function searchRows() {
+ s = document.getElementById("searchText").value;
+ if(s=="") {
+ showAll();
+ return;
+ }
+ doSearch(s);
+}
+
+function doSearch(s) {
+ re = new RegExp(s,"i")
+ tbl = document.getElementsByTagName("table")[0];
+ bdy = tbl.getElementsByTagName("tbody")[0];
+ rows = bdy.getElementsByTagName("tr");
+ j = 0;
+ for(i=0; i<rows.length; i++) {
+ s = ts_getInnerText(rows[i]);
+ if(re.test(s)) {
+// rows[i].style.display="table-row";
+ if(j % 2) { rows[i].className='entry1'; }
+ else { rows[i].className='entry0'; }
+ j++;
+ } else {
+// rows[i].style.display="none";
+ // for msie
+ rows[i].className='hidden';
+ }
+ }
+}
+
+function addEvent(elm, evType, fn, useCapture) {
+// addEvent and removeEvent
+// cross-browser event handling for IE5+, NS6 and Mozilla
+// By Scott Andrew
+ if (elm.addEventListener) {
+ elm.addEventListener(evType, fn, useCapture);
+ return true;
+ } else if (elm.attachEvent) {
+ var r = elm.attachEvent("on"+evType, fn);
+ return r;
+ }
+}
+
+addEvent(window, "load", checkQuery);
+
+function queryVariable(variable) {
+ var query = window.location.search.substring(1);
+ var vars = query.split("&");
+ for (var i=0;i<vars.length;i++) {
+ var pair = vars[i].split("=");
+ if (pair[0] == variable) {
+ return pair[1];
+ }
+ }
+ return "";
+}
+
+function ts_getInnerText(el) {
+ if (typeof el == "string") return el;
+ if (typeof el == "undefined") { return el };
+ if (el.innerText) return el.innerText; //Not needed but it is faster
+ var str = "";
+
+ var cs = el.childNodes;
+ var l = cs.length;
+ for (var i = 0; i < l; i++) {
+ switch (cs[i].nodeType) {
+ case 1: //ELEMENT_NODE
+ str += ts_getInnerText(cs[i]);
+ break;
+ case 3: //TEXT_NODE
+ str += cs[i].nodeValue;
+ break;
+ }
+ }
+ return str;
+}
+
+/*
+ SortTable
+ version 2
+ 7th April 2007
+ Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
+
+ Instructions:
+ Download this file
+ Add <script src="sorttable.js"></script> to your HTML
+ Add class="sortable" to any table you'd like to make sortable
+ Click on the headers to sort
+
+ Thanks to many, many people for contributions and suggestions.
+ Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+ This basically means: do what you want with it.
+*/
+
+
+var stIsIE = /*@cc_on!@*/false;
+
+sorttable = {
+ init: function() {
+ // quit if this function has already been called
+ if (arguments.callee.done) return;
+ // flag this function so we don't do the same thing twice
+ arguments.callee.done = true;
+ // kill the timer
+ if (_timer) clearInterval(_timer);
+
+ if (!document.createElement || !document.getElementsByTagName) return;
+
+ sorttable.DATE_RE = /^(\d\d)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
+ sorttable.YYMMDD_RE = /^((\d\d)?\d\d)[\/\.-](\d\d?)[\/\.-](\d\d)$/;
+
+ forEach(document.getElementsByTagName('table'), function(table) {
+ if (table.className.search(/\bsortable\b/) != -1) {
+ sorttable.makeSortable(table);
+ }
+ });
+
+ },
+
+ makeSortable: function(table) {
+ if (table.getElementsByTagName('thead').length == 0) {
+ // table doesn't have a tHead. Since it should have, create one and
+ // put the first table row in it.
+ the = document.createElement('thead');
+ the.appendChild(table.rows[0]);
+ table.insertBefore(the,table.firstChild);
+ }
+ // Safari doesn't support table.tHead, sigh
+ if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
+
+ if (table.tHead.rows.length != 1) return; // can't cope with two header rows
+
+ // work through each column and calculate its type
+ headrow = table.tHead.rows[0].cells;
+ for (var i=0; i<headrow.length; i++) {
+ // manually override the type with a sorttable_type attribute
+ if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
+ mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
+ if (mtch) { override = mtch[1]; }
+ if (mtch && typeof sorttable["sort_"+override] == 'function') {
+ headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
+ } else {
+ var sortType = COL_SORT_ARRAY[i];
+ if (sortType == 0) headrow[i].sorttable_sortfunction = sorttable["sort_alpha"];
+ else if (sortType == 1) headrow[i].sorttable_sortfunction = sorttable["sort_numeric"];
+ else if (sortType == 2) headrow[i].sorttable_sortfunction = sorttable["sort_yymmdd"];
+ else headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
+ }
+ // make it clickable to sort
+ headrow[i].sorttable_columnindex = i;
+ headrow[i].sorttable_tbody = table.tBodies[0];
+ dean_addEvent(headrow[i],"click", function(e) {
+
+ if (this.className.search(/\bsorttable_sorted\b/) != -1) {
+ // if we're already sorted by this column, just
+ // reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted',
+ 'sorttable_sorted_reverse');
+ this.removeChild(document.getElementById('sorttable_sortfwdind'));
+ sortrevind = document.createElement('span');
+ sortrevind.id = "sorttable_sortrevind";
+ sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
+ this.appendChild(sortrevind);
+ return;
+ }
+ if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
+ // if we're already sorted by this column in reverse, just
+ // re-reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted_reverse',
+ 'sorttable_sorted');
+ this.removeChild(document.getElementById('sorttable_sortrevind'));
+ sortfwdind = document.createElement('span');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
+ this.appendChild(sortfwdind);
+ return;
+ }
+
+ // remove sorttable_sorted classes
+ theadrow = this.parentNode;
+ forEach(theadrow.childNodes, function(cell) {
+ if (cell.nodeType == 1) { // an element
+ cell.className = cell.className.replace('sorttable_sorted_reverse','');
+ cell.className = cell.className.replace('sorttable_sorted','');
+ }
+ });
+ sortfwdind = document.getElementById('sorttable_sortfwdind');
+ if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
+ sortrevind = document.getElementById('sorttable_sortrevind');
+ if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
+
+ this.className += ' sorttable_sorted';
+ sortfwdind = document.createElement('span');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
+ this.appendChild(sortfwdind);
+
+ // build an array to sort. This is a Schwartzian transform thing,
+ // i.e., we "decorate" each row with the actual sort key,
+ // sort based on the sort keys, and then put the rows back in order
+ // which is a lot faster because you only do getInnerText once per row
+ row_array = [];
+ col = this.sorttable_columnindex;
+ rows = this.sorttable_tbody.rows;
+ for (var j=0; j<rows.length; j++) {
+ row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
+ }
+ /* If you want a stable sort, uncomment the following line */
+ //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
+ /* and comment out this one */
+ row_array.sort(this.sorttable_sortfunction);
+
+ tb = this.sorttable_tbody;
+ for (var j=0; j<row_array.length; j++) {
+ var row = row_array[j][1];
+ if(j % 2) { row.className='entry0'; }
+ else { row.className='entry1'; }
+ tb.appendChild(row);
+ }
+
+ delete row_array;
+ });
+ }
+ }
+ },
+
+ guessType: function(table, column) {
+ // guess the type of a column based on its first non-blank row
+ sortfn = sorttable.sort_alpha;
+ for (var i=0; i<table.tBodies[0].rows.length; i++) {
+ text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
+ if (text != '') {
+ if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
+ return sorttable.sort_numeric;
+ }
+ // check for a date: dd/mm/yyyy or dd/mm/yy
+ // can have / or . or - as separator
+ // can be mm/dd as well
+ possdate = text.match(sorttable.DATE_RE)
+ if (possdate) {
+ // looks like a date
+ first = parseInt(possdate[1]);
+ second = parseInt(possdate[2]);
+ if (first > 12) {
+ // definitely dd/mm
+ return sorttable.sort_ddmm;
+ } else if (second > 12) {
+ return sorttable.sort_mmdd;
+ } else {
+ // looks like a date, but we can't tell which, so assume
+ // that it's dd/mm (English imperialism!) and keep looking
+ sortfn = sorttable.sort_ddmm;
+ }
+ }
+ }
+ }
+ return sortfn;
+ },
+
+ getInnerText: function(node) {
+ // gets the text we want to use for sorting for a cell.
+ // strips leading and trailing whitespace.
+ // this is *not* a generic getInnerText function; it's special to sorttable.
+ // for example, you can override the cell text with a customkey attribute.
+ // it also gets .value for <input> fields.
+
+ hasInputs = (typeof node.getElementsByTagName == 'function') &&
+ node.getElementsByTagName('input').length;
+
+ if (node.getAttribute("sorttable_customkey") != null) {
+ return node.getAttribute("sorttable_customkey");
+ }
+ var innerText = '';
+ if (typeof node.textContent != 'undefined' && !hasInputs) {
+ innerText = node.textContent.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.innerText != 'undefined' && !hasInputs) {
+ innerText = node.innerText.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.text != 'undefined' && !hasInputs) {
+ innerText = node.text.replace(/^\s+|\s+$/g, '');
+ }
+ if(innerText != '') {
+ return innerText;
+ }
+ else {
+ switch (node.nodeType) {
+ case 3:
+ if (node.nodeName.toLowerCase() == 'input') {
+ return node.value.replace(/^\s+|\s+$/g, '');
+ }
+ case 4:
+ return node.nodeValue.replace(/^\s+|\s+$/g, '');
+ break;
+ case 1:
+ case 11:
+ if(node.nodeName.toLowerCase() == 'img') {
+ var tokens = node.src.split('/');
+ innerText += tokens[tokens.length-1];
+ }
+ for (var i = 0; i < node.childNodes.length; i++) {
+ innerText += sorttable.getInnerText(node.childNodes[i]);
+ }
+ return innerText.replace(/^\s+|\s+$/g, '');
+ break;
+ default:
+ return '';
+ }
+ }
+ },
+
+ reverse: function(tbody) {
+ // reverse the rows in a tbody
+ newrows = [];
+ for (var i=0; i<tbody.rows.length; i++) {
+ newrows[newrows.length] = tbody.rows[i];
+ }
+ for (var i=newrows.length-1; i>=0; i--) {
+ tbody.appendChild(newrows[i]);
+ }
+ delete newrows;
+ },
+
+ /* sort functions
+ each sort function takes two parameters, a and b
+ you are comparing a[0] and b[0] */
+ sort_numeric: function(a,b) {
+ /* could be multiple values separated by semi-colon */
+ aa = a[0].split(";")[0];
+ bb = b[0].split(";")[0];
+ aa = parseFloat(aa.replace(/[^0-9.-]/g,''));
+ if (isNaN(aa)) aa = 0;
+ bb = parseFloat(bb.replace(/[^0-9.-]/g,''));
+ if (isNaN(bb)) bb = 0;
+ return aa-bb;
+ },
+ sort_alpha: function(a,b) {
+ /* case-insensitive */
+ aa = a[0].toLowerCase();
+ bb = b[0].toLowerCase();
+ if(aa.localeCompare) return aa.localeCompare(bb); /* Robby Stephenson */
+ if (aa==bb) return 0;
+ if (aa<bb) return -1;
+ return 1;
+ },
+ sort_yymmdd: function(a,b) {
+ mtch = a[0].match(sorttable.YYMMDD_RE);
+ if (mtch) {
+ y = mtch[1]; m = mtch[2]; d = mtch[3];
+ // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
+ if (parseInt(y) < 50) y = '20'+y; else y = '19'+y;
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt1 = y+m+d;
+ } else dt1 = a[0];
+ mtch = b[0].match(sorttable.YYMMDD_RE);
+ if (mtch) {
+ y = mtch[1]; m = mtch[2]; d = mtch[3];
+ if (parseInt(y) < 50) y = '20'+y; else y = '19'+y;
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt2 = y+m+d;
+ } else dt2 = b[0];
+ if (dt1==dt2) return 0;
+ if (dt1<dt2) return -1;
+ return 1;
+ },
+ sort_ddmm: function(a,b) {
+ mtch = a[0].match(sorttable.DATE_RE);
+ if (mtch) {
+ y = mtch[3]; m = mtch[2]; d = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt1 = y+m+d;
+ } else dt1 = a[0];
+ mtch = b[0].match(sorttable.DATE_RE);
+ if (mtch) {
+ y = mtch[3]; m = mtch[2]; d = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt2 = y+m+d;
+ } else dt2 = b[0];
+ if (dt1==dt2) return 0;
+ if (dt1<dt2) return -1;
+ return 1;
+ },
+ sort_mmdd: function(a,b) {
+ mtch = a[0].match(sorttable.DATE_RE);
+ if (mtch) {
+ y = mtch[3]; d = mtch[2]; m = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt1 = y+m+d;
+ } else dt1 = a[0];
+ mtch = b[0].match(sorttable.DATE_RE);
+ if (mtch) {
+ y = mtch[3]; d = mtch[2]; m = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt2 = y+m+d;
+ } else dt2 = b[0];
+ if (dt1==dt2) return 0;
+ if (dt1<dt2) return -1;
+ return 1;
+ },
+
+ shaker_sort: function(list, comp_func) {
+ // A stable sort function to allow multi-level sorting of data
+ // see: http://en.wikipedia.org/wiki/Cocktail_sort
+ // thanks to Joseph Nahmias
+ var b = 0;
+ var t = list.length - 1;
+ var swap = true;
+
+ while(swap) {
+ swap = false;
+ for(var i = b; i < t; ++i) {
+ if ( comp_func(list[i], list[i+1]) > 0 ) {
+ var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
+ swap = true;
+ }
+ } // for
+ t--;
+
+ if (!swap) break;
+
+ for(var i = t; i > b; --i) {
+ if ( comp_func(list[i], list[i-1]) < 0 ) {
+ var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
+ swap = true;
+ }
+ } // for
+ b++;
+
+ } // while(swap)
+ }
+}
+
+/* ******************************************************************
+ Supporting functions: bundled here to avoid depending on a library
+ ****************************************************************** */
+
+// Dean Edwards/Matthias Miller/John Resig
+
+/* for Mozilla/Opera9 */
+if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", sorttable.init, false);
+}
+
+/* for Internet Explorer */
+/*@cc_on @*/
+/*@if (@_win32)
+ document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
+ var script = document.getElementById("__ie_onload");
+ script.onreadystatechange = function() {
+ if (this.readyState == "complete") {
+ sorttable.init(); // call the onload handler
+ }
+ };
+/*@end @*/
+
+/* for Safari */
+if (/WebKit/i.test(navigator.userAgent)) { // sniff
+ var _timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState)) {
+ sorttable.init(); // call the onload handler
+ }
+ }, 10);
+}
+
+/* for other browsers */
+window.onload = sorttable.init;
+
+// written by Dean Edwards, 2005
+// with input from Tino Zijdel, Matthias Miller, Diego Perini
+
+// http://dean.edwards.name/weblog/2005/10/add-event/
+
+function dean_addEvent(element, type, handler) {
+ if (element.addEventListener) {
+ element.addEventListener(type, handler, false);
+ } else {
+ // assign each event handler a unique ID
+ if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
+ // create a hash table of event types for the element
+ if (!element.events) element.events = {};
+ // create a hash table of event handlers for each element/event pair
+ var handlers = element.events[type];
+ if (!handlers) {
+ handlers = element.events[type] = {};
+ // store the existing event handler (if there is one)
+ if (element["on" + type]) {
+ handlers[0] = element["on" + type];
+ }
+ }
+ // store the event handler in the hash table
+ handlers[handler.$$guid] = handler;
+ // assign a global event handler to do all the work
+ element["on" + type] = handleEvent;
+ }
+};
+// a counter used to create unique IDs
+dean_addEvent.guid = 1;
+
+function removeEvent(element, type, handler) {
+ if (element.removeEventListener) {
+ element.removeEventListener(type, handler, false);
+ } else {
+ // delete the event handler from the hash table
+ if (element.events && element.events[type]) {
+ delete element.events[type][handler.$$guid];
+ }
+ }
+};
+
+function handleEvent(event) {
+ var returnValue = true;
+ // grab the event object (IE uses a global event object)
+ event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
+ // get a reference to the hash table of event handlers
+ var handlers = this.events[event.type];
+ // execute each event handler
+ for (var i in handlers) {
+ this.$$handleEvent = handlers[i];
+ if (this.$$handleEvent(event) === false) {
+ returnValue = false;
+ }
+ }
+ return returnValue;
+};
+
+function fixEvent(event) {
+ // add W3C standard event methods
+ event.preventDefault = fixEvent.preventDefault;
+ event.stopPropagation = fixEvent.stopPropagation;
+ return event;
+};
+fixEvent.preventDefault = function() {
+ this.returnValue = false;
+};
+fixEvent.stopPropagation = function() {
+ this.cancelBubble = true;
+}
+
+// Dean's forEach: http://dean.edwards.name/base/forEach.js
+/*
+ forEach, version 1.0
+ Copyright 2006, Dean Edwards
+ License: http://www.opensource.org/licenses/mit-license.php
+*/
+
+// array-like enumeration
+if (!Array.forEach) { // mozilla already supports this
+ Array.forEach = function(array, block, context) {
+ for (var i = 0; i < array.length; i++) {
+ block.call(context, array[i], i, array);
+ }
+ };
+}
+
+// generic enumeration
+Function.prototype.forEach = function(object, block, context) {
+ for (var key in object) {
+ if (typeof this.prototype[key] == "undefined") {
+ block.call(context, object[key], key, object);
+ }
+ }
+};
+
+// character enumeration
+String.forEach = function(string, block, context) {
+ Array.forEach(string.split(""), function(chr, index) {
+ block.call(context, chr, index, string);
+ });
+};
+
+// globally resolve forEach enumeration
+var forEach = function(object, block, context) {
+ if (object) {
+ var resolve = Object; // default
+ if (object instanceof Function) {
+ // functions have a "length" property
+ resolve = Function;
+ } else if (object.forEach instanceof Function) {
+ // the object implements a custom forEach method so use that
+ object.forEach(block, context);
+ return;
+ } else if (typeof object == "string") {
+ // the object is a string
+ resolve = String;
+ } else if (typeof object.length == "number") {
+ // the object is array-like
+ resolve = Array;
+ }
+ resolve.forEach(object, block, context);
+ }
+};
diff --git a/xslt/tellico2html.xsl b/xslt/tellico2html.xsl
new file mode 100644
index 0000000..ae23984
--- /dev/null
+++ b/xslt/tellico2html.xsl
@@ -0,0 +1,625 @@
+<?xml version="1.0"?>
+<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:dyn="http://exslt.org/dynamic"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="str dyn exsl"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for exporting to HTML
+
+ Copyright (C) 2004-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ The exslt extensions from http://www.exslt.org are required.
+ Specifically, the string and dynamic modules are used. For
+ libxslt, that means the minimum version is 1.0.19.
+
+ This is a horribly messy stylesheet. I would REALLY welcome any
+ recommendations in improving its efficiency.
+
+ The app itself adds group elements that aren't in the data file
+ itself, in order to speed up exporting. So if this stylesheet is
+ being used outside the app, it should still work, but may give
+ slightly different results than when exporting to HTML from
+ within Tellico.
+
+ Customize this file in order to print different columns of
+ fields for each entry. Any version of this file in the user's
+ KDE home directory, such as $KDEHOME/share/apps/tellico/, will
+ override the system file.
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="tellico-common.xsl"/>
+
+<xsl:output method="html"
+ indent="yes"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd"
+ encoding="utf-8"/>
+
+<!-- Sort using user's preferred language -->
+<xsl:param name="lang"/>
+
+<!-- To choose which fields of each entry are printed, change the
+ string to a space separated list of field names. To know what
+ fields are available, check the Tellico data file for <field>
+ elements. -->
+<xsl:param name="column-names" select="'title'"/>
+<xsl:variable name="columns" select="str:tokenize($column-names)"/>
+
+<!-- If you want the header row printed, showing which fields
+ are printed, change this to true(), otherwise false() -->
+<xsl:param name="show-headers" select="true()"/>
+
+<!-- The entries may be grouped by a certain field. Keys are needed
+ for both the entries and the grouped field values -->
+<xsl:param name="group-entries" select="false()"/>
+
+<!-- set the maximum image size -->
+<xsl:param name="image-height" select="'100'"/>
+<xsl:param name="image-width" select="'100'"/>
+
+<!-- Set the string representing the element name of the field to group by -->
+<!-- The string will be used to dynamically traverse and select the tree -->
+<!-- It should be an XPath relative to the tc:entry element -->
+<xsl:param name="group-fields" select="'tc:authors/tc:author'"/>
+<xsl:param name="empty-group" select="'(Empty)'"/>
+
+<!-- Up to three fields may be used for sorting. -->
+<xsl:param name="sort-name1" select="'title'"/>
+<xsl:param name="sort-name2" select="''"/>
+<xsl:param name="sort-name3" select="''"/>
+<!-- This is the title just beside the collection name. It will
+ automatically list which fields are used for sorting. -->
+<xsl:param name="sort-title" select="''"/>
+
+<!--
+ ===================================================================
+ The only thing below here that you might want to change is the CSS
+ governing the appearance of the output HTML.
+ ===================================================================
+-->
+
+<!-- The page-title is used for the HTML title -->
+<xsl:param name="page-title" select="'Tellico'"/>
+<xsl:param name="imgdir"/> <!-- dir where field images are located -->
+
+<xsl:param name="entrydir"/> <!-- dir where entry links are located -->
+<xsl:param name="link-entries" select="false()"/> <!-- link entries -->
+
+<!-- In case the field has multiple values, only sort by first one -->
+<xsl:variable name="sort1">
+ <xsl:if test="string-length($sort-name1) &gt; 0">
+ <xsl:value-of select="concat('.//tc:', $sort-name1, '[1]')"/>
+ </xsl:if>
+</xsl:variable>
+<xsl:variable name="sort2">
+ <xsl:if test="string-length($sort-name2) &gt; 0">
+ <xsl:value-of select="concat('.//tc:', $sort-name2, '[1]')"/>
+ </xsl:if>
+</xsl:variable>
+<xsl:variable name="sort3">
+ <xsl:if test="string-length($sort-name3) &gt; 0">
+ <xsl:value-of select="concat('.//tc:', $sort-name3, '[1]')"/>
+ </xsl:if>
+</xsl:variable>
+
+<!-- keys ends up useless since we're using exsl:node-set
+<xsl:key name="fieldsByName" match="tc:field" use="@name"/>
+<xsl:key name="imagesById" match="tc:image" use="@id"/>
+-->
+<xsl:key name="entriesById" match="tc:entry" use="@id"/>
+
+<!-- filename conversion is weird, need a variable for easy replacement -->
+<xsl:variable name="weird">&apos;&quot;</xsl:variable>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family: sans-serif;
+ <xsl:if test="count($columns) &gt; 3">
+ font-size: 80%;
+ </xsl:if>
+ background-color: #fff;
+ }
+ #headerblock {
+ padding-top: 10px;
+ margin-bottom: 10px;
+ border-bottom: 1px solid black;
+ overflow: auto;
+ }
+ h1.colltitle {
+ padding: 4px;
+ font-size: 2em;
+ margin: 0px;
+ }
+ span.subtitle {
+ margin-left: 20px;
+ font-size: 0.8em;
+ }
+ form {
+ margin: 5px 0 0 0;
+ float: right;
+ }
+ #searchText {
+ background-color: #eee;
+ }
+ input {
+ padding: 0;
+ margin: 0 0 4px 4px;
+ }
+ .button {
+ padding: 0;
+ margin: 0 0 4px 4px;
+ }
+ table, h4 {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ td.groupName {
+ margin-top: 10px;
+ margin-bottom: 2px;
+ padding-left: 4px;
+ background: #ccc;
+ font-size: 1.1em;
+ font-weight: bolder;
+ }
+ th {
+ color: #000;
+ background-color: #ccc;
+ border: 1px solid #999;
+ font-size: 1.1em;
+ font-weight: bold;
+ padding-left: 4px;
+ padding-right: 4px;
+ }
+ thead tr {
+ cursor: pointer;
+ }
+ tr.entry0 {
+ background-color: #eee;
+ }
+ tr.entry1 {
+ }
+ tr.hidden {
+ display: none;
+ }
+ tr.groupEntry0 {
+ }
+ tr.groupEntry1 {
+ background-color: #eee;
+ }
+ td.field {
+ margin-left: 0px;
+ margin-right: 0px;
+ padding-left: 5px;
+ padding-right: 5px;
+ border: 1px solid #eee;
+ text-align: left;
+ }
+ a.sortheader {
+ text-decoration: none;
+ /*display: block;*/
+ }
+ </style>
+
+ <script type="text/javascript">
+ <xsl:call-template name="sort-array">
+ <xsl:with-param name="fields" select="tc:collection[1]/tc:fields"/>
+ <xsl:with-param name="columns" select="$columns"/>
+ </xsl:call-template>
+ </script>
+
+ <script type="text/javascript" src="tellico2html.js"/>
+
+ <title>
+ <xsl:value-of select="$page-title"/>
+ </title>
+ </head>
+ <body>
+ <xsl:apply-templates select="tc:collection"/>
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="tc:collection">
+ <div id="headerblock">
+
+ <form onsubmit="return false" action="">
+ <div>
+ <input type="text" id="searchText"/>
+ <input type="button" class="button" onclick="searchRows()">
+ <xsl:attribute name="value"><i18n>Search</i18n></xsl:attribute>
+ </input>
+ <input type="button" class="button" onclick="showAll()">
+ <xsl:attribute name="value"><i18n>Clear</i18n></xsl:attribute>
+ </input>
+ </div>
+ </form>
+
+ <h1 class="colltitle">
+ <xsl:value-of select="@title"/>
+ <span class="subtitle">
+ <xsl:value-of select="$sort-title"/>
+ </span>
+ </h1>
+ </div>
+
+ <table>
+ <!-- for now, only sort non-grouped tables -->
+ <xsl:if test="not($group-entries)">
+ <xsl:attribute name="class">
+ <xsl:text>sortable</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:text>table1</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:variable name="fields" select="tc:fields"/>
+ <thead>
+ <tr>
+ <xsl:if test="not($show-headers)">
+ <xsl:attribute name="style">
+ <xsl:text>display: none;</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+ <th>
+ <xsl:call-template name="field-title">
+ <xsl:with-param name="fields" select="$fields"/>
+ <xsl:with-param name="name" select="$column"/>
+ </xsl:call-template>
+ </th>
+ </xsl:for-each>
+ </tr>
+ </thead>
+
+ <tbody>
+ <xsl:choose>
+
+ <!-- If the entries are not being grouped, it's easy -->
+ <xsl:when test="not($group-entries)">
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort1)"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort2)"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort3)"/>
+ <tr class="entry{position() mod 2}">
+ <xsl:apply-templates select="."/>
+ </tr>
+ </xsl:for-each>
+ </xsl:when> <!-- end ungrouped output -->
+
+ <!-- If the entries are being grouped, it's a bit more involved
+ Tellico helps out by creating groups, but I also want this
+ stylesheet to stand alone, so add additional test for groups -->
+ <xsl:when test="$group-entries and tc:group">
+ <xsl:for-each select="tc:group">
+ <tr>
+ <td class="groupName">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="count($columns)"/>
+ </xsl:attribute>
+ <xsl:value-of select="@title"/>
+ </td>
+ </tr>
+ <xsl:for-each select="tc:entryRef">
+ <tr class="groupEntry{position() mod 2}">
+ <xsl:apply-templates select="key('entriesById', @id)"/>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:when>
+
+ <!-- Now is the hard way, use XSL itself to do all the groups -->
+ <xsl:otherwise>
+
+ <xsl:variable name="coll" select="."/>
+
+ <!-- first, copy each entry and add a group attribute -->
+ <xsl:variable name="listing">
+ <xsl:for-each select="tc:entry">
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort1)"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort2)"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort3)"/>
+ <xsl:variable name="entry" select="."/>
+ <xsl:for-each select="dyn:evaluate($group-fields)">
+ <tc:entry group="{.}" id="{$entry/@id}"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- now, loop again, while sorting by group and title -->
+ <xsl:variable name="sorted">
+ <xsl:for-each select="exsl:node-set($listing)/tc:entry">
+ <xsl:sort lang="$lang" select="@group"/>
+ <!-- don't repeat an entry in the same group -->
+ <xsl:if test="not(preceding-sibling::*[@group=current()/@group and @id=current()/@id])">
+ <xsl:copy-of select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- now finally, loop through and print out the entry -->
+ <xsl:for-each select="exsl:node-set($sorted)/tc:entry">
+ <xsl:variable name="g" select="@group"/>
+ <xsl:if test="not(preceding-sibling::tc:entry[@group=$g])">
+ <tr>
+ <td class="groupName">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="count($columns)"/>
+ </xsl:attribute>
+ <xsl:value-of select="$g"/>
+ </td>
+ </tr>
+ </xsl:if>
+ <tr class="groupEntry{count(preceding-sibling::tc:entry[@group=$g]) mod 2}">
+ <!-- I need the fields and images as variables since exsl:node-set
+ can't use keys in the current document -->
+ <xsl:apply-templates select="$coll/tc:entry[@id=current()/@id]">
+ <xsl:with-param name="fields" select="$coll/tc:fields"/>
+ <xsl:with-param name="images" select="$coll/tc:images"/>
+ </xsl:apply-templates>
+ </tr>
+ </xsl:for-each>
+
+ <!-- don't forget entries in no group -->
+ <xsl:for-each select="dyn:evaluate(concat('tc:entry[not(',$group-fields,')]'))">
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort1)"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort2)"/>
+ <xsl:sort lang="$lang" select="dyn:evaluate($sort3)"/>
+ <xsl:if test="position()=1">
+ <tr>
+ <td class="groupName">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="count($columns)"/>
+ </xsl:attribute>
+ <xsl:value-of select="$empty-group"/>
+ </td>
+ </tr>
+ </xsl:if>
+ <tr class="groupEntry{position() mod 2}">
+ <xsl:apply-templates select="."/>
+ </tr>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </tbody>
+ </table>
+
+ <hr/>
+ <p><a href="http://www.periapsis.org/tellico/"><i18n>Generated by Tellico</i18n></a></p>
+</xsl:template>
+
+<xsl:template name="sort-array">
+ <xsl:param name="fields"/>
+ <xsl:param name="columns"/>
+ var COL_SORT_ARRAY = new Array()
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+ <xsl:variable name="field" select="$fields/tc:field[@name = $column]"/>
+ <!-- number sorting is 1, date is 2, everything else is 0 -->
+ <xsl:variable name="sort-type">
+ <xsl:choose>
+ <xsl:when test="$field/@type = 12">
+ <xsl:text>2</xsl:text>
+ </xsl:when>
+ <xsl:when test="$field/@type = 6">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ COL_SORT_ARRAY[<xsl:value-of select="position()-1"/>] = <xsl:value-of select="$sort-type"/>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="field-title">
+ <xsl:param name="fields"/>
+ <xsl:param name="name"/>
+ <xsl:variable name="name-tokens" select="str:tokenize($name, ':')"/>
+ <!-- the header is the title field of the field node whose name equals the column name -->
+ <xsl:choose>
+ <xsl:when test="$fields">
+ <xsl:value-of select="$fields/tc:field[@name = $name-tokens[last()]]/@title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$name-tokens[last()]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="filename">
+ <xsl:param name="entry"/>
+ <xsl:variable name="bad-chars">
+ <xsl:value-of select="translate($entry//tc:title[1],
+ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-',
+ '')"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <!-- there should be at least as many underscores as bad characters -->
+ <xsl:value-of select="translate($entry//tc:title[1],
+ concat($bad-chars, $weird),
+ '_________________________________________________________________________________')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($entrydir, $name, '-', $entry/@id, '.html')"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <xsl:param name="fields" select="../tc:fields"/>
+ <xsl:param name="images" select="../tc:images"/>
+ <!-- stick all the descendants into a variable -->
+ <xsl:variable name="current" select="descendant::*"/>
+ <xsl:variable name="entry" select="."/>
+ <xsl:for-each select="$columns">
+ <xsl:variable name="column" select="."/>
+ <!-- find all descendants whose name matches the column name -->
+ <xsl:variable name="numvalues" select="count($current[local-name() = $column])"/>
+ <!-- if the field node exists, output its value, otherwise put in a space -->
+ <td class="field">
+ <xsl:choose>
+ <!-- when there is at least one value... -->
+ <xsl:when test="$numvalues &gt; 1">
+ <xsl:variable name="field" select="$fields/tc:field[@name = $column]"/>
+ <xsl:if test="$field/@type=4 or $field/@type=6">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$link-entries and $field/@name = 'title'">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="filename">
+ <xsl:with-param name="entry" select="$entry"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <xsl:when test="$numvalues = 1">
+ <xsl:for-each select="$current[local-name() = $column]">
+ <!-- key() doesn't work when using exsl:node-set since the context node
+ is no longer in the current document
+ <xsl:variable name="field" select="key('fieldsByName', $column)"/>
+ -->
+ <xsl:variable name="field" select="$fields/tc:field[@name = $column]"/>
+
+ <xsl:choose>
+
+ <!-- check for multi-column table -->
+ <xsl:when test="$field/@type=8 and $field/tc:prop[@name = 'columns'] &gt; 1">
+ <!-- italicize all columns after the first -->
+ <xsl:value-of select="tc:column[1]"/>
+ <xsl:for-each select="tc:column[position &gt; 1]">
+ <xsl:text> - </xsl:text>
+ <em>
+ <xsl:value-of select="."/>
+ </em>
+ </xsl:for-each>
+ <br/>
+ </xsl:when>
+
+ <!-- boolean and number values -->
+ <xsl:when test="$field/@type=4 or $field/@type=6">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- next, check for images -->
+ <xsl:when test="$field/@type=10">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <img>
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($imgdir, .)"/>
+ </xsl:attribute>
+ <xsl:attribute name="alt">
+ <xsl:value-of select="concat('[', $entry//tc:title[1], ']')"/>
+ </xsl:attribute>
+ <xsl:call-template name="image-size">
+ <xsl:with-param name="limit-width" select="$image-width"/>
+ <xsl:with-param name="limit-height" select="$image-height"/>
+ <xsl:with-param name="image" select="$images/tc:image[@id=current()]"/>
+ </xsl:call-template>
+ </img>
+ </xsl:when>
+
+ <!-- if it's a date, format with hyphens -->
+ <xsl:when test="$field/@type=12">
+ <xsl:attribute name="style">
+ <xsl:text>text-align: center; padding-left: 5px</xsl:text>
+ </xsl:attribute>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <!-- finally, it's just a regular value -->
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$link-entries and $field/@name = 'title'">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="filename">
+ <xsl:with-param name="entry" select="$entry"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:value-of select="."/>
+ </a>
+ <xsl:if test="position() &lt; $numvalues">
+ <br/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="simple-field-value">
+ <xsl:with-param name="entry" select="$entry"/>
+ <xsl:with-param name="field" select="$column"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/tellico2onix.xsl b/xslt/tellico2onix.xsl
new file mode 100644
index 0000000..000d451
--- /dev/null
+++ b/xslt/tellico2onix.xsl
@@ -0,0 +1,149 @@
+<?xml version="1.0"?>
+<!-- WARNING: Tellico uses tc as the internal namespace declaration, and it must be identical here!! -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tc="http://periapsis.org/tellico/"
+ exclude-result-prefixes="tc"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for exporting to ONIX
+
+ Copyright (C) 2005-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at
+ http://www.periapsis.org/tellico/
+
+ Most of the schema for this spreadsheet was copied from the
+ Alexandria application,(C) Laurent Sansonetti, released under
+ GNU GPL, as is Tellico.
+
+ ===================================================================
+-->
+
+<!-- import common templates -->
+<!-- location depends on being installed correctly -->
+<xsl:import href="tellico-common.xsl"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-system="http://www.editeur.org/onix/2.1/reference/onix-international.dtd"/>
+
+<!-- sent date -->
+<xsl:param name="sentDate"/>
+<xsl:param name="version"/>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="tc:tellico"/>
+</xsl:template>
+
+<xsl:template match="tc:tellico">
+ <!-- This stylesheet is designed for Tellico document syntax version 10 -->
+ <xsl:call-template name="syntax-version">
+ <xsl:with-param name="this-version" select="'10'"/>
+ <xsl:with-param name="data-version" select="@syntaxVersion"/>
+ </xsl:call-template>
+
+ <ONIXMessage>
+ <xsl:apply-templates select="tc:collection"/>
+ </ONIXMessage>
+</xsl:template>
+
+<xsl:template match="tc:collection[not(@type=2) and not(@type=5)]">
+ <xsl:message terminate="yes">
+ <xsl:text>ONIX export only works for book collections and bibliographies.</xsl:text>
+ </xsl:message>
+</xsl:template>
+
+<xsl:template match="tc:collection[@type=2 or @type=5]">
+ <Header>
+ <SentDate>
+ <xsl:value-of select="$sentDate"/>
+ </SentDate>
+ <MessageNote>
+ <xsl:value-of select="@title"/>
+ </MessageNote>
+ </Header>
+ <xsl:apply-templates select="tc:entry"/>
+</xsl:template>
+
+<xsl:template match="tc:entry">
+ <Product>
+ <RecordReference>
+ <xsl:value-of select="@id"/>
+ </RecordReference>
+ <NotificationType>03</NotificationType>
+ <RecordSourceName>
+ <xsl:text>Tellico</xsl:text>
+ <xsl:if test="string-length($version) &gt; 0">
+ <xsl:value-of select="concat(' ', $version)"/>
+ </xsl:if>
+ </RecordSourceName>
+ <ISBN>
+ <xsl:value-of select="translate(tc:isbn, '-', '')"/>
+ </ISBN>
+ <ProductForm>BA</ProductForm> <!-- book -->
+ <DistinctiveTitle>
+ <xsl:value-of select=".//tc:title[1]"/>
+ </DistinctiveTitle>
+ <xsl:for-each select=".//tc:author">
+ <Contributor>
+ <ContributorRole>A01</ContributorRole>
+ <PersonName>
+ <xsl:value-of select="."/>
+ </PersonName>
+ </Contributor>
+ </xsl:for-each>
+ <xsl:if test="tc:comments">
+ <OtherText>
+ <TextTypeCode>12</TextTypeCode>
+ <TextFormat>00</TextFormat> <!-- ascii -->
+ <Text>
+ <xsl:value-of select="tc:comments"/>
+ </Text>
+ </OtherText>
+ </xsl:if>
+ <!-- png files are not supported by ONIX -->
+ <xsl:variable name="lowercase" select="translate(tc:cover, 'JPEGIF', 'jpegif')"/>
+ <xsl:if test="substring($lowercase, string-length($lowercase)-2)='jpg' or
+ substring($lowercase, string-length($lowercase)-3)='jpeg' or
+ substring($lowercase, string-length($lowercase)-2)='gif'">
+ <MediaFile>
+ <MediaFileTypeCode>04</MediaFileTypeCode>
+ <MediaFileFormatCode>
+ <xsl:choose>
+ <xsl:when test="substring($lowercase, string-length($lowercase)-2)='gif'">
+ <xsl:text>02</xsl:text>
+ </xsl:when>
+ <xsl:when test="substring($lowercase, string-length($lowercase)-2)='jpg' or
+ substring($lowercase, string-length($lowercase)-3)='jpeg'">
+ <xsl:text>03</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </MediaFileFormatCode>
+ <MediaFileLinkTypeCode>06</MediaFileLinkTypeCode>
+ <MediaFileLink>
+ <xsl:text>images/</xsl:text>
+ <xsl:value-of select="tc:cover"/>
+ </MediaFileLink>
+ </MediaFile>
+ </xsl:if>
+
+ <ProductWebsite>
+ <ProductWebsiteDescription>Amazon</ProductWebsiteDescription>
+ <ProductWebsiteLink>
+ <xsl:text>http://www.amazon.com/exec/obidos/ASIN/</xsl:text>
+ <xsl:value-of select="translate(tc:isbn, '-', '')"/>
+ </ProductWebsiteLink>
+ </ProductWebsite>
+ <PublisherName>
+ <xsl:value-of select=".//tc:publisher[1]"/>
+ </PublisherName>
+ </Product>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- Local Variables: -->
+<!-- sgml-indent-step: 1 -->
+<!-- sgml-indent-data: 1 -->
+<!-- End: -->
diff --git a/xslt/unixref2tellico.xsl b/xslt/unixref2tellico.xsl
new file mode 100644
index 0000000..b997cac
--- /dev/null
+++ b/xslt/unixref2tellico.xsl
@@ -0,0 +1,174 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:cr="http://www.crossref.org/xschema/1.0"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:exsl="http://exslt.org/common"
+ exclude-result-prefixes="cr"
+ extension-element-prefixes="str exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing data from crossref.org
+ in the 'unixref' format.
+
+ See http://www.crossref.org/schema/unixref1.0.xsd
+
+ Copyright (C) 2008 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<!-- by default, don't output text -->
+<xsl:template match="text()" />
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <!-- always bibliography -->
+ <collection title="CrossRef Import" type="5">
+ <fields>
+ <field name="_default"/>
+ <xsl:if test=".//cr:issn">
+ <field flags="0" title="ISSN" category="Publishing" format="4" type="1" name="issn" i18n="true"/>
+ </xsl:if>
+ </fields>
+ <xsl:apply-templates select="cr:doi_records/cr:doi_record/cr:crossref"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="cr:crossref">
+ <entry>
+ <xsl:apply-templates/>
+ </entry>
+</xsl:template>
+
+<xsl:template match="cr:book">
+ <entry-type>book</entry-type>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="cr:journal">
+ <entry-type>article</entry-type>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="cr:book_metadata">
+ <title>
+ <xsl:value-of select="cr:titles/cr:title[1]"/>
+ </title>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="cr:journal_article">
+ <title>
+ <xsl:value-of select="cr:titles/cr:title[1]"/>
+ </title>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="cr:isbn">
+ <isbn>
+ <xsl:value-of select="."/>
+ </isbn>
+</xsl:template>
+
+<xsl:template match="cr:issn">
+ <issn>
+ <xsl:value-of select="."/>
+ </issn>
+</xsl:template>
+
+<xsl:template match="cr:publisher">
+ <publisher>
+ <xsl:value-of select="cr:publisher_name"/>
+ </publisher>
+ <address>
+ <xsl:value-of select="cr:publisher_place"/>
+ </address>
+</xsl:template>
+
+<xsl:template match="cr:journal_metadata">
+ <journal>
+ <xsl:value-of select="cr:full_title"/>
+ </journal>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="cr:edition">
+ <edition>
+ <xsl:value-of select="."/>
+ </edition>
+</xsl:template>
+
+<xsl:template match="cr:volume">
+ <volume>
+ <xsl:value-of select="."/>
+ </volume>
+</xsl:template>
+
+<xsl:template match="cr:issue">
+ <number>
+ <xsl:value-of select="."/>
+ </number>
+</xsl:template>
+
+<xsl:template match="cr:series_metadata">
+ <series>
+ <xsl:value-of select="cr:titles/cr:title[1]"/>
+ </series>
+</xsl:template>
+
+<xsl:template match="cr:doi_data">
+ <doi>
+ <xsl:value-of select="cr:doi"/>
+ </doi>
+ <url>
+ <xsl:value-of select="cr:resource"/>
+ </url>
+</xsl:template>
+
+<xsl:template match="cr:publication_date">
+ <year>
+ <xsl:value-of select="cr:year"/>
+ </year>
+ <month>
+ <xsl:value-of select="cr:month"/>
+ </month>
+</xsl:template>
+
+<xsl:template match="cr:pages">
+ <pages>
+ <xsl:value-of select="concat(cr:first_page,'-',cr:last_page)"/>
+ </pages>
+</xsl:template>
+
+<xsl:template match="cr:contributors">
+ <authors>
+ <xsl:for-each select="cr:person_name[@contributor_role='author']">
+ <author>
+ <xsl:value-of select="concat(cr:given_name,' ',cr:surname)"/>
+ </author>
+ </xsl:for-each>
+ </authors>
+ <editors>
+ <xsl:for-each select="cr:person_name[@contributor_role='editor']">
+ <editor>
+ <xsl:value-of select="concat(cr:given_name,' ',cr:surname)"/>
+ </editor>
+ </xsl:for-each>
+ </editors>
+ <organization>
+ <xsl:value-of select="cr:organization[1]"/>
+ </organization>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/vhs-logo.png b/xslt/vhs-logo.png
new file mode 100644
index 0000000..176d5c5
--- /dev/null
+++ b/xslt/vhs-logo.png
Binary files differ
diff --git a/xslt/welcome.html b/xslt/welcome.html
new file mode 100644
index 0000000..27bcd83
--- /dev/null
+++ b/xslt/welcome.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+ body {
+ margin: 0px;
+ padding: 0px;
+ color: $FGCOLOR$;
+ background-color: $BGCOLOR$;
+ background-image: url($IMGDIR$gradient_bg.png);
+ background-repeat: repeat;
+ }
+ h1 {
+ margin: 0px;
+ padding: 8px;
+ font-size: 1.8em;
+ color: $COLOR1$;
+ background-color: $COLOR2$;
+ background-image: url($IMGDIR$gradient_header.png);
+ background-repeat: repeat-x;
+ border-bottom: 1px outset black;
+ text-align: center;
+ }
+ h3 {
+ text-align: center;
+ font-size: 1em;
+ margin-left:15%;
+ margin-right:15%;
+ }
+ div#content {
+ padding-left: 1%;
+ padding-right: 1%;
+ }
+ div.category {
+ padding: 0px 0px 0px 4px;
+ margin: 8px;
+ border: 1px solid #181818;
+ text-align: center;
+ /* if background is grey, text has to be black */
+ color: #000;
+ background-color: #ccc;
+ }
+ table {
+ border-collapse: collapse;
+ border-spacing: 0px;
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+<h1>$BANNER$</h1>
+<div id="content">
+<div class="category">
+$WELCOMETEXT$
+</div>
+
+</div>
+</body>
+</html>
diff --git a/xslt/xmp2tellico.xsl b/xslt/xmp2tellico.xsl
new file mode 100644
index 0000000..3bf9a31
--- /dev/null
+++ b/xslt/xmp2tellico.xsl
@@ -0,0 +1,176 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:jabref="http://jabref.sourceforge.net/bibteXMP/"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:m="uri:months"
+ extension-element-prefixes="str"
+ exclude-result-prefixes="rdf dc jabref"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for converting XMP data
+
+ Copyright (C) 2007 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<!-- lookup table for months -->
+<m:months>
+ <m:month id="Jan">1</m:month>
+ <m:month id="Feb">2</m:month>
+ <m:month id="Mar">3</m:month>
+ <m:month id="Apr">4</m:month>
+ <m:month id="May">5</m:month>
+ <m:month id="Jun">6</m:month>
+ <m:month id="Jul">7</m:month>
+ <m:month id="Aug">8</m:month>
+ <m:month id="Sep">9</m:month>
+ <m:month id="Oct">10</m:month>
+ <m:month id="Nov">11</m:month>
+ <m:month id="Dec">12</m:month>
+ <!-- months in other languages could be added easily -->
+</m:months>
+<xsl:key name="months" match="m:month" use="@id"/>
+<xsl:variable name="months-top" select="document('')/*/m:months"/>
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V9.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v9/tellico.dtd"/>
+
+<!-- for lower-casing -->
+<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+
+<!-- disable default behavior -->
+<xsl:template match="text()|@*"></xsl:template>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="9">
+ <collection title="XMP Conversion" type="5">
+ <fields>
+ <field name="_default"/>
+ </fields>
+ <xsl:apply-templates select=".//rdf:RDF"/>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="rdf:RDF">
+ <entry>
+ <xsl:apply-templates/>
+ </entry>
+</xsl:template>
+
+<xsl:template match="dc:title">
+ <title><xsl:value-of select="normalize-space(.)"/></title>
+</xsl:template>
+
+<xsl:template match="dc:type">
+ <entry-type><xsl:value-of select="normalize-space(translate(., $ucletters, $lcletters))"/></entry-type>
+</xsl:template>
+
+<xsl:template match="dc:creator">
+ <authors>
+ <xsl:call-template name="multiple-values">
+ <xsl:with-param name="value" select="."/>
+ <xsl:with-param name="field" select="'author'"/>
+ </xsl:call-template>
+ </authors>
+</xsl:template>
+
+<xsl:template match="dc:subject">
+ <keywords>
+ <xsl:call-template name="multiple-values">
+ <xsl:with-param name="value" select="."/>
+ <xsl:with-param name="field" select="'keyword'"/>
+ </xsl:call-template>
+ </keywords>
+</xsl:template>
+
+<xsl:template match="dc:date">
+ <xsl:variable name="tokens" select="str:tokenize(., '-')"/>
+ <year><xsl:value-of select="normalize-space($tokens[1])"/></year>
+ <month><xsl:value-of select="normalize-space($tokens[2])"/></month>
+</xsl:template>
+
+<xsl:template match="dc:identifier">
+ <!-- assume DOI requires a period and a slash -->
+ <xsl:if test="not(//jabref:doi) and
+ (contains(.,'.') and contains(.,'/'))">
+ <doi><xsl:value-of select="normalize-space(.)"/></doi>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="jabref:year">
+ <xsl:if test="not(//dc:date)">
+ <year><xsl:value-of select="normalize-space(.)"/></year>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="jabref:month">
+ <xsl:if test="not(//dc:date)">
+ <month>
+ <xsl:apply-templates select="$months-top">
+ <xsl:with-param name="month-id" select="normalize-space(.)"/>
+ </xsl:apply-templates>
+ </month>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="jabref:jabrefkey">
+ <bibtex-key><xsl:value-of select="normalize-space(.)"/></bibtex-key>
+</xsl:template>
+
+<xsl:template match="jabref:journal">
+ <journal><xsl:value-of select="normalize-space(.)"/></journal>
+</xsl:template>
+
+<xsl:template match="jabref:url">
+ <url><xsl:value-of select="normalize-space(.)"/></url>
+</xsl:template>
+
+<xsl:template match="jabref:doi">
+ <doi><xsl:value-of select="normalize-space(.)"/></doi>
+</xsl:template>
+
+<xsl:template name="multiple-values">
+ <xsl:param name="value"/>
+ <xsl:param name="field"/>
+ <xsl:choose>
+ <xsl:when test="$value/rdf:Seq">
+ <xsl:for-each select="$value/rdf:Seq/rdf:li">
+ <xsl:element name="{$field}">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$value/*">
+ <xsl:element name="{$field}">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="m:months">
+ <xsl:param name="month-id"/>
+ <xsl:variable name="m" select="key('months', $month-id)"/>
+ <xsl:if test="$m">
+ <xsl:value-of select="$m"/>
+ </xsl:if>
+ <xsl:if test="not($m)">
+ <xsl:value-of select="$month-id"/>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/yahoo2tellico.xsl b/xslt/yahoo2tellico.xsl
new file mode 100644
index 0000000..4c6faf3
--- /dev/null
+++ b/xslt/yahoo2tellico.xsl
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://periapsis.org/tellico/"
+ xmlns:yh="urn:yahoo:srchmm"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ version="1.0">
+
+<!--
+ ===================================================================
+ Tellico XSLT file - used for importing Yahoo! album search data.
+
+ Copyright (C) 2004-2006 Robby Stephenson - [email protected]
+
+ This XSLT stylesheet is designed to be used with the 'Tellico'
+ application, which can be found at http://www.periapsis.org/tellico/
+
+ ===================================================================
+-->
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
+ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN"
+ doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/>
+
+<xsl:template match="/">
+ <tellico syntaxVersion="10">
+ <collection title="Yahoo! Import" type="4"> <!-- 4 is music -->
+ <fields>
+ <field name="_default"/>
+ <!-- the importer will actually download the image and ignore this field -->
+ <field flags="0" title="Yahoo Album" category="General" format="4" type="7" name="yahoo"/>
+ <field flags="0" title="Image" category="Images" format="4" type="7" name="image"/>
+ </fields>
+ <xsl:for-each select="yh:ResultSet/yh:Result">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </collection>
+ </tellico>
+</xsl:template>
+
+<xsl:template match="yh:Result">
+ <entry>
+ <yahoo>
+ <xsl:value-of select="@id"/>
+ </yahoo>
+
+ <image>
+ <xsl:value-of select="yh:Thumbnail/yh:Url"/>
+ </image>
+
+ <title>
+ <xsl:value-of select="yh:Title"/>
+ </title>
+
+ <artists>
+ <xsl:for-each select="yh:Artist">
+ <artist>
+ <xsl:value-of select="."/>
+ </artist>
+ </xsl:for-each>
+ </artists>
+
+ <year>
+ <xsl:call-template name="year">
+ <xsl:with-param name="value" select="yh:ReleaseDate"/>
+ </xsl:call-template>
+ </year>
+
+ <labels>
+ <xsl:for-each select="yh:Publisher">
+ <label>
+ <xsl:value-of select="."/>
+ </label>
+ </xsl:for-each>
+ </labels>
+ </entry>
+
+</xsl:template>
+
+<xsl:template name="year">
+ <xsl:param name="value"/>
+ <!-- assume that Yahoo always puts the year first -->
+ <xsl:value-of select="substring($value, 0, 5)"/>
+</xsl:template>
+
+</xsl:stylesheet>