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

Last change on this file since 16703 was 16703, checked in by kjdon, 16 years ago

made a fix for the previous fix which didn't work :-(

  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
RevLine 
[4047]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"
[9874]6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
[4047]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">
[5689]14 <format>
[4047]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>
[5689]23 <xsl:if test=".//gsf:link">
[4712]24 <xslt:param name="serviceName"/>
25 <xslt:param name="collName"/>
[4047]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'">
[4712]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>
[4047]35 <xsl:apply-templates/>
36 </a>
37 </xsl:when>
38 <xsl:otherwise> <!-- a document link -->
[13996]39 <xslt:variable name="bookswitch"><xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xslt:variable>
40 <xslt:choose>
41 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
42 <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>
43 </xslt:when>
44 <xslt:otherwise>
45 <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>
46 </xslt:otherwise>
47 </xslt:choose>
[4047]48 </xsl:otherwise>
49 </xsl:choose>
50 </xsl:template>
51
52 <xsl:template match="gsf:icon">
53 <xsl:choose>
54 <xsl:when test="@type='classifier'">
[5689]55 <xslt:call-template name="bookshelfimg"/>
[4047]56 </xsl:when>
57 <xsl:otherwise>
58 <xslt:apply-templates select="." mode="displayNodeIcon"/>
59 </xsl:otherwise>
60 </xsl:choose>
61 </xsl:template>
[5689]62
[8648]63 <xsl:template match="gsf:metadata[@format]">
64 <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>
65 </xsl:template>
66
[4866]67 <xsl:template match="gsf:metadata">
[6691]68 <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>
[4866]69 </xsl:template>
[6309]70
71 <xsl:template match="gsf:metadata" mode="get-metadata-name">
[6691]72 <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"/>
[6309]73 </xsl:template>
[4866]74
[6309]75 <xsl:template match="gsf:metadata-old">
76 <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>
77 </xsl:template>
78
[4047]79 <xsl:template match="gsf:text">
[4866]80 <xslt:apply-templates select="nodeContent"/>
[4047]81 </xsl:template>
[4866]82
[6309]83 <xsl:template match="gsf:choose-metadata">
84 <xslt:choose>
85 <xsl:for-each select="gsf:metadata">
[8406]86 <xslt:when><xsl:attribute name="test">metadataList/metadata[@name='<xsl:apply-templates select="." mode="get-metadata-name"/>']</xsl:attribute>
[6309]87 <xsl:apply-templates select="."/>
88 </xslt:when>
89 </xsl:for-each>
[10359]90 <xsl:if test="gsf:default">
[16703]91 <xslt:otherwise><xsl:apply-templates select="gsf:default"/></xslt:otherwise>
[10359]92 </xsl:if>
[6309]93 </xslt:choose>
94 </xsl:template>
95
96 <xsl:template match="gsf:switch">
97 <xsl:variable name="meta-name"><xsl:apply-templates select="gsf:metadata" mode="get-metadata-name"/></xsl:variable>
98 <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>
99 <xslt:choose>
100 <xsl:for-each select="gsf:when">
101 <xslt:when test="util:{@test}($meta, '{@test-value}')">
102 <xsl:apply-templates/>
103 </xslt:when>
104 </xsl:for-each>
105 <xsl:if test="gsf:otherwise">
106 <xslt:otherwise>
107 <xsl:apply-templates select="gsf:otherwise/node()"/>
108 </xslt:otherwise>
109 </xsl:if>
110 </xslt:choose>
111 </xsl:template>
112
[4047]113 <xsl:template match="*">
114 <xsl:copy>
115 <xsl:copy-of select="@*"/>
116 <xsl:apply-templates/>
117 </xsl:copy>
118 </xsl:template>
119
120</xsl:stylesheet>
121
122
Note: See TracBrowser for help on using the repository browser.