source: main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl@ 24087

Last change on this file since 24087 was 24087, checked in by ak19, 13 years ago

Dr Bainbridge fixed Papitha's problem with GS3 not embedding thumbnails of image collections in links that take one to the source document. Katherine explained that we will need to modify the config_format.xsl in interfaces to have process a gsf:link for type=source. Dr Bainbridge found that we needed to make use of the httpPath variable to help us construct the URL path for the link and that we additionally needed to request the assocfilepath metadata in order to get all the meta needed to complete the URL, so now the GS3 java code requests assocfilemeta as well.

File size: 6.4 KB
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 extension-element-prefixes="java">
8
9 <xsl:output method="xml"/>
10 <xsl:namespace-alias
11 stylesheet-prefix="xslt" result-prefix="xsl"/>
12
13 <xsl:template match="format">
14 <format>
15 <xsl:apply-templates/>
16 </format>
17 </xsl:template>
18
19 <xsl:template match="gsf:template">
20 <xslt:template>
21 <xsl:copy-of select="@*"/>
22 <xsl:attribute name="priority">2</xsl:attribute>
23 <xsl:if test=".//gsf:link">
24 <xslt:param name="serviceName"/>
25 <xslt:param name="collName"/>
26 </xsl:if>
27 <xsl:apply-templates/>
28 </xslt:template>
29 </xsl:template>
30
31 <xsl:template match="gsf:link">
32 <xsl:choose>
33 <xsl:when test="@type='classifier'">
34 <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>
35 <xsl:apply-templates/>
36 </a>
37 </xsl:when>
38 <xsl:when test="@type='source'">
39 <a><xslt:attribute name='href'><xslt:value-of
40 disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
41 disable-output-escaping="yes" select="metadataList/metadata[@name='assocfilepath']" />/<xslt:value-of
42 disable-output-escaping="yes" select="metadataList/metadata[@name='Source']" /></xslt:attribute>
43 <xsl:apply-templates/>
44 </a>
45 </xsl:when>
46
47 <xsl:otherwise> <!-- a document link -->
48 <xslt:variable name="bookswitch"><xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xslt:variable>
49 <xslt:choose>
50 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
51 <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>
52 </xslt:when>
53 <xslt:otherwise>
54 <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>
55 </xslt:otherwise>
56 </xslt:choose>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:template>
60
61 <xsl:template match="gsf:icon">
62 <xsl:choose>
63 <xsl:when test="@type='classifier'">
64 <xslt:call-template name="bookshelfimg"/>
65 </xsl:when>
66 <xsl:otherwise>
67 <xslt:apply-templates select="." mode="displayNodeIcon"/>
68 </xsl:otherwise>
69 </xsl:choose>
70 </xsl:template>
71
72 <xsl:template match="gsf:metadata[@format]">
73 <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>
74 </xsl:template>
75
76 <xsl:template match="gsf:metadata">
77 <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>
78 </xsl:template>
79
80 <xsl:template match="gsf:metadata" mode="get-metadata-name">
81 <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"/>
82 </xsl:template>
83
84 <xsl:template match="gsf:metadata-old">
85 <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>
86 </xsl:template>
87
88 <xsl:template match="gsf:text">
89 <xslt:apply-templates select="nodeContent"/>
90 </xsl:template>
91
92 <xsl:template match="gsf:choose-metadata">
93 <xslt:choose>
94 <xsl:for-each select="gsf:metadata">
95 <xslt:when><xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
96 <xsl:apply-templates select="."/>
97 </xslt:when>
98 </xsl:for-each>
99 <xsl:if test="gsf:default">
100 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
101 </xsl:if>
102 </xslt:choose>
103 </xsl:template>
104
105 <xsl:template match="gsf:switch">
106 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
107 <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>
108 <xslt:choose>
109 <xsl:for-each select="gsf:when">
110 <xslt:when test="util:{@test}($meta, '{@test-value}')">
111 <xsl:apply-templates/>
112 </xslt:when>
113 </xsl:for-each>
114 <xsl:if test="gsf:otherwise">
115 <xslt:otherwise>
116 <xsl:apply-templates select="gsf:otherwise/node()"/>
117 </xslt:otherwise>
118 </xsl:if>
119 </xslt:choose>
120 </xsl:template>
121
122 <xsl:template match="*">
123 <xsl:copy>
124 <xsl:copy-of select="@*"/>
125 <xsl:apply-templates/>
126 </xsl:copy>
127 </xsl:template>
128
129</xsl:stylesheet>
130
131
Note: See TracBrowser for help on using the repository browser.