
Over the past several days I’ve been learning XSLT v3.0 (extensible stylesheet language transformations) so that I can transform my Atom feeds into an HTML (hyper text markup language) page. On top of that I can then style it with the use of CSS (Cascading Style Sheets). For those that don’t know Atom Syndication Format and RSS (really simple syndication) are XML (extensible markup language) based formats that allow users and applications to access updates of a website in a standardized manner without having to go to each one individual. Nowadays, most people don’t even realize it, but they are using one of these two formats to subscribe to a podcast or blog posts using various applications.
XSLT is an XML document with specific rules that will transform an input of an XML document in whatever you desire. In this case we are going from XML to HTML. To apply a stylesheet to your XML document you need to add the xml-stylesheet after the document type (doctype) declaration.
1
2
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xml" href="/feed.xslt.xml"?>
I’ve almost completed my feed transformation, but I unfortunately have come to a point where I’m not sure how to solve my problem, so this can be completed, and then I can talk about it to everyone.
My problem is this, my Atom feed itself contains a content element and that element contents has XML escaped characters. In this case HTML elements. When I access this content in XSLT I end up with literal HTML tags as text. I can’t seem to figure out how to convert or transform the XML escaped characters back, so they will be parsed as HTML elements.
If anyone can assist me with this problem, I would greatly appreciate. Please contact me.
Example of Escaped Characters
1
2
3
4
5
6
7
8
9
10
11
<p>Over the past several days I’ve been learning XSLT v3.0 (extensible stylesheet language transformations) so
that I can transform my Atom feeds into an HTML (hyper text markup language) page. On top of that I can then style it
with the use of CSS (Cascading Style Sheets). For those that don’t know Atom Syndication Format and RSS (really simple
syndication) are XML (extensible markup language) based formats that allow users and applications to access updates of a
website in a standardized manner without having to go to each one individual. Nowadays, most people don’t even realize
it but they are using one of these two formats to subscribe to a podcast or blog posts using various applications.</p
> < p>XSLT is an XML document with specific rules that will transform an input of an XML document in whatever
you desire. In this case we are going from XML to HTML. To apply a stylesheet to your XML document you need to add the
xml-stylesheet after the document type (doctype) declaration.</p> <figure class="highlight">
<code>
...
Screenshot of Rendered Output via XSLT
Example of Desired Results
1
2
3
4
5
6
7
8
9
10
11
<p>Over the past several days I’ve been learning XSLT v3.0 (extensible stylesheet language transformations) so that I
can transform my Atom feeds into an HTML (hyper text markup language) page. On top of that I can then style it with the
use of CSS (cascading style sheets). For those that don’t know Atom Syndication Format and RSS (really simple
syndication) are XML (extensible markup language) based formats that allow users and applications to access updates of a
website in a standardized manner without having to go to each one individual. Now a days most people don’t even realize
it but they are using one of these two formats to subscribe to a podcast or blog posts using various applications.</p>
<p>XSLT is an XML document with specific rules that will transform an input of an XML document in whatever you desire.
In this case we are going from XML to HTML. To apply a stylesheet to your XML document you need to add the
xml-stylesheet after the document type (doctype) declaration.</p> <figure class="highlight"><code>
...
</p>
I’m publishing this as part of 100 Days To Offload. You can join in yourself by visiting https://100daystooffload.com.
References
- Atom Syndication, Wikipedia
- RSS, Wikipedia
- Sadness, photo by geralt, published Nov 3, 2014
- XML, Wikipedia
- XSL Transformations (XSLT) Version 3.0, W3C Recommendation, Jun 8, 2017
- XSLT, Wikipedia
Changelog
-
- change topic
- remove tags atom, rss, xslt
-
- change topic
-
- fix meta description too short
- fix punctuation
- fix grammar