Jonathan Green
13 years ago
14 changed files with 760 additions and 651 deletions
@ -1,248 +1,182 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" version="1.0" xmlns:php="http://php.net/xsl" exclude-result-prefixes="php"> |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" version="1.0" xmlns:php="http://php.net/xsl" exclude-result-prefixes="php"> |
||||||
<!-- Red and White XSLT --> |
<!-- Red and White XSLT --> |
||||||
<xsl:variable name="BASEURL"> |
<xsl:variable name="BASEURL" select="$baseUrl"/> |
||||||
<xsl:value-of select="$baseUrl"/> |
<xsl:variable name="PATH" select="$path"/> |
||||||
</xsl:variable> |
<xsl:variable name="thisPid" select="$collectionPid"/> |
||||||
<xsl:variable name="PATH"> |
<xsl:variable name="size" select="20"/> |
||||||
<xsl:value-of select="$path"/> |
<xsl:variable name="page" select="$hitPage"/> |
||||||
</xsl:variable> |
<xsl:variable name="start" select="((number($page) - 1) * number($size)) + 1"/> |
||||||
<xsl:variable name="thisPid" select="$collectionPid"/> |
<xsl:variable name="end" select="($start - 1) + number($size)"/> |
||||||
<xsl:variable name="size" select="20"/> |
|
||||||
<xsl:variable name="page" select="$hitPage"/> |
|
||||||
<xsl:variable name="start" select="((number($page) - 1) * number($size)) + 1"/> |
|
||||||
<xsl:variable name="end" select="($start - 1) + number($size)"/> |
|
||||||
<xsl:variable name="cellsPerRow" select="4"/> |
<xsl:variable name="cellsPerRow" select="4"/> |
||||||
<xsl:variable name="count" select="count(s:sparql/s:results/s:result)"/> |
<xsl:variable name="count" select="count(s:sparql/s:results/s:result)"/> |
||||||
<xsl:template match="/"> |
|
||||||
<xsl:if test="$count>0"> |
|
||||||
<table cellpadding="3" cellspacing="3" width="90%"> |
|
||||||
<tr><td colspan="{$cellsPerRow}"> |
|
||||||
<!-- <div STYLE="text-align: center;">--> |
|
||||||
<!-- start previous next --> |
|
||||||
<div class="item-list"> |
|
||||||
<ul class="pager"> |
|
||||||
<xsl:choose> |
|
||||||
<xsl:when test="$end >= $count and $start = 1"> |
|
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
|
||||||
of <xsl:value-of select="$count"/> <br /> |
|
||||||
</xsl:when> |
|
||||||
<xsl:when test="$end >= $count"> |
|
||||||
|
|
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
<xsl:template match="/"> |
||||||
of <xsl:value-of select="$count"/> <br /> |
<xsl:if test="$count>0"> |
||||||
<li class="pager-previous"> |
<xsl:call-template name="render_pager"/> |
||||||
<a> |
<table cellpadding="3" cellspacing="3" width="90%"> |
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
<xsl:apply-templates select="s:sparql/s:results"/> |
||||||
</xsl:attribute> |
</table><br clear="all" /> |
||||||
<Prev |
<xsl:call-template name="render_pager"/> |
||||||
</a></li> |
</xsl:if> |
||||||
</xsl:when> |
</xsl:template> |
||||||
<xsl:when test="$start = 1"> |
|
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
|
||||||
of <xsl:value-of select="$count"/> <br /> |
|
||||||
<li class="pager-next"> |
|
||||||
<a> |
|
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
|
||||||
</xsl:attribute> |
|
||||||
Next> |
|
||||||
</a></li> |
|
||||||
</xsl:when> |
|
||||||
<xsl:otherwise> |
|
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
|
||||||
of <xsl:value-of select="$count"/> <br /> |
|
||||||
<li class="pager-previous"> |
|
||||||
<a> |
|
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
|
||||||
</xsl:attribute> |
|
||||||
<Prev |
|
||||||
</a> </li> |
|
||||||
<li class="pager-next"> |
|
||||||
<a> |
|
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
|
||||||
</xsl:attribute> |
|
||||||
Next> |
|
||||||
</a></li> |
|
||||||
</xsl:otherwise> |
|
||||||
</xsl:choose> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
<!-- end previous next--> |
|
||||||
<br clear="all" /> |
|
||||||
</td></tr> |
|
||||||
|
|
||||||
<!--<xsl:for-each select="/sparql/results/result[position()>=$start and position() <=$end]"> |
<xsl:template match="s:sparql/s:results"> |
||||||
<xsl:variable name='OBJECTURI' select="object/@uri"/> |
<xsl:for-each select="s:result[position() mod $cellsPerRow = 1 and position()>=$start and position() <=$end]"> |
||||||
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/> |
<tr> |
||||||
<tr> |
<xsl:apply-templates select=". | following-sibling::s:result[position() < $cellsPerRow]"/> |
||||||
<td> |
</tr> |
||||||
<img> |
</xsl:for-each> |
||||||
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN |
</xsl:template> |
||||||
</xsl:attribute> |
|
||||||
</img> |
<xsl:template name="render_pager"> |
||||||
<a> |
<!-- start previous next --> |
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="title"/> |
<div class="item-list"> |
||||||
</xsl:attribute> |
<ul class="pager"> |
||||||
<xsl:value-of select="title"/> |
<xsl:choose> |
||||||
</a> |
<xsl:when test="$end >= $count and $start = 1"> |
||||||
</td> |
<xsl:value-of select="concat($start, '-', $count, ' of ', $count, ' ')"/><br /> |
||||||
</tr> |
</xsl:when> |
||||||
</xsl:for-each>- |
<xsl:when test="$end >= $count"> |
||||||
--> |
<xsl:value-of select="concat($start, '-', $count, ' of ', $count, ' ')"/><br /> |
||||||
<xsl:apply-templates select="s:sparql/s:results"/> |
<li class="pager-previous"> |
||||||
</table><br clear="all" /> |
<a> |
||||||
<!-- start previous next --> |
<xsl:attribute name="href"> |
||||||
<div class="item-list"> |
<xsl:value-of select="concat($BASEURL, '/fedora/repository/', $thisPid, '/-/Collection/', $page - 1)"/> |
||||||
<ul class="pager"> |
</xsl:attribute> |
||||||
<xsl:choose> |
<Prev |
||||||
<xsl:when test="$end >= $count and $start = 1"> |
</a> |
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
</li> |
||||||
of <xsl:value-of select="$count"/> <br /> |
</xsl:when> |
||||||
</xsl:when> |
<xsl:when test="$start = 1"> |
||||||
<xsl:when test="$end >= $count"> |
<xsl:value-of select="concat($start, '-', $end, ' of ', $count, ' ')"/><br /> |
||||||
|
<li class="pager-next"> |
||||||
|
<a> |
||||||
|
<xsl:attribute name="href"> |
||||||
|
<xsl:value-of select="concat($BASEURL, '/fedora/repository/', $thisPid, '/-/Collection/', $page + 1)"/> |
||||||
|
</xsl:attribute> |
||||||
|
Next> |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
</xsl:when> |
||||||
|
<xsl:otherwise> |
||||||
|
<xsl:value-of select="concat($start, '-', $end, ' of ', $count, ' ')"/><br /> |
||||||
|
<li class="pager-previous"> |
||||||
|
<a> |
||||||
|
<xsl:attribute name="href"> |
||||||
|
<xsl:value-of select="concat($BASEURL, '/fedora/repository/', $thisPid, '/-/Collection/', $page - 1)"/> |
||||||
|
</xsl:attribute> |
||||||
|
<Prev |
||||||
|
</a>  |
||||||
|
</li> |
||||||
|
<li class="pager-next"> |
||||||
|
<a> |
||||||
|
<xsl:attribute name="href"> |
||||||
|
<xsl:value-of select="concat($BASEURL, '/fedora/repository/', $thisPid, '/-/Collection/', $page + 1)"/> |
||||||
|
</xsl:attribute> |
||||||
|
Next> |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
</xsl:otherwise> |
||||||
|
</xsl:choose> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
<!-- end previous next--> |
||||||
|
</xsl:template> |
||||||
|
|
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
<xsl:template match="s:result"> |
||||||
of <xsl:value-of select="$count"/> <br /> |
<xsl:variable name='OBJECTURI' select="s:object/@uri"/> |
||||||
<li class="pager-previous"> |
<xsl:variable name='CONTENTURI' select="s:content/@uri"/> |
||||||
|
<xsl:variable name='CONTENTMODEL' select="substring-after($CONTENTURI,'/')"/> |
||||||
|
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/> |
||||||
|
<xsl:variable name="newTitle" > |
||||||
|
<xsl:call-template name="replace-string"> |
||||||
|
<xsl:with-param name="text" select="s:title"/> |
||||||
|
<xsl:with-param name="from" select="'_'"/> |
||||||
|
<xsl:with-param name="to" select="' '"/> |
||||||
|
</xsl:call-template> |
||||||
|
</xsl:variable> |
||||||
|
<xsl:variable name="cleanTitle" select="php:functionString('fedora_repository_urlencode_string', $newTitle)"/> |
||||||
|
|
||||||
|
<xsl:variable name="linkUrl"> |
||||||
|
<xsl:choose> |
||||||
|
<xsl:when test="($CONTENTMODEL='islandora:collectionCModel')"> |
||||||
|
<xsl:value-of select="concat($BASEURL, '/fedora/repository/', $PID, '/-/collection')"/> |
||||||
|
</xsl:when> |
||||||
|
<xsl:otherwise> |
||||||
|
<!--the below is an example of going straight to a datastream instead of the details page. |
||||||
|
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/OBJ/<xsl:value-of select="s:title"/>--> |
||||||
|
<xsl:value-of select="concat($BASEURL, '/fedora/repository/', $PID)"/> |
||||||
|
</xsl:otherwise> |
||||||
|
</xsl:choose> |
||||||
|
<xsl:value-of select="s:content"/> |
||||||
|
</xsl:variable> |
||||||
|
<td valign="top" width="25%"> |
||||||
<a> |
<a> |
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
<xsl:attribute name="href"> |
||||||
|
<xsl:value-of select="$linkUrl"/> |
||||||
</xsl:attribute> |
</xsl:attribute> |
||||||
<Prev |
<img> |
||||||
</a></li> |
<xsl:attribute name="src"><xsl:value-of select="concat($BASEURL, '/fedora/repository/', $PID, '/TN')"/></xsl:attribute> |
||||||
</xsl:when> |
<xsl:attribute name="alt"><xsl:value-of select="$newTitle" disable-output-escaping="yes"/></xsl:attribute> |
||||||
<xsl:when test="$start = 1"> |
</img> |
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
</a><br clear="all" /> |
||||||
of <xsl:value-of select="$count"/> <br /> |
|
||||||
<li class="pager-next"> |
|
||||||
<a> |
<a> |
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
<xsl:attribute name="href"><xsl:value-of select="$linkUrl"/> |
||||||
</xsl:attribute> |
</xsl:attribute> |
||||||
Next> |
<xsl:value-of select="$newTitle" disable-output-escaping="yes" /> |
||||||
</a></li> |
</a> |
||||||
</xsl:when> |
<!-- example of a url that would drill down to the details page if the url above went directly to a datastream |
||||||
<xsl:otherwise> |
<xsl:if test="($CONTENTMODEL!='islandora:collectionCModel')"> |
||||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
<br />[[ <a> |
||||||
of <xsl:value-of select="$count"/> <br /> |
<xsl:attribute name="href"> |
||||||
<li class="pager-previous"> |
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/> |
||||||
<a> |
</xsl:attribute> |
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
DETAILS |
||||||
</xsl:attribute> |
</a> ]] |
||||||
<Prev |
</xsl:if>--> |
||||||
</a> </li> |
|
||||||
<li class="pager-next"> |
|
||||||
<a> |
|
||||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
|
||||||
</xsl:attribute> |
|
||||||
Next> |
|
||||||
</a></li> |
|
||||||
</xsl:otherwise> |
|
||||||
</xsl:choose> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
<!-- end previous next--> |
|
||||||
</xsl:if> |
|
||||||
</xsl:template> |
|
||||||
<xsl:template match="s:sparql/s:results"> |
|
||||||
<xsl:for-each select="s:result[position() mod $cellsPerRow = 1 and position()>=$start and position() <=$end]"> |
|
||||||
<tr> |
|
||||||
<xsl:apply-templates select=". | following-sibling::s:result[position() < $cellsPerRow]"/> |
|
||||||
</tr> |
|
||||||
</xsl:for-each> |
|
||||||
</xsl:template> |
|
||||||
<xsl:template match="s:result"> |
|
||||||
<xsl:variable name='OBJECTURI' select="s:object/@uri"/> |
|
||||||
<xsl:variable name='CONTENTURI' select="s:content/@uri"/> |
|
||||||
<xsl:variable name='CONTENTMODEL' select="substring-after($CONTENTURI,'/')"/> |
|
||||||
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/> |
|
||||||
<xsl:variable name="newTitle" > |
|
||||||
<xsl:call-template name="replace-string"> |
|
||||||
<xsl:with-param name="text" select="s:title"/> |
|
||||||
<xsl:with-param name="from" select="'_'"/> |
|
||||||
<xsl:with-param name="to" select="' '"/> |
|
||||||
</xsl:call-template> |
|
||||||
|
|
||||||
</xsl:variable> |
</td> |
||||||
<xsl:variable name="cleanTitle"> |
<xsl:if test="(position() = last()) and (position() < $cellsPerRow)"> |
||||||
<xsl:value-of select="php:functionString('fedora_repository_urlencode_string', $newTitle)"/> |
<xsl:call-template name="FillerCells"> |
||||||
</xsl:variable> |
<xsl:with-param name="cellCount" select="$cellsPerRow - position()"/> |
||||||
<xsl:variable name="linkUrl"> |
</xsl:call-template> |
||||||
<xsl:choose> |
</xsl:if> |
||||||
<xsl:when test="($CONTENTMODEL='islandora:collectionCModel')"> |
</xsl:template> |
||||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="'collection'"/> |
|
||||||
</xsl:when> |
|
||||||
<xsl:otherwise> |
|
||||||
<!--the below is an example of going straight to a datastream instead of the details page. |
|
||||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/OBJ/<xsl:value-of select="s:title"/>--> |
|
||||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/> |
|
||||||
</xsl:otherwise> |
|
||||||
</xsl:choose> |
|
||||||
<xsl:value-of select="s:content"/> |
|
||||||
</xsl:variable> |
|
||||||
<td valign="top" width="25%"> |
|
||||||
<a> |
|
||||||
<xsl:attribute name="href"><xsl:value-of select="$linkUrl"/> |
|
||||||
</xsl:attribute> |
|
||||||
<img> |
|
||||||
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN |
|
||||||
</xsl:attribute> |
|
||||||
<xsl:attribute name="alt"><xsl:value-of select="$newTitle" disable-output-escaping="yes"/> |
|
||||||
</xsl:attribute> |
|
||||||
</img> </a> <br clear="all" /> |
|
||||||
<a> |
|
||||||
<xsl:attribute name="href"><xsl:value-of select="$linkUrl"/> |
|
||||||
</xsl:attribute> |
|
||||||
<xsl:value-of select="$newTitle" disable-output-escaping="yes" /> |
|
||||||
</a> |
|
||||||
<!-- example of a url that would drill down to the details page if the url above went directly to a datastream |
|
||||||
<xsl:if test="($CONTENTMODEL!='islandora:collectionCModel')"> |
|
||||||
<br />[[ <a> |
|
||||||
<xsl:attribute name="href"> |
|
||||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/> |
|
||||||
</xsl:attribute> |
|
||||||
DETAILS |
|
||||||
</a> ]] |
|
||||||
</xsl:if>--> |
|
||||||
|
|
||||||
</td> |
<xsl:template name="FillerCells"> |
||||||
<xsl:if test="(position() = last()) and (position() < $cellsPerRow)"> |
<xsl:param name="cellCount"/> |
||||||
<xsl:call-template name="FillerCells"> |
<td> </td> |
||||||
<xsl:with-param name="cellCount" select="$cellsPerRow - position()"/> |
<xsl:if test="$cellCount > 1"> |
||||||
</xsl:call-template> |
<xsl:call-template name="FillerCells"> |
||||||
</xsl:if> |
<xsl:with-param name="cellCount" select="$cellCount - 1"/> |
||||||
</xsl:template> |
</xsl:call-template> |
||||||
<xsl:template name="FillerCells"> |
</xsl:if> |
||||||
<xsl:param name="cellCount"/> |
</xsl:template> |
||||||
<td> </td> |
|
||||||
<xsl:if test="$cellCount > 1"> |
|
||||||
<xsl:call-template name="FillerCells"> |
|
||||||
<xsl:with-param name="cellCount" select="$cellCount - 1"/> |
|
||||||
</xsl:call-template> |
|
||||||
</xsl:if> |
|
||||||
</xsl:template> |
|
||||||
<xsl:template name="replace-string"> |
|
||||||
<xsl:param name="text"/> |
|
||||||
<xsl:param name="from"/> |
|
||||||
<xsl:param name="to"/> |
|
||||||
|
|
||||||
<xsl:choose> |
<xsl:template name="replace-string"> |
||||||
<xsl:when test="contains($text, $from)"> |
<xsl:param name="text"/> |
||||||
|
<xsl:param name="from"/> |
||||||
|
<xsl:param name="to"/> |
||||||
|
|
||||||
<xsl:variable name="before" select="substring-before($text, $from)"/> |
<xsl:choose> |
||||||
<xsl:variable name="after" select="substring-after($text, $from)"/> |
<xsl:when test="contains($text, $from)"> |
||||||
<xsl:variable name="prefix" select="concat($before, $to)"/> |
|
||||||
|
|
||||||
<xsl:value-of select="$before"/> |
<xsl:variable name="before" select="substring-before($text, $from)"/> |
||||||
<xsl:value-of select="$to"/> |
<xsl:variable name="after" select="substring-after($text, $from)"/> |
||||||
<xsl:call-template name="replace-string"> |
<xsl:variable name="prefix" select="concat($before, $to)"/> |
||||||
<xsl:with-param name="text" select="$after"/> |
|
||||||
<xsl:with-param name="from" select="$from"/> |
|
||||||
<xsl:with-param name="to" select="$to"/> |
|
||||||
</xsl:call-template> |
|
||||||
</xsl:when> |
|
||||||
<xsl:otherwise> |
|
||||||
<xsl:value-of select="$text"/> |
|
||||||
</xsl:otherwise> |
|
||||||
</xsl:choose> |
|
||||||
</xsl:template> |
|
||||||
</xsl:stylesheet> |
|
||||||
|
|
||||||
|
<xsl:value-of select="$before"/> |
||||||
|
<xsl:value-of select="$to"/> |
||||||
|
<xsl:call-template name="replace-string"> |
||||||
|
<xsl:with-param name="text" select="$after"/> |
||||||
|
<xsl:with-param name="from" select="$from"/> |
||||||
|
<xsl:with-param name="to" select="$to"/> |
||||||
|
</xsl:call-template> |
||||||
|
</xsl:when> |
||||||
|
<xsl:otherwise> |
||||||
|
<xsl:value-of select="$text"/> |
||||||
|
</xsl:otherwise> |
||||||
|
</xsl:choose> |
||||||
|
</xsl:template> |
||||||
|
</xsl:stylesheet> |
||||||
|
Loading…
Reference in new issue