root/greenstone3/trunk/web/interfaces/oran/transform/config_format.xsl @ 20193

Revision 20193, 6.1 KB (checked in by kjdon, 11 years ago)

instead of calling bookshelfimg template, which isn't defined in this skin, just output an image

Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4  xmlns:xslt="output.xsl"
5  xmlns:java="http://xml.apache.org/xslt/java"
6  xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7  xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
8  extension-element-prefixes="java">
9 
10  <xsl:output method="xml"/>
11  <xsl:namespace-alias
12    stylesheet-prefix="xslt" result-prefix="xsl"/>
13
14  <xsl:template match="format">
15    <format>
16      <xsl:apply-templates/>
17    </format>
18  </xsl:template>
19 
20  <xsl:template match="gsf:template">
21    <xslt:template>
22      <xsl:copy-of select="@*"/>
23      <xsl:attribute name="priority">2</xsl:attribute>
24      <xsl:if test=".//gsf:link">
25    <xslt:param name="serviceName"/>
26    <xslt:param name="collName"/>
27      </xsl:if>
28      <xsl:apply-templates/>
29    </xslt:template>
30  </xsl:template>
31 
32  <xsl:template match="gsf:link">
33    <xsl:choose>
34      <xsl:when test="@type='classifier'">
35    <a><xslt:attribute name='href'><xslt:value-of select='$library_name'/>?a=b&amp;rt=r&amp;s=<xslt:value-of select='$serviceName'/>&amp;c=<xslt:value-of select='$collName'/>&amp;cl=<xslt:value-of select='@nodeID'/><xslt:if test="classifierNode|documentNode">.pr</xslt:if><xslt:if test="parent::node()[@orientation='horizontal']">&amp;sib=1</xslt:if></xslt:attribute>
36      <xsl:apply-templates/>
37    </a>
38      </xsl:when>
39      <xsl:otherwise> <!-- a document link -->
40    <xslt:variable name="bookswitch"><xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xslt:variable>
41    <xslt:choose>
42      <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
43        <a><xslt:attribute name="href"><xslt:value-of select='$library_name'/>?a=d&amp;ed=1&amp;book=on&amp;c=<xslt:value-of select='$collName'/>&amp;d=<xslt:value-of select='@nodeID'/>&amp;dt=<xslt:value-of select='@docType'/><xslt:if test="@nodeType='leaf'">&amp;sib=1</xslt:if>&amp;p.a=<xslt:value-of select="/page/pageRequest/@action"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/@subaction"/>&amp;p.s=<xslt:value-of select="$serviceName"/></xslt:attribute><xsl:apply-templates/></a>
44      </xslt:when>
45      <xslt:otherwise>
46        <a><xslt:attribute name="href"><xslt:value-of select='$library_name'/>?a=d&amp;book=off&amp;c=<xslt:value-of select='$collName'/>&amp;d=<xslt:value-of select='@nodeID'/>&amp;dt=<xslt:value-of select='@docType'/><xslt:if test="@nodeType='leaf'">&amp;sib=1</xslt:if>&amp;p.a=<xslt:value-of select="/page/pageRequest/@action"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/@subaction"/>&amp;p.s=<xslt:value-of select="$serviceName"/></xslt:attribute><xsl:apply-templates/></a>
47      </xslt:otherwise>
48    </xslt:choose>
49      </xsl:otherwise>
50    </xsl:choose>
51  </xsl:template>
52
53  <xsl:template match="gsf:icon">
54    <xsl:choose>
55      <xsl:when test="@type='classifier'">
56    <img  border="0" width="20" height="16"
57      src="interfaces/default/images/bshelf.gif" />
58    <!--xslt:call-template name="bookshelfimg"/>-->
59      </xsl:when>
60      <xsl:otherwise>
61    <xslt:apply-templates select="." mode="displayNodeIcon"/>
62      </xsl:otherwise>
63    </xsl:choose>
64  </xsl:template>
65 
66  <xsl:template match="gsf:metadata[@format]">
67    <xslt:value-of disable-output-escaping="yes"><xsl:attribute name="select">java:org.greenstone.gsdl3.util.XSLTUtil.<xsl:value-of select="@format"/>(metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>'], /page/@lang )</xsl:attribute></xslt:value-of>
68  </xsl:template>
69
70  <xsl:template match="gsf:metadata">
71    <xslt:value-of disable-output-escaping="yes"><xsl:attribute name="select">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute></xslt:value-of>
72  </xsl:template>
73
74  <xsl:template match="gsf:metadata" mode="get-metadata-name">
75    <xsl:if test="@multiple='true'">all_</xsl:if><xsl:if test='@select'><xsl:value-of select='@select'/>_</xsl:if><xsl:if test="@separator">*<xsl:value-of select='@separator'/>*_</xsl:if><xsl:value-of select="@name"/>
76  </xsl:template>
77 
78  <xsl:template match="gsf:metadata-old">
79    <xslt:value-of disable-output-escaping="yes"><xsl:attribute name="select">metadataList/metadata[@name="<xsl:choose><xsl:when test="@select='parent'">parent_</xsl:when><xsl:when test="@select='root'">root_</xsl:when><xsl:when test="@select='ancestors'">ancestors'<xsl:value-of select='@separator'/>'_</xsl:when><xsl:when test="@select='siblings'">siblings_'<xsl:value-of select='@separator'/>'_</xsl:when></xsl:choose><xsl:value-of select="@name"/>"]</xsl:attribute></xslt:value-of>
80  </xsl:template>
81 
82  <xsl:template match="gsf:text">
83    <xslt:apply-templates select="nodeContent"/>
84  </xsl:template>
85 
86  <xsl:template match="gsf:choose-metadata">
87    <xslt:choose>
88      <xsl:for-each select="gsf:metadata">
89    <xslt:when><xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
90      <xsl:apply-templates select="."/>
91    </xslt:when>
92      </xsl:for-each>
93      <xsl:if test="gsf:default">
94    <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
95      </xsl:if>
96    </xslt:choose>
97  </xsl:template>
98 
99  <xsl:template match="gsf:switch">
100    <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
101    <xslt:variable name="meta"><xsl:choose><xsl:when test="@preprocess"><xslt:value-of select="util:{@preprocess}(metadataList/metadata[@name='{$meta-name}'])"/></xsl:when><xsl:otherwise><xslt:value-of select="metadataList/metadata[@name='{$meta-name}']"/></xsl:otherwise></xsl:choose></xslt:variable>
102    <xslt:choose>
103      <xsl:for-each select="gsf:when">
104    <xslt:when test="util:{@test}($meta, '{@test-value}')">
105      <xsl:apply-templates/>
106    </xslt:when>
107      </xsl:for-each>
108      <xsl:if test="gsf:otherwise">
109    <xslt:otherwise>
110      <xsl:apply-templates select="gsf:otherwise/node()"/>
111    </xslt:otherwise>
112      </xsl:if>
113    </xslt:choose>
114  </xsl:template>
115 
116  <xsl:template match="*">
117    <xsl:copy>
118      <xsl:copy-of select="@*"/>
119      <xsl:apply-templates/>
120    </xsl:copy>
121  </xsl:template>
122
123</xsl:stylesheet>
124
125
Note: See TracBrowser for help on using the browser.