Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
galaxyproject
GitHub Repository: galaxyproject/training-material
Path: blob/main/feed.xslt.xml
1669 views
1
<xsl:stylesheet
2
version="1.0"
3
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
xmlns:atom="http://www.w3.org/2005/Atom"
5
exclude-result-prefixes="atom"
6
>
7
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
8
<xsl:template match="/">
9
<html xmlns="http://www.w3.org/1999/xhtml">
10
<head>
11
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
12
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
13
<title><xsl:value-of select="atom:feed/atom:title"/> • GTN News </title>
14
<link rel="icon" type="image/png">
15
<xsl:attribute name="href">
16
<xsl:value-of select="atom:feed/atom:logo"/>
17
</xsl:attribute>
18
</link>
19
<link href="https://fonts.googleapis.com/css2?family=Recursive:slnt,wght,CASL,CRSV,[email protected],300..800,0..1,0..1,1&amp;display=swap" rel="stylesheet"/>
20
<style type="text/css">
21
:root {--step--2: clamp(0.7813rem, 0.7747rem + 0.0326vi, 0.8rem);--step--1: clamp(0.9375rem, 0.9158rem + 0.1087vi, 1rem);--step-0: clamp(1.125rem, 1.0815rem + 0.2174vi, 1.25rem);--step-1: clamp(1.35rem, 1.2761rem + 0.3696vi, 1.5625rem);--step-2: clamp(1.62rem, 1.5041rem + 0.5793vi, 1.9531rem);--step-3: clamp(1.944rem, 1.771rem + 0.8651vi, 2.4414rem);--step-4: clamp(2.3328rem, 2.0827rem + 1.2504vi, 3.0518rem);--step-5: clamp(2.7994rem, 2.4462rem + 1.7658vi, 3.8147rem);--brand: #782760;--secondary: #b970a3;--brand-contrast: white;}
22
body {max-width:768px; margin: 0 auto; font-family: 'Recursive', serif; font-variation-settings: "CASL" 0, "CRSV" 1; font-size:var(--step--1); font-weight: 350;}
23
h1{margin:0;font-size:var(--step-3);line-height:1.125em; weight: 900; text-transform: capitalize;font-variation-settings: "wght" 900, "CRSV" 0.5, "CASL" 0;}
24
h2{margin:0;font-size:var(--step-2); font-weight: 500; font-variation-settings: "CRSV" 0.5, "CASL" 1;}
25
hgroup{margin-bottom:2rem;}
26
h3{font-size:var(--step-1);}
27
h4{font-size:var(--step-0);}
28
h5{font-size:var(--step--1);}
29
small{font-size:var(--step--2);}
30
.alert{background:#fff5b1;padding:4px 12px;margin:0 -12px}
31
a{text-decoration:none}
32
div.entry h3{margin-bottom:0}
33
div.entry p{margin:4px 0}
34
.authors{font-style: italic}
35
body { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: 'header' 'main' 'footer';}
36
header {grid-area: header; padding: 0.5em; border-bottom: 2px solid var(--secondary); display: flex; flex-direction: column;}
37
header img {margin-right: 0.5em}
38
main { grid-area: main; padding: 15px 5px 10px 5px;}
39
footer { grid-area: footer; padding: 0.5em; border-top: 2px solid var(--secondary); }
40
div.entry a { text-decoration: underline; }
41
div.entry a:hover{ text-decoration: underline; font-weight: 700;}
42
footer a { text-decoration: underline; }
43
footer a:hover{ font-weight:700; }
44
45
</style>
46
</head>
47
<body>
48
<header>
49
<div class="alert">
50
<p><strong>This is a web feed</strong>, also known as an RSS feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader app.</p>
51
</div>
52
<hgroup>
53
<h1>
54
<a class="head_link" target="_blank">
55
<xsl:attribute name="href">
56
<xsl:value-of select="concat(atom:feed/atom:link[@rel='alternate']/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
57
</xsl:attribute>
58
<xsl:value-of select="concat(atom:feed/atom:title, ' (Feed Preview)')"/>
59
</a>
60
</h1>
61
<p><xsl:value-of select="atom:feed/atom:subtitle"/></p>
62
</hgroup>
63
<h2>What is an RSS feed?</h2>
64
<p>An RSS feed is a data format that contains the latest content from a website, blog, or podcast. You can use feeds to <strong>subscribe</strong> to websites and get the <strong>latest content in one place</strong>.</p>
65
<ul>
66
<li><strong>Feeds put you in control.</strong> Unlike social media apps, there is no algorithm deciding what you see or read. You always get the latest content from the creators you care about.</li>
67
<li><strong>Feed are private by design.</strong> No one owns web feeds, so no one is harvesting your personal information and profiting by selling it to advertisers.</li>
68
<li><strong>Feeds are spam-proof.</strong> Had enough? Easy, just unsubscribe from the feed.</li>
69
</ul>
70
<p>All you need to do to get started is to add the URL (web address) for this feed to a special app called a newsreader. Visit <a href="https://aboutfeeds.com/">About Feeds</a> to get started with newsreaders and subscribing. It’s free. </p>
71
</header>
72
<main>
73
<h2>Recent Items</h2>
74
<xsl:apply-templates select="atom:feed/atom:entry" />
75
</main>
76
<footer>
77
<a target="_blank" href="https://training.galaxyproject.org/training-material/news/2024/06/04/gtn-standards-rss.html?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss">GTN RSS Feed</a>
78
79
<a target="_blank" href="https://spdx.org/licenses/CC-BY-4.0">CC-BY 4.0</a>
80
81
<a target="_blank" href="https://training.galaxyproject.org/training-material/faqs/gtn/fair_training.html?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss">FAIR</a>
82
83
<a target="_blank">
84
<xsl:attribute name="href">
85
<xsl:value-of select="concat(atom:feed/atom:link[@rel='self']/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
86
</xsl:attribute>
87
🔗
88
</a>
89
</footer>
90
</body>
91
</html>
92
</xsl:template>
93
94
<xsl:template match="atom:entry">
95
<div class="entry">
96
<xsl:attribute name="data-has-link">
97
<xsl:choose>
98
<xsl:when test="atom:link/@href">true</xsl:when>
99
<xsl:otherwise>false</xsl:otherwise>
100
</xsl:choose>
101
</xsl:attribute>
102
<h3>
103
<xsl:choose>
104
<xsl:when test="atom:link/@href">
105
<a target="_blank">
106
<xsl:attribute name="href">
107
<xsl:value-of select="concat(atom:link/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
108
</xsl:attribute>
109
<xsl:value-of select="atom:title"/>
110
</a>
111
</xsl:when>
112
<xsl:otherwise>
113
<xsl:value-of select="atom:title"/>
114
</xsl:otherwise>
115
</xsl:choose>
116
</h3>
117
<!-- If author isn't "GTN" -->
118
<xsl:if test="atom:author/atom:name != 'GTN'">
119
<p class="authors">
120
<i>By: </i><xsl:for-each select="atom:author">
121
<a href="{atom:uri}">
122
<xsl:value-of select="atom:name" />
123
</a>
124
<xsl:if test="position() != last()">
125
<xsl:text>, </xsl:text>
126
</xsl:if>
127
</xsl:for-each>
128
</p>
129
</xsl:if>
130
<!-- if summary -->
131
<p class="summary">
132
<xsl:choose>
133
<xsl:when test="atom:summary">
134
<xsl:value-of select="atom:summary" disable-output-escaping="yes" />
135
</xsl:when>
136
<xsl:when test="atom:content">
137
<xsl:copy-of select="atom:content" />
138
</xsl:when>
139
</xsl:choose>
140
</p>
141
<small>
142
Published: <xsl:value-of select="atom:updated" /> <br/>
143
Tags:
144
<xsl:for-each select="atom:category">
145
<xsl:value-of select="@term" />
146
<xsl:if test="position() != last()">
147
<xsl:text>, </xsl:text>
148
</xsl:if>
149
</xsl:for-each>
150
</small>
151
</div>
152
</xsl:template>
153
</xsl:stylesheet>
154
155