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

Last change on this file since 4866 was 4866, checked in by kjdon, 21 years ago

am working on the xslt, but thought I'd better commit what I've done. will check whether it works properly tomorrow :-)

  • 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 hello="yes">
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/@type">
24 <xslt:param name="serviceName"/>
25 </xsl:if>
26 <xsl:if test=".//gsf:link">
27 <xslt:param name="collName"/>
28 </xsl:if>
29 <xsl:apply-templates/>
30 </xslt:template>
31 </xsl:template>
32
33 <xsl:template match="gsf:link">
34 <xsl:choose>
35 <xsl:when test="@type='classifier'">
36 <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>
37 <xsl:apply-templates/>
38 </a>
39 </xsl:when>
40 <xsl:otherwise> <!-- a document link -->
41 <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='@documentType'/><xslt:if test="@nodeType='leaf'">&amp;sib=1</xslt:if></xslt:attribute><xsl:apply-templates/></a>
42 </xsl:otherwise>
43 </xsl:choose>
44 </xsl:template>
45
46 <xsl:template match="gsf:icon">
47 <xsl:choose>
48 <xsl:when test="@type='classifier'">
49 <img src='interfaces/default/images/bshelf.gif' border='0' width='20' height='16' />
50 </xsl:when>
51 <xsl:otherwise>
52 <xslt:apply-templates select="." mode="displayNodeIcon"/>
53 <!--
54 <img src='interfaces/default/images/book.gif' width='18' height='11' border='0'/>-->
55 </xsl:otherwise>
56 </xsl:choose>
57 </xsl:template>
58
59 <xsl:template match="gsf:metadata">
60 <xslt:value-of disable-output-escaping="yes"><xsl:attribute name="select">metadataList/metadata[@name="<xsl:if test="@select='parent'">parent_</xsl:if><xsl:if test="@select='ancestors'">ancestors'<xsl:value-of select='@separator'/>'_</xsl:if><xsl:value-of select="@name"/>"]</xsl:attribute></xslt:value-of>
61 </xsl:template>
62 <!-- <xsl:choose>
63 <xsl:when test="@select='parent'">
64 <xslt:value-of><xsl:attribute name="select">parent::node()/metadataList/metadata[@name='<xsl:value-of select="@name"/>']</xsl:attribute></xslt:value-of>
65 </xsl:when>
66 <xsl:when test="@select='ancestors'">
67 Ancestor metadata
68 </xsl:when>
69 <xsl:otherwise>
70 <xslt:value-of><xsl:attribute name="select">metadataList/metadata[@name='<xsl:value-of select="@name"/>']</xsl:attribute></xslt:value-of>
71 </xsl:otherwise>
72 </xsl:choose>
73 </xsl:template>-->
74
75
76 <xsl:template match="gsf:text">
77 <xslt:apply-templates select="nodeContent"/>
78 </xsl:template>
79
80 <xsl:template match="*">
81 <xsl:copy>
82 <xsl:copy-of select="@*"/>
83 <xsl:apply-templates/>
84 </xsl:copy>
85 </xsl:template>
86
87
88<!-- copied from style for now-->
89<!-- Display the appropriate image, depending on the node type -->
90<xsl:template match="documentNode" mode="displayNodeIcon">
91
92 <!-- Root node: book icon (open or closed) -->
93 <xsl:if test="@nodeType='root'">
94 <xsl:choose>
95 <xsl:when test="documentNode">
96 <img border="0" width="28" height="23"
97 src="interfaces/default/images/openbook.gif"
98 alt="Close this book"/>
99 </xsl:when>
100 <xsl:otherwise>
101 <img border="0" width="18" height="11"
102 src="interfaces/default/images/book.gif"
103 alt="Open this document and view contents"/>
104 </xsl:otherwise>
105 </xsl:choose>
106 </xsl:if>
107
108 <!-- Interior node: folder icon (open or closed) -->
109 <xsl:if test="@nodeType='interior'">
110 <xsl:choose>
111 <xsl:when test="documentNode">
112 <img border="0" width="23" height="15"
113 src="interfaces/default/images/openfldr.gif"
114 alt="Close this folder"/>
115 </xsl:when>
116 <xsl:otherwise>
117 <img border="0" width="23" height="15"
118 src="interfaces/default/images/clsdfldr.gif"
119 alt="Open this folder and view contents"/>
120 </xsl:otherwise>
121 </xsl:choose>
122 </xsl:if>
123
124 <!-- Leaf node: page icon -->
125 <xsl:if test="@nodeType='leaf'">
126 <img border="0" width="16" height="21"
127 src="interfaces/default/images/itext.gif"
128 alt="View the document"/>
129 </xsl:if>
130</xsl:template>
131
132</xsl:stylesheet>
133
134
Note: See TracBrowser for help on using the repository browser.