My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;">
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:encoder="xalan://java.net.URLEncoder"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:dsm="http://www.educationau.edu.au/"
xmlns:atom="http://www.w3.org/2005/Atom"
exclude-result-prefixes="xsl encoder">

<xsl:output indent="no"
method="xml"
omit-xml-declaration="no"/>

<xsl:variable name="found" select="/results/summary/found"/>
<xsl:variable name="query" select="/results/summary/qp[@name='q']"/>

<xsl:template match="/">

<rss version="2.0">
<channel>
<language>en</language>
<copyright><xsl:value-of select="/results/copyright"/></copyright>
<managingEditor>2</managingEditor>
<link>http://dsm.educationau.edu.au</link>
<title>DSM Search for '<xsl:value-of select="/results/summary/qp[@name='q']"/>'</title>
<description><xsl:value-of select="/results/summary/source"/> </description>
<opensearch:totalResults><xsl:value-of select="/results/summary/found"/></opensearch:totalResults>
<opensearch:startIndex><xsl:value-of select="/results/summary/qp[@name='start']"/></opensearch:startIndex>
<opensearch:itemsPerPage><xsl:value-of select="/results/summary/qp[@name='ps']"/></opensearch:itemsPerPage>
<atom:link rel="search" type="application/opensearchdescription+xml" href="http://example.com/opensearchdescription.xml"/>
<opensearch:Query role="request" searchTerms="{$query}" startPage="1" />

<dsm:mode><xsl:value-of select="/results/summary/mode"/></dsm:mode>
<dsm:token><xsl:value-of select="/results/summary/token"/></dsm:token>
<dsm:completed><xsl:value-of select="/results/summary/completed"/></dsm:completed>

<xsl:apply-templates select="/results/sources"/>

<xsl:if test="$found&gt;0">
<xsl:apply-templates select="/results/item"/>
</xsl:if>
</channel>
</rss>
</xsl:template>

<xsl:template match="/results/sources|/results/sources//*">
<xsl:element name="{concat('dsm:',local-name())}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<xsl:template match="/results/item">
<xsl:variable name="sourceid" select="@source" />

<item>

<title><xsl:value-of select="normalize-space(./title)"/>
<xsl:value-of select="/results/sources/source[@id=$sourceid]/title"/>
</title>
<link><xsl:value-of select="./link"/></link>
<description><xsl:value-of select="./description"/></description>

<xsl:if test="string-length(./resultsource) &gt; 0"><dsm:source><xsl:value-of select="./resultsource"/></dsm:source> </xsl:if>
<xsl:if test="string-length(./relevance) &gt; 0"><dsm:relevance><xsl:value-of select="./relevance"/></dsm:relevance></xsl:if>

<xsl:if test="string-length(./date) &gt; 0"><dsm:date><xsl:value-of select="./date"/></dsm:date></xsl:if>
<xsl:if test="string-length(./download) &gt; 0"><dsm:download><xsl:value-of select="./download"/></dsm:download></xsl:if>
<xsl:if test="string-length(./preview) &gt; 0"><dsm:preview><xsl:value-of select="./preview"/></dsm:preview></xsl:if>
<xsl:if test="string-length(./identifier) &gt; 0"><dsm:identifier><xsl:value-of select="./identifier"/></dsm:identifier></xsl:if>
<xsl:if test="string-length(./rights) &gt; 0"><dsm:rights><xsl:value-of select="./rights"/></dsm:rights></xsl:if>
<xsl:if test="string-length(./metadatascheme) &gt; 0"><dsm:metadatascheme><xsl:value-of select="./metadatascheme"/></dsm:metadatascheme></xsl:if>
<xsl:if test="string-length(./contentpackage) &gt; 0"><dsm:contentpackage><xsl:value-of select="./contentpackage"/></dsm:contentpackage></xsl:if>

<xsl:call-template name="processMetadataItems"/>

</item>

</xsl:template>

<xsl:template name="processMetadataItems">
<xsl:apply-templates select="./metadata"/>
</xsl:template>

<xsl:template match="/results/item/metadata">
<xsl:if test="string-length(./) &gt; 0"><dsm:metadata name="{self::node()/@name}"> <xsl:value-of select="./"/></dsm:metadata></xsl:if>
</xsl:template>

</xsl:stylesheet>
Show details Hide details

Change log

r32 by simon.kahl on Mar 01, 2008   Diff
coalesce metadata fields for magpie
transform
Go to: 
Project members, sign in to write a code review

Older revisions

r15 by nick.lothian on Jan 09, 2008   Diff
Initial import.
All revisions of this file

File info

Size: 4489 bytes, 92 lines
Hosted by Google Code