|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- $Id$ --> |
| 3 | +<xsl:stylesheet exclude-result-prefixes="t" |
| 4 | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 5 | + xmlns:t="http://www.tei-c.org/ns/1.0" |
| 6 | + version="2.0"> |
| 7 | + |
| 8 | + <xsl:template match="t:facsimile"> |
| 9 | + <!-- Being concerned only with the images, ignore everything else. --> |
| 10 | + <div id="facsimile-images"> |
| 11 | + <h2>Facsimile Images</h2> |
| 12 | + |
| 13 | + <xsl:apply-templates select=".//t:graphic" /> |
| 14 | + </div> |
| 15 | + </xsl:template> |
| 16 | + |
| 17 | + <!-- Display a local image with thumbnail. --> |
| 18 | + <xsl:template match="t:graphic"> |
| 19 | + <xsl:param name="parm-image-loc" select="''" tunnel="yes" /> |
| 20 | + <!-- Create a link to the full image and display a thumbnail |
| 21 | + image. |
| 22 | +
|
| 23 | + The thumbnail image URL is constructed from the original URL |
| 24 | + via prefixing the final "." with "-thumb". This may lead to |
| 25 | + ugly URLs if the original URL does not include an extension |
| 26 | + suffix but does have a "." in it. --> |
| 27 | + <xsl:variable name="url-parts" select="tokenize(@url, '\.')" /> |
| 28 | + <xsl:variable name="count-url-parts" select="count($url-parts)-1" /> |
| 29 | + <a href="{concat($parm-image-loc, @url)}"> |
| 30 | + <img title="{t:desc}"> |
| 31 | + <xsl:attribute name="src"> |
| 32 | + <xsl:value-of select="$parm-image-loc" /> |
| 33 | + <xsl:value-of select="string-join(subsequence($url-parts, 1, $count-url-parts), '.')" /> |
| 34 | + <xsl:text>-thumb.</xsl:text> |
| 35 | + <xsl:value-of select="subsequence($url-parts, $count-url-parts)[last()]" /> |
| 36 | + </xsl:attribute> |
| 37 | + </img> |
| 38 | + </a> |
| 39 | + </xsl:template> |
| 40 | + |
| 41 | + <!-- Display an image. --> |
| 42 | + <xsl:template match="t:graphic[contains(@url, '://')]"> |
| 43 | + <img src="{@url}" title="{t:desc}" /> |
| 44 | + </xsl:template> |
| 45 | + |
| 46 | +</xsl:stylesheet> |
0 commit comments