adding client side xslt for rendering in IE
[Evergreen.git] / Open-ILS / xsl / ATOM2XHTML.xsl
index 494f0ce..f72af2f 100644 (file)
@@ -40,7 +40,7 @@ To-do list:
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="xsl opensearch opensearchOld atom rss9 rdf rss1 content dc xhtml"
  >
-       <xsl:output omit-xml-declaration="yes" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" encoding="UTF-8" media-type="application/xhtml+xml" />
+       <xsl:output omit-xml-declaration="yes" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" encoding="UTF-8" media-type="text/html" />
        
        <!-- START SETTINGS -->
        <!-- text used; change this for translation and also some settings -->
@@ -72,8 +72,8 @@ To-do list:
        <xsl:variable name="t-comments">comments</xsl:variable> <!-- leave blank to not show link to comments -->
        <xsl:variable name="t-download">download</xsl:variable> <!-- leave this or t-enclosure blank to not show link to enclosures -->
        <xsl:variable name="t-enclosure">enclosure</xsl:variable> <!-- text of untitled enclosures; leave this or t-download blank to not show link to enclosures -->
-       <xsl:variable name="t-numsep"><xsl:text>,</xsl:text></xsl:variable> <!-- text to separate number of over 3 digits (eg ',' or ' '); leave blank for no separator-->
        <!-- END SETTINGS -->
+
        
        <xsl:template match="/">
                <xsl:comment>For information about the XSLT file that generated this, see http://opensearch.a9.com/docs/stylesheet.jsp</xsl:comment>
@@ -93,6 +93,9 @@ To-do list:
 
        <xsl:template match="atom:feed | rss/channel | rdf:RDF">
                <xsl:variable name="language" select="(@xml:lang | language)[1]" />
+               <xsl:text disable-output-escaping="yes">&lt;?xml-stylesheet type="text/xsl" href="</xsl:text>
+               <xsl:value-of select="$base_dir" />
+               <xsl:text>/html_xsl.xml"?></xsl:text>
                <html xml:lang="{$language}" lang="{$language}">
                        <xsl:variable name="query" select="opensearch:Query[@role='request' and @searchTerms][1]/@searchTerms" />
                        <xsl:variable name="statedtitle" select="(atom:title | title | //rss1:channel/rss1:title | //rss9:channel/rss9:title)[1]" />
@@ -115,6 +118,7 @@ To-do list:
                        <xsl:variable name="totalresults"><xsl:if test="(opensearch:totalResults | opensearchOld:totalResults)&gt;=$endIndex"><xsl:value-of select="(opensearch:totalResults | opensearchOld:totalResults)[1]" /></xsl:if></xsl:variable>
                        <xsl:variable name="navprev"><xsl:if test="atom:link[@rel='previous']/@href and ((opensearch:startIndex&gt;1 or opensearchOld:startIndex&gt;1) or not(opensearch:startIndex or opensearchOld:startIndex))"><xsl:call-template name="resolvelink"><xsl:with-param name="url" select="(atom:link[@rel='previous']/@href)[1]" /></xsl:call-template></xsl:if></xsl:variable>
                        <xsl:variable name="navnext"><xsl:if test="atom:link[@rel='next']/@href and (($totalresults&gt;0 and $totalresults&gt;$endIndex) or (not($totalresults&gt;0)))"><xsl:call-template name="resolvelink"><xsl:with-param name="url" select="atom:link[@rel='next']/@href" /></xsl:call-template></xsl:if></xsl:variable>
+
                        <xsl:variable name="statedStartIndex" select="(opensearch:startIndex | opensearchOld:startIndex)[1]" />
                        <head>
                                <title><xsl:value-of select="$title" /></title>
@@ -127,6 +131,15 @@ To-do list:
                                        <xsl:attribute name="href"><xsl:value-of select="concat($base_dir,'/os.css')"/></xsl:attribute>
                                </link>
                                <!-- rel links -->
+
+                               <xsl:for-each select="atom:link[@rel='unapi' and string-length(@href)&gt;0]">
+                                       <link rel="meta" title="unAPI" type="application/xml">
+                                               <xsl:attribute name='href'>
+                                                       <xsl:value-of select="./@href"/>
+                                               </xsl:attribute>
+                                       </link>
+                               </xsl:for-each>
+
                                <xsl:if test="string-length($navprev)&gt;0"><link rel="previous" href="{$navprev}" title="{$t-prevpage}" /></xsl:if>
                                <xsl:if test="string-length($navnext)&gt;0"><link rel="next" href="{$navnext}" title="{$t-nextpage}" /></xsl:if>
                                <xsl:if test="atom:link[@rel='first']/@href and ($statedStartIndex&gt;1 or string-length($statedStartIndex)=0)">
@@ -174,7 +187,7 @@ To-do list:
                                <xsl:choose>
                                        <xsl:when test="$items">
                                                <!-- display the search numbers -->
-                                               <p>
+                                               <p class="nav">
                                                        <xsl:value-of select="concat($t-results,' ')" />
                                                        <xsl:choose>
                                                                <xsl:when test="$statedStartIndex&gt;0"><xsl:value-of select="$statedStartIndex" /></xsl:when>
@@ -182,11 +195,26 @@ To-do list:
                                                        </xsl:choose>
                                                        <xsl:value-of select="concat(' ', $t-resultsto, ' ')" />
                                                        <xsl:value-of select="$endIndex" />
-                                                       <xsl:if test="$totalresults&gt;0"><xsl:value-of select="concat(' ', $t-resultsof, ' ')" /><xsl:number value="$totalresults" grouping-size="3" grouping-separator="{$t-numsep}" /></xsl:if>
+                                                       <xsl:if test="$totalresults&gt;0"><xsl:value-of select="concat(' ', $t-resultsof, ' ')" /><xsl:number value="$totalresults" grouping-size="3" grouping-separator="," /></xsl:if>
+                                                       <xsl:if test="string-length($navnext)&gt;0 or string-length($navprev)&gt;0">   |   </xsl:if>
+                                                       <xsl:if test="string-length($navprev)&gt;0">
+                                                               <a class="x-escape" href="{$navprev}" rel="previous"><xsl:value-of select="$t-prevlink" disable-output-escaping="yes" /></a>
+                                                               <xsl:if test="string-length($navnext)&gt;0"> | </xsl:if>
+                                                       </xsl:if>
+                                                       <xsl:if test="string-length($navnext)&gt;0"><a class="x-escape" href="{$navnext}" rel="next"><xsl:value-of select="$t-nextlink" disable-output-escaping="yes" /></a></xsl:if>
                                                </p>
                                                <dl><xsl:apply-templates select="$items" /></dl>
                                                <!-- result navigation -->
-                                               <p id="nav">
+                                               <p class="nav">
+                                                       <xsl:value-of select="concat($t-results,' ')" />
+                                                       <xsl:choose>
+                                                               <xsl:when test="$statedStartIndex&gt;0"><xsl:value-of select="$statedStartIndex" /></xsl:when>
+                                                               <xsl:otherwise>1</xsl:otherwise>
+                                                       </xsl:choose>
+                                                       <xsl:value-of select="concat(' ', $t-resultsto, ' ')" />
+                                                       <xsl:value-of select="$endIndex" />
+                                                       <xsl:if test="$totalresults&gt;0"><xsl:value-of select="concat(' ', $t-resultsof, ' ')" /><xsl:number value="$totalresults" grouping-size="3" grouping-separator="," /></xsl:if>
+                                                       <xsl:if test="string-length($navnext)&gt;0 or string-length($navprev)&gt;0">   |   </xsl:if>
                                                        <xsl:if test="string-length($navprev)&gt;0">
                                                                <a class="x-escape" href="{$navprev}" rel="previous"><xsl:value-of select="$t-prevlink" disable-output-escaping="yes" /></a>
                                                                <xsl:if test="string-length($navnext)&gt;0"> | </xsl:if>
@@ -309,10 +337,21 @@ To-do list:
                <!-- item url -->
                <xsl:if test="string-length($url)&gt;0">
                        <dd class="url">
-                               <xsl:choose>
-                                       <xsl:when test="string-length(substring-after($url, 'http://'))&gt;100"><xsl:value-of select="concat(substring(substring-after($url, 'http://'),1,100),'&#8230;')" /></xsl:when>
-                                       <xsl:otherwise><xsl:value-of select="substring-after($url, 'http://')" /></xsl:otherwise>
-                               </xsl:choose>
+                               <span class="unapi-uri">
+                                       <xsl:for-each select="atom:link[@rel='unapi-uri']">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of select="@href" />
+                                               </xsl:attribute>
+                                       </xsl:for-each>
+                                       <xsl:choose>
+                                               <xsl:when test="string-length(substring-after($url, 'http://'))&gt;100">
+                                                       <xsl:value-of select="concat(substring(substring-after($url, 'http://'),1,100),'&#8230;')" />
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of select="substring-after($url, 'http://')" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </span>
                        </dd>
                </xsl:if>
        </xsl:template>