source: greenstone3/trunk/web/interfaces/oran/transform/config_format.xsl@ 20185

Last change on this file since 20185 was 20185, checked in by oranfry, 15 years ago

added missing util namespace declaration

File size: 6.0 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 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 <xslt:call-template name="bookshelfimg"/>
57 </xsl:when>
58 <xsl:otherwise>
59 <xslt:apply-templates select="." mode="displayNodeIcon"/>
60 </xsl:otherwise>
61 </xsl:choose>
62 </xsl:template>
63
64 <xsl:template match="gsf:metadata[@format]">
65 <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>
66 </xsl:template>
67
68 <xsl:template match="gsf:metadata">
69 <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>
70 </xsl:template>
71
72 <xsl:template match="gsf:metadata" mode="get-metadata-name">
73 <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"/>
74 </xsl:template>
75
76 <xsl:template match="gsf:metadata-old">
77 <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>
78 </xsl:template>
79
80 <xsl:template match="gsf:text">
81 <xslt:apply-templates select="nodeContent"/>
82 </xsl:template>
83
84 <xsl:template match="gsf:choose-metadata">
85 <xslt:choose>
86 <xsl:for-each select="gsf:metadata">
87 <xslt:when><xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
88 <xsl:apply-templates select="."/>
89 </xslt:when>
90 </xsl:for-each>
91 <xsl:if test="gsf:default">
92 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
93 </xsl:if>
94 </xslt:choose>
95 </xsl:template>
96
97 <xsl:template match="gsf:switch">
98 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
99 <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>
100 <xslt:choose>
101 <xsl:for-each select="gsf:when">
102 <xslt:when test="util:{@test}($meta, '{@test-value}')">
103 <xsl:apply-templates/>
104 </xslt:when>
105 </xsl:for-each>
106 <xsl:if test="gsf:otherwise">
107 <xslt:otherwise>
108 <xsl:apply-templates select="gsf:otherwise/node()"/>
109 </xslt:otherwise>
110 </xsl:if>
111 </xslt:choose>
112 </xsl:template>
113
114 <xsl:template match="*">
115 <xsl:copy>
116 <xsl:copy-of select="@*"/>
117 <xsl:apply-templates/>
118 </xsl:copy>
119 </xsl:template>
120
121</xsl:stylesheet>
122
123
Note: See TracBrowser for help on using the repository browser.