From a46377bc66c36851643b1f5a57c7f59380cab183 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Sat, 22 Feb 2014 09:52:38 +0100
Subject: [PATCH 1/1] rss_converter_*.xsl: specify xml:base

Some feed readers expand relative URLs in items by extracting the base
URL from the enclosing <link/> element, however this is not a globally
accepted practice.

Specifying xml:base is useful to cover other ways in which relative URLs
are expanded, see:
  https://cyber.law.harvard.edu/rss/relativeURI.html
  http://www.w3.org/TR/xmlbase/#resolution
---
 rss_converter_dilbert.com.xsl | 1 +
 rss_converter_pump.io.xsl     | 4 ++++
 rss_converter_twitter.com.xsl | 1 +
 3 files changed, 6 insertions(+)

diff --git a/rss_converter_dilbert.com.xsl b/rss_converter_dilbert.com.xsl
index 7394b91..0fb28fc 100644
--- a/rss_converter_dilbert.com.xsl
+++ b/rss_converter_dilbert.com.xsl
@@ -65,6 +65,7 @@
     <xsl:template match="/">
 
         <rss version="2.0">
+            <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
             <channel>
                 <generator>Tweeper</generator>
                 <title>
diff --git a/rss_converter_pump.io.xsl b/rss_converter_pump.io.xsl
index 6b05d0c..b127f3a 100644
--- a/rss_converter_pump.io.xsl
+++ b/rss_converter_pump.io.xsl
@@ -26,6 +26,9 @@
 
     <xsl:output method="xml" indent="yes"/>
 
+    <xsl:variable name="domain-name" select="substring-after(//div[@id='profile-block']/@data-profile-id, '@')"/>
+    <xsl:variable name="BaseURL" select="concat('https://', $domain-name)"/>
+
     <xsl:variable name="user-name" select="substring-after(//div[@id='profile-block']/@data-profile-id, ':')"/>
 
     <xsl:template match="//div[@id='user-content-activities']//ul[@id='major-stream']/li">
@@ -52,6 +55,7 @@
     <xsl:template match="/">
 
         <rss version="2.0">
+            <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
             <channel>
                 <generator>Tweeper</generator>
                 <title>
diff --git a/rss_converter_twitter.com.xsl b/rss_converter_twitter.com.xsl
index 09ba933..3184044 100644
--- a/rss_converter_twitter.com.xsl
+++ b/rss_converter_twitter.com.xsl
@@ -65,6 +65,7 @@
     <xsl:template match="/">
 
         <rss version="2.0">
+            <xsl:attribute name="xml:base"><xsl:value-of select="$twitterBaseURL" /></xsl:attribute>
             <channel>
                 <generator>Tweeper</generator>
                 <title>
-- 
2.1.4