source: trunk/gsdl3/web/interfaces/default/transform/config_format.xsl@ 8585

Last change on this file since 8585 was 8406, checked in by nzdl, 20 years ago

changed double to single quotes on line 74 ages ago, so commiting the change

  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 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/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:otherwise> <!-- a document link -->
39 <a><xslt:attribute name="href"><xslt:value-of select='$library_name'/>?a=d&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>
40 </xsl:otherwise>
41 </xsl:choose>
42 </xsl:template>
43
44 <xsl:template match="gsf:icon">
45 <xsl:choose>
46 <xsl:when test="@type='classifier'">
47 <xslt:call-template name="bookshelfimg"/>
48 </xsl:when>
49 <xsl:otherwise>
50 <xslt:apply-templates select="." mode="displayNodeIcon"/>
51 </xsl:otherwise>
52 </xsl:choose>
53 </xsl:template>
54
55 <xsl:template match="gsf:metadata">
56 <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>
57 </xsl:template>
58
59 <xsl:template match="gsf:metadata" mode="get-metadata-name">
60 <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"/>
61 </xsl:template>
62
63 <xsl:template match="gsf:metadata-old">
64 <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>
65 </xsl:template>
66
67 <xsl:template match="gsf:text">
68 <xslt:apply-templates select="nodeContent"/>
69 </xsl:template>
70
71 <xsl:template match="gsf:choose-metadata">
72 <xslt:choose>
73 <xsl:for-each select="gsf:metadata">
74 <xslt:when><xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
75 <xsl:apply-templates select="."/>
76 </xslt:when>
77 </xsl:for-each>
78 </xslt:choose>
79 </xsl:template>
80
81 <xsl:template match="gsf:switch">
82 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
83 <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>
84 <xslt:choose>
85 <xsl:for-each select="gsf:when">
86 <xslt:when test="util:{@test}($meta, '{@test-value}')">
87 <xsl:apply-templates/>
88 </xslt:when>
89 </xsl:for-each>
90 <xsl:if test="gsf:otherwise">
91 <xslt:otherwise>
92 <xsl:apply-templates select="gsf:otherwise/node()"/>
93 </xslt:otherwise>
94 </xsl:if>
95 </xslt:choose>
96 </xsl:template>
97
98 <xsl:template match="*">
99 <xsl:copy>
100 <xsl:copy-of select="@*"/>
101 <xsl:apply-templates/>
102 </xsl:copy>
103 </xsl:template>
104
105</xsl:stylesheet>
106
107
Note: See TracBrowser for help on using the repository browser.