diff options
author | Slávek Banko <[email protected]> | 2014-03-03 13:46:44 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2014-03-03 13:46:44 +0100 |
commit | 2e02da046d3e56cdf4744f644af35ad07424f48b (patch) | |
tree | f2dcf353aa2338eae1c2ff2c41af971c580c2762 /xslt | |
parent | 3c13229d98167ae4ae0710d5eeef23fef5005bf0 (diff) | |
download | tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.tar.gz tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.zip |
Update to upstream version 1.3.6
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/amazon2tellico.xsl | 43 | ||||
-rw-r--r-- | xslt/crossref2tellico.xsl | 4 | ||||
-rw-r--r-- | xslt/delicious2tellico.xsl | 283 | ||||
-rw-r--r-- | xslt/gcstar2tellico.xsl | 47 | ||||
-rw-r--r-- | xslt/report-templates/Column_View.xsl | 5 | ||||
-rw-r--r-- | xslt/report-templates/Group_Summary.xsl | 74 | ||||
-rw-r--r-- | xslt/report-templates/Group_View.xsl | 5 | ||||
-rw-r--r-- | xslt/report-templates/Image_List.xsl | 12 | ||||
-rw-r--r-- | xslt/report-templates/Tri-Column.xsl | 5 | ||||
-rw-r--r-- | xslt/tellico-printing.xsl | 5 | ||||
-rw-r--r-- | xslt/tellico2gcstar.xsl | 12 | ||||
-rw-r--r-- | xslt/tellico2html.js | 10 | ||||
-rw-r--r-- | xslt/tellico2html.xsl | 8 | ||||
-rw-r--r-- | xslt/unixref2tellico.xsl | 9 |
14 files changed, 458 insertions, 64 deletions
diff --git a/xslt/amazon2tellico.xsl b/xslt/amazon2tellico.xsl index 065886a..717911e 100644 --- a/xslt/amazon2tellico.xsl +++ b/xslt/amazon2tellico.xsl @@ -53,6 +53,9 @@ <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="10"> <collection title="Amazon Import"> @@ -71,6 +74,9 @@ <xsl:when test="$mode='VideoGames'"> <xsl:text>11</xsl:text> </xsl:when> + <xsl:when test="$mode='Toys'"> + <xsl:text>13</xsl:text> + </xsl:when> </xsl:choose> </xsl:attribute> <fields> @@ -81,9 +87,19 @@ <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> + <!-- results for board games need to be filtered --> + <xsl:if test="$mode != 'Toys'"> + <xsl:for-each select="//aws:Items/aws:Item"> + <xsl:apply-templates select="."/> + </xsl:for-each> + </xsl:if> + <xsl:if test="$mode = 'Toys'"> + <!-- only grab items in the board games category --> + <xsl:for-each select="//aws:Items/aws:Item[.//aws:BrowseNode/aws:Name='Board Games' or + .//aws:BrowseNode/aws:BrowseNodeId='166225011']"> + <xsl:apply-templates select="."/> + </xsl:for-each> + </xsl:if> </collection> </tellico> </xsl:template> @@ -496,6 +512,27 @@ </xsl:choose> </certification> </xsl:when> + + <xsl:when test="$mode='Toys'"> + <publishers> + <publisher> + <xsl:value-of select="(aws:Label|aws:Brand|aws:Publisher|aws:Manufacturer)[1]"/> + </publisher> + </publishers> + + <description> + <xsl:value-of select="../aws:EditorialReviews/aws:EditorialReview[1]/aws:Content"/> + <xsl:for-each select="aws:Feature"> + <xsl:value-of select="."/> + <!-- if the last character is not punctuation, add a period --> + <xsl:if test="not(contains('.!?,/', substring(., string-length(.))))"> + <xsl:text>.</xsl:text> + </xsl:if> + <xsl:text> </xsl:text> + </xsl:for-each> + </description> + </xsl:when> + </xsl:choose> </xsl:template> diff --git a/xslt/crossref2tellico.xsl b/xslt/crossref2tellico.xsl index 17cddd3..ab536a8 100644 --- a/xslt/crossref2tellico.xsl +++ b/xslt/crossref2tellico.xsl @@ -42,6 +42,10 @@ </tellico> </xsl:template> +<!-- ignore unresolved queries --> +<xsl:template match="cr:query[@status='unresolved']"> +</xsl:template> + <xsl:template match="cr:query"> <entry> diff --git a/xslt/delicious2tellico.xsl b/xslt/delicious2tellico.xsl index e185d58..a272439 100644 --- a/xslt/delicious2tellico.xsl +++ b/xslt/delicious2tellico.xsl @@ -21,17 +21,41 @@ doctype-public="-//Robby Stephenson/DTD Tellico V10.0//EN" doctype-system="http://periapsis.org/tellico/dtd/v10/tellico.dtd"/> +<xsl:param name="item-type"/> + <xsl:template match="/"> <tc:tellico syntaxVersion="10"> - <tc:collection title="Delicious Library Import" type="2"> + <!-- DL libraries can contain mixed types and right now, there's no way to do that in Tellico --> + <!-- so we're going to limit the export to whatever the type of the first item is --> + <xsl:variable name="item"> + <xsl:choose> + <xsl:when test="string-length($item-type) > 0"> + <xsl:value-of select="$item-type"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name(library/items/child::*[1])"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:comment><xsl:text>Choosing all items of type </xsl:text><xsl:value-of select="$item"/></xsl:comment> + + <xsl:variable name="type"> + <xsl:choose> + <xsl:when test="$item='book'">2</xsl:when> + <xsl:when test="$item='movie'">3</xsl:when> + <xsl:when test="$item='game'">11</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <tc:collection title="Delicious Library Import"> + <xsl:attribute name="type"><xsl:value-of select="$type"/></xsl:attribute> <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> + <xsl:apply-templates select="library/items/child::*[local-name()=$item]"/> </tc:collection> </tc:tellico> </xsl:template> @@ -56,7 +80,7 @@ <xsl:otherwise> <xsl:value-of select="@title"/> </xsl:otherwise> - </xsl:choose> + </xsl:choose> </tc:title> <tc:subtitle> @@ -116,7 +140,7 @@ <tc:rating> <!-- tellico automatically rounds down --> - <xsl:value-of select="netrating"/> + <xsl:value-of select="@netrating"/> </tc:rating> <xsl:call-template name="split"> @@ -132,6 +156,219 @@ </tc:entry> </xsl:template> +<xsl:template match="movie"> + <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:call-template name="strip-title"> + <xsl:with-param name="title" select="@title"/> + </xsl:call-template> + </tc:title> + + <tc:medium> + <xsl:value-of select="@aspect"/> + </tc:medium> + + <xsl:call-template name="split"> + <xsl:with-param name="name" select="'tc:director'"/> + <xsl:with-param name="value" select="@director"/> + </xsl:call-template> + + <xsl:call-template name="split"> + <xsl:with-param name="name" select="'tc:cast'"/> + <xsl:with-param name="value" select="@stars"/> + </xsl:call-template> + + <xsl:if test="contains(@features, 'Widescreen')"> + <tc:widescreen>true</tc:widescreen> + </xsl:if> + + <xsl:if test="contains(@features, 'NTSC')"> + <tc:format i18n="true">NTSC</tc:format> + </xsl:if> + + <xsl:if test="contains(@features, 'PAL')"> + <tc:format i18n="true">PAL</tc:format> + </xsl:if> + + <xsl:if test="contains(@features, 'SECAM')"> + <tc:format i18n="true">SECAM</tc:format> + </xsl:if> + + <xsl:if test="contains(@features, 'Color')"> + <tc:color i18n="true">Color</tc:color> + </xsl:if> + + <xsl:if test="contains(@features, 'Black & White')"> + <tc:color i18n="true">Black & White</tc:color> + </xsl:if> + + <xsl:if test="contains(@features, '1.33:1')"> + <tc:aspect-ratios> + <tc:aspect-ratio>1.33:1</tc:aspect-ratio> + </tc:aspect-ratios> + </xsl:if> + + <xsl:if test="contains(@features, '1.85:1')"> + <tc:aspect-ratios> + <tc:aspect-ratio>1.85:1</tc:aspect-ratio> + </tc:aspect-ratios> + </xsl:if> + + <tc:audio-tracks> + <xsl:if test="contains(@features, 'Dolby')"> + <tc:audio-track i18n="true">Dolby</tc:audio-track> + </xsl:if> + <xsl:if test="contains(@features, 'DTS')"> + <tc:audio-track i18n="true">DTS</tc:audio-track> + </xsl:if> + </tc:audio-tracks> + + <xsl:choose> + <xsl:when test="contains(@genre, 'Region 1')"> + <tc:region i18n="true">Region 1</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 2')"> + <tc:region i18n="true">Region 2</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 3')"> + <tc:region i18n="true">Region 3</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 4')"> + <tc:region i18n="true">Region 4</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 5')"> + <tc:region i18n="true">Region 5</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 6')"> + <tc:region i18n="true">Region 6</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 7')"> + <tc:region i18n="true">Region 7</tc:region> + </xsl:when> + <xsl:when test="contains(@genre, 'Region 8')"> + <tc:region i18n="true">Region 8</tc:region> + </xsl:when> + </xsl:choose> + + <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> + + <xsl:call-template name="split"> + <xsl:with-param name="name" select="'tc:studio'"/> + <xsl:with-param name="value" select="@publisher"/> + </xsl:call-template> + + <tc:running-time> + <xsl:value-of select="@minutes"/> + </tc:running-time> + + <tc:certification> + <xsl:value-of select="concat(@mpaarating, ' (US)')"/> + </tc:certification> + + <tc:year> + <xsl:call-template name="year"> + <xsl:with-param name="value" select="@theatricalDate"/> + </xsl:call-template> + </tc:year> + + <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:plot> + <xsl:value-of select="description"/> + </tc:plot> + </tc:entry> +</xsl:template> + +<xsl:template match="game"> + <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:value-of select="@title"/> + </tc:title> + + <tc:platform> + <xsl:value-of select="@platform"/> + </tc:platform> + + <tc:certification> + <xsl:value-of select="@esrbrating"/> + </tc:certification> + + <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:pur_price> + <xsl:value-of select="@price"/> + </tc:pur_price> + + <tc:pur_date> + <xsl:value-of select="@purchaseDate"/> + </tc:pur_date> + + <tc:year> + <xsl:call-template name="year"> + <xsl:with-param name="value" select="@published"/> + </xsl:call-template> + </tc:year> + + <tc:rating> + <!-- tellico automatically rounds down --> + <xsl:value-of select="@netrating"/> + </tc:rating> + + <tc:publisher> + <xsl:value-of select="@publisher"/> + </tc:publisher> + + <tc:description> + <xsl:value-of select="description"/> + </tc:description> + + </tc:entry> +</xsl:template> + <xsl:template name="split"> <xsl:param name="name"/> <xsl:param name="value"/> @@ -161,4 +398,38 @@ <xsl:value-of select="substring($numbers, string-length($numbers)-3, 4)"/> </xsl:template> +<xsl:template name="strip-title"> + <xsl:param name="title"/> + <xsl:param name="chars" select="'[('"/> + <xsl:choose> + <xsl:when test="string-length($chars) = 0"> + <xsl:value-of select="normalize-space($title)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="strip-title"> + <xsl:with-param name="title"> + <xsl:call-template name="str-before"> + <xsl:with-param name="value1" select="$title"/> + <xsl:with-param name="value2" select="substring($chars,1,1)"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="chars" select="substring($chars,2)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="str-before"> + <xsl:param name="value1"/> + <xsl:param name="value2"/> + <xsl:choose> + <xsl:when test="string-length($value2) > 0 and contains($value1, $value2)"> + <xsl:value-of select="substring-before($value1, $value2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value1"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + </xsl:stylesheet> diff --git a/xslt/gcstar2tellico.xsl b/xslt/gcstar2tellico.xsl index a45df87..7421a3d 100644 --- a/xslt/gcstar2tellico.xsl +++ b/xslt/gcstar2tellico.xsl @@ -79,6 +79,11 @@ <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:when test="@type='GCcoins'"> + <!-- gcstar includes way more coin grades than tellico --> + <tc:field flags="2" title="Grade" category="General" format="4" type="3" name="grade" + allowed="Proof-65;Proof-60;Mint State-70;Mint State-69;Mint State-68;Mint State-67;Mint State-66;Mint State-65;Mint State-64;Mint State-63;Mint State-62;Mint State-61;Mint State-60;Almost Uncirculated-58;Almost Uncirculated-55;Almost Uncirculated-53;Almost Uncirculated-50;Extremely Fine-45;Extremely Fine-40;Very Fine-35;Very Fine-30;Very Fine-25;Very Fine-20;Fine-15;Fine-12;Very Good-10;Very Good-8;Good-6;Good-4;Fair"/> + </xsl:when> </xsl:choose> </tc:fields> <xsl:apply-templates select="item"/> @@ -477,6 +482,48 @@ </tc:num-players> </xsl:template> +<!-- coins --> +<xsl:template match="condition"> +<!-- by default, Tellico includes + "Proof-65,Proof-60,Mint State-65,Mint State-60," + "Almost Uncirculated-55,Almost Uncirculated-50," + "Extremely Fine-40,Very Fine-30,Very Fine-20,Fine-12," + "Very Good-8,Good-4,Fair" --> +<!-- GCStar doesn't appear to include proof grades --> + <tc:grade> + <xsl:choose> + <xsl:when test=".='70'">Mint State-70</xsl:when> + <xsl:when test=".='69'">Mint State-69</xsl:when> + <xsl:when test=".='68'">Mint State-68</xsl:when> + <xsl:when test=".='67'">Mint State-67</xsl:when> + <xsl:when test=".='66'">Mint State-66</xsl:when> + <xsl:when test=".='65'">Mint State-65</xsl:when> + <xsl:when test=".='64'">Mint State-64</xsl:when> + <xsl:when test=".='63'">Mint State-63</xsl:when> + <xsl:when test=".='62'">Mint State-62</xsl:when> + <xsl:when test=".='61'">Mint State-61</xsl:when> + <xsl:when test=".='60'">Mint State-60</xsl:when> + <xsl:when test=".='58'">Almost Uncirculated-58</xsl:when> + <xsl:when test=".='55'">Almost Uncirculated-55</xsl:when> + <xsl:when test=".='53'">Almost Uncirculated-53</xsl:when> + <xsl:when test=".='50'">Almost Uncirculated-50</xsl:when> + <xsl:when test=".='45'">Extremely Fine-45</xsl:when> + <xsl:when test=".='40'">Extremely Fine-40</xsl:when> + <xsl:when test=".='35'">Very Fine-35</xsl:when> + <xsl:when test=".='30'">Very Fine-30</xsl:when> + <xsl:when test=".='25'">Very Fine-25</xsl:when> + <xsl:when test=".='20'">Very Fine-20</xsl:when> + <xsl:when test=".='15'">Fine-15</xsl:when> + <xsl:when test=".='12'">Fine-12</xsl:when> + <xsl:when test=".='10'">Very Good-10</xsl:when> + <xsl:when test=".='8'">Very Good-8</xsl:when> + <xsl:when test=".='6'">Good-6</xsl:when> + <xsl:when test=".='4'">Good-4</xsl:when> + <xsl:when test=".<4">Fair</xsl:when> + </xsl:choose> + </tc:grade> +</xsl:template> + <xsl:template name="year"> <xsl:param name="value"/> <!-- want to find a 4-digit number to treat as the year --> diff --git a/xslt/report-templates/Column_View.xsl b/xslt/report-templates/Column_View.xsl index 3b007fe..5436cf3 100644 --- a/xslt/report-templates/Column_View.xsl +++ b/xslt/report-templates/Column_View.xsl @@ -258,7 +258,10 @@ </xsl:attribute> <img> <xsl:attribute name="src"> - <xsl:value-of select="concat($imgdir, .)"/> + <xsl:call-template name="image-link"> + <xsl:with-param name="image" select="key('imagesById', .)"/> + <xsl:with-param name="dir" select="$imgdir"/> + </xsl:call-template> </xsl:attribute> <xsl:call-template name="image-size"> <xsl:with-param name="limit-width" select="$image-width"/> diff --git a/xslt/report-templates/Group_Summary.xsl b/xslt/report-templates/Group_Summary.xsl index 9058f78..0d49284 100644 --- a/xslt/report-templates/Group_Summary.xsl +++ b/xslt/report-templates/Group_Summary.xsl @@ -117,6 +117,7 @@ margin: 0px 0px 0px 0px; padding: 0px 10px 0px 4px; float: left; + min-height: 1em; } span.bar { width: 590px; @@ -178,7 +179,7 @@ <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:with-param name="field" select="."/> </xsl:call-template> </xsl:for-each> @@ -189,35 +190,49 @@ <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:param name="field"/> + + <xsl:variable name="fieldname" select="$field/@name"/> + <xsl:variable name="value-expr"> + <xsl:for-each select="$coll/tc:entry"> + <xsl:choose> + <!-- tables --> + <xsl:when test="$field/@type=8"> + <xsl:for-each select="./*/*[local-name() = $fieldname]"> + <value> + <xsl:value-of select="tc:column[1]"/> + </value> + </xsl:for-each> + </xsl:when> + <!-- multiple values...could also use "./*/*[local-name() = $fieldname]" --> + <xsl:when test="boolean(floor(key('fieldsByName', $fieldname)/@flags mod 2))"> + <xsl:for-each select="./*/*[local-name() = $fieldname]"> + <value> + <xsl:value-of select="."/> + </value> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <value> + <xsl:call-template name="simple-field-value"> + <xsl:with-param name="entry" select="."/> + <xsl:with-param name="field" select="$fieldname"/> + </xsl:call-template> + </value> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> </xsl:variable> - <xsl:variable name="values" select="dyn:evaluate($str)"/> + <xsl:variable name="values" select="exsl:node-set($value-expr)/value"/> <xsl:variable name="listing"> - <xsl:for-each select="$values[not(. = preceding::*)]"> + <xsl:for-each select="$values[not(. = preceding-sibling::*)]"> <!-- speed sorting by ignoring groups with a count of 1 --> <xsl:variable name="c" select="count($values[. = current()])"/> <xsl:if test="$c > 1"> <group> <xsl:attribute name="name"> - <xsl:call-template name="text-value"/> + <xsl:value-of select="."/> </xsl:attribute> <xsl:attribute name="count"> <xsl:value-of select="$c"/> @@ -229,11 +244,11 @@ <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:call-template> </xsl:variable> <xsl:if test="$total > 2"> @@ -305,17 +320,6 @@ </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 --> diff --git a/xslt/report-templates/Group_View.xsl b/xslt/report-templates/Group_View.xsl index 123559e..73cdf25 100644 --- a/xslt/report-templates/Group_View.xsl +++ b/xslt/report-templates/Group_View.xsl @@ -232,7 +232,10 @@ </xsl:attribute> <img> <xsl:attribute name="src"> - <xsl:value-of select="concat($imgdir, .)"/> + <xsl:call-template name="image-link"> + <xsl:with-param name="image" select="key('imagesById', .)"/> + <xsl:with-param name="dir" select="$imgdir"/> + </xsl:call-template> </xsl:attribute> <xsl:call-template name="image-size"> <xsl:with-param name="limit-width" select="$image-width"/> diff --git a/xslt/report-templates/Image_List.xsl b/xslt/report-templates/Image_List.xsl index 78c596f..f73ca24 100644 --- a/xslt/report-templates/Image_List.xsl +++ b/xslt/report-templates/Image_List.xsl @@ -141,7 +141,10 @@ <xsl:if test="$id"> <img class="float"> <xsl:attribute name="src"> - <xsl:value-of select="concat($imgdir, $id)"/> + <xsl:call-template name="image-link"> + <xsl:with-param name="image" select="key('imagesById', $id)"/> + <xsl:with-param name="dir" select="$imgdir"/> + </xsl:call-template> </xsl:attribute> <xsl:call-template name="image-size"> <xsl:with-param name="limit-width" select="$image-width"/> @@ -150,7 +153,7 @@ </xsl:call-template> </img> </xsl:if> - + <table> <thead> <tr> @@ -163,8 +166,9 @@ <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"> + <!-- no other images or paragraphs allowed --> + <xsl:variable name="ftype" select="$entry/../tc:fields/tc:field[@name = current()]/@type"/> + <xsl:if test="$ftype != 10 and $ftype != 2"> <xsl:call-template name="field-output"> <xsl:with-param name="entry" select="$entry"/> <!-- can't use a key, the context is not the document --> diff --git a/xslt/report-templates/Tri-Column.xsl b/xslt/report-templates/Tri-Column.xsl index d38dd5f..3323a2c 100644 --- a/xslt/report-templates/Tri-Column.xsl +++ b/xslt/report-templates/Tri-Column.xsl @@ -193,7 +193,10 @@ <xsl:if test="$id"> <img class="float" alt=" "> <xsl:attribute name="src"> - <xsl:value-of select="concat($imgdir, $id)"/> + <xsl:call-template name="image-link"> + <xsl:with-param name="image" select="key('imagesById', $id)"/> + <xsl:with-param name="dir" select="$imgdir"/> + </xsl:call-template> </xsl:attribute> <xsl:call-template name="image-size"> <xsl:with-param name="limit-width" select="$image-width"/> diff --git a/xslt/tellico-printing.xsl b/xslt/tellico-printing.xsl index 9d997fd..4c31ecc 100644 --- a/xslt/tellico-printing.xsl +++ b/xslt/tellico-printing.xsl @@ -329,7 +329,10 @@ </xsl:attribute> <img> <xsl:attribute name="src"> - <xsl:value-of select="concat($imgdir, .)"/> + <xsl:call-template name="image-link"> + <xsl:with-param name="image" select="key('imagesById', .)"/> + <xsl:with-param name="dir" select="$imgdir"/> + </xsl:call-template> </xsl:attribute> <xsl:call-template name="image-size"> <xsl:with-param name="limit-width" select="$image-width"/> diff --git a/xslt/tellico2gcstar.xsl b/xslt/tellico2gcstar.xsl index b4cf394..51c410a 100644 --- a/xslt/tellico2gcstar.xsl +++ b/xslt/tellico2gcstar.xsl @@ -65,6 +65,9 @@ <xsl:when test="tc:tellico/tc:collection/@type=4"> <xsl:text>GCmusics</xsl:text> </xsl:when> + <xsl:when test="tc:tellico/tc:collection/@type=8"> + <xsl:text>GCcoins</xsl:text> + </xsl:when> </xsl:choose> </xsl:variable> <!-- grab all the applicable attributes once --> @@ -80,7 +83,7 @@ <xsl:apply-templates select="tc:collection"/> </xsl:template> -<xsl:template match="tc:collection[@type<2 or @type>5]"> +<xsl:template match="tc:collection[@type<2 or @type>5 and not(@type=8)]"> <xsl:message terminate="yes"> <xsl:text>GCstar export is not supported for this collection type.</xsl:text> </xsl:message> @@ -147,6 +150,13 @@ </xsl:choose> </xsl:attribute> </xsl:if> + <!-- for coin grade, GCstar uses numbers only --> + <xsl:if test="tc:grade"> + <xsl:attribute name="condition"> + <!-- remove everything but numbers --> + <xsl:value-of select="translate(tc:grade,translate(tc:grade,'0123456789', ''),'')"/> + </xsl:attribute> + </xsl:if> <!-- for books --> <comments> diff --git a/xslt/tellico2html.js b/xslt/tellico2html.js index 8a3f5df..fa08d58 100644 --- a/xslt/tellico2html.js +++ b/xslt/tellico2html.js @@ -127,8 +127,8 @@ sorttable = { 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)$/; + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-](\d{4}|\d\d)$/; + sorttable.YYMMDD_RE = /^(\d{4}|\d\d)[\/\.-](\d\d?)[\/\.-](\d\d?)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { @@ -371,7 +371,8 @@ sorttable = { 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 (y.length == 2) + 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; @@ -379,7 +380,8 @@ sorttable = { 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 (y.length == 2) + 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; diff --git a/xslt/tellico2html.xsl b/xslt/tellico2html.xsl index b87ef75..f63c36f 100644 --- a/xslt/tellico2html.xsl +++ b/xslt/tellico2html.xsl @@ -115,10 +115,7 @@ </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 --> @@ -557,7 +554,10 @@ </xsl:attribute> <img> <xsl:attribute name="src"> - <xsl:value-of select="concat($imgdir, .)"/> + <xsl:call-template name="image-link"> + <xsl:with-param name="image" select="key('imagesById', .)"/> + <xsl:with-param name="dir" select="$imgdir"/> + </xsl:call-template> </xsl:attribute> <xsl:attribute name="alt"> <xsl:value-of select="concat('[', $entry//tc:title[1], ']')"/> diff --git a/xslt/unixref2tellico.xsl b/xslt/unixref2tellico.xsl index b997cac..9b25c44 100644 --- a/xslt/unixref2tellico.xsl +++ b/xslt/unixref2tellico.xsl @@ -46,9 +46,12 @@ </xsl:template> <xsl:template match="cr:crossref"> - <entry> - <xsl:apply-templates/> - </entry> + <!-- if there's an error, or none found, a crossref element still shows up, with an error element --> + <xsl:if test="not(cr:error)"> + <entry> + <xsl:apply-templates/> + </entry> + </xsl:if> </xsl:template> <xsl:template match="cr:book"> |