sjehuda Author




Conclusion: From my study, this is a deliberate attempt to eliminate the XSLT and XPath technologies.

Boycott Mozilla and it's counterparts that cooperating with it!


3.00MB
3.07MB

146.38KB
146.39KB
146.40KB
146.41KB
146.42KB
146.43KB
146.44KB
146.45KB
146.46KB
146.47KB
146.48KB


xsl

<xsl:value-of select='atom:link[contains(@rel,"alternate")]/@href'/>

xml

    <entry>
      <title>2.7.0 Maintenance and security release</title>
      <link href="http://www.freerdp.com/2022/04/25/2_7_0-release" />
      <updated>2022-04-25T00:00:00+00:00</updated>
      <id>http://www.freerdp.com/2022/04/25/2_7_0-release</id>
      <content type="html">&lt;p&gt;FreeRDP 2.7.0 has just been released and uploaded to&lt;/p&gt;


Dino. Communicating happiness
https://dino.im/index.xml
https://dino.im/toot/index.xml

Problem:
Dino.im Toot links don't appear because title is empty, therefor link is not displayed and isn't clickable/reachable to end-user.

Solution (XSLT):
When there's no title, set text to (No title) or *** No title *** (Liferea fashion)

Generated HTML code:

<section xmlns="http://www.w3.org/1999/xhtml" id="articles"><div class="entry">
<div class="title"><a href="https://dino.im/toot/107787204408646020/" title="" id="newspaper-oujs-1"></a></div>
<div class="published">Sat, 12 Feb 2022 21:43:35 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/106228549009869402/" title="" id="newspaper-oujs-2"></a></div>
<div class="published">Thu, 13 May 2021 15:17:01 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/105198712041391648/" title="" id="newspaper-oujs-3"></a></div>
<div class="published">Thu, 12 Nov 2020 18:15:56 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/104671894466537578/" title="" id="newspaper-oujs-4"></a></div>
<div class="published">Tue, 11 Aug 2020 17:19:18 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/104237036622834210/" title="" id="newspaper-oujs-5"></a></div>
<div class="published">Tue, 26 May 2020 22:09:14 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103568619376380206/" title="" id="newspaper-oujs-6"></a></div>
<div class="published">Wed, 29 Jan 2020 21:01:56 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103385843480659384/" title="" id="newspaper-oujs-7"></a></div>
<div class="published">Sat, 28 Dec 2019 14:19:37 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103328905174441773/" title="" id="newspaper-oujs-8"></a></div>
<div class="published">Wed, 18 Dec 2019 12:59:28 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/103018769092949060/" title="" id="newspaper-oujs-9"></a></div>
<div class="published">Thu, 24 Oct 2019 18:27:47 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102872465350824728/" title="" id="newspaper-oujs-10"></a></div>
<div class="published">Sat, 28 Sep 2019 22:20:49 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102809054908406084/" title="" id="newspaper-oujs-11"></a></div>
<div class="published">Tue, 17 Sep 2019 17:34:42 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102763956386246870/" title="" id="newspaper-oujs-12"></a></div>
<div class="published">Mon, 09 Sep 2019 18:25:33 +0000</div>
<div class="content"></div>
</div>
<div class="entry">
<div class="title"><a href="https://dino.im/toot/102700206576283877/" title="" id="newspaper-oujs-13"></a></div>
<div class="published">Thu, 29 Aug 2019 12:13:08 +0000</div>
<div class="content"></div>
</div></section>


Hello,

I'm developing a script that does the followings:

  1. Creates a new page (from HTML and CSS string)
  2. Extract media from page
  3. Embed the media and metadata inside the new page
  • Both media and metadata placements vary from site to site.
  1. Replace old page by new

The question is this:
**Should I allocate the script into sections of action or do a switch/case to any domain seperately?
**
First (allocate by action) may make the script shorter.
Second (allocate by domain) will make the script longer but easily manageable.

Is there another option?
What's best?





Just use var or let....

Yes.

I didn't realize that I've not refreshed the page.
Fx says both docs (uri and stylesheet) are valid.

I still don't know what's left to be done, other than sending a bug to bugzilla and they probably worsen the current state in favor of big business and special interest, IMHO.


I stand corrected. Both are OK

parsing succeeded debugger eval code:10:11

  xslFile = '<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom" version="1.0"><xsl:output method="html" indent="yes" omit-xml-decleration="no"/><!-- Atom 1.0 Syndication Format --><xsl:output media-type="application/atom+xml"/><xsl:template match="/atom:feed"><!-- index right-to-left language codes --><!-- TODO http://www.w3.org/TR/xpath/#function-lang --><xsl:variable name="rtl" select="@xml:lang[         contains(self::node(),&quot;ar&quot;) or contains(self::node(),&quot;fa&quot;) or contains(self::node(),&quot;he&quot;) or contains(self::node(),&quot;ji&quot;) or contains(self::node(),&quot;ku&quot;) or contains(self::node(),&quot;ur&quot;) or          contains(self::node(),&quot;yi&quot;)]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;description&quot;"/><xsl:with-param name="content" select="atom:subtitle"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;generator&quot;"/><xsl:with-param name="content" select="&quot;syndication4humans https://sjehuda.github.io/&quot;"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;mimetype&quot;"/><xsl:with-param name="content" select="&quot;application/atom+xml&quot;"/></xsl:call-template><title><xsl:choose><xsl:when test="atom:title and not(atom:title=&quot;&quot;)"><xsl:value-of select="atom:title"/></xsl:when><xsl:otherwise>Falkon Feed Viewer</xsl:otherwise></xsl:choose></title><!-- TODO media="print" --><link href="syndication.css" rel="stylesheet" type="text/css" media="screen"/><!-- whether language code is of direction right-to-left --><xsl:if test="$rtl"><link id="semitic" href="syndication-rtl.css" rel="stylesheet" type="text/css"/></xsl:if></head><body><div id="feed"><header><!-- feed title --><div id="title"><xsl:choose><xsl:when test="atom:title and not(atom:title=&quot;&quot;)"><xsl:attribute name="title"><xsl:value-of select="atom:title"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><!-- feed subtitle --><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="atom:subtitle"/></xsl:attribute><xsl:value-of select="atom:subtitle"/></div></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = &quot;feed:&quot; + location.href"/><a title="Learn about syndication feed" onclick="document.getElementById(&quot;aboutfeed&quot;).classList.toggle(&quot;show&quot;);" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://falkon.org/get-reader/" title="Get a feed reader for desktop and mobile"/><a href="https://falkon.org/about-feeds/" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="atom:entry"><div id="toc"><xsl:for-each select="atom:entry"><xsl:if test="atom:title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:element></xsl:if></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><!-- feed entry --><xsl:choose><xsl:when test="atom:entry"><xsl:for-each select="atom:entry"><div class="entry"><!-- entry title --><xsl:if test="atom:title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="atom:link[contains(@rel,&quot;alternate&quot;)]/@href"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="atom:title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="atom:title"/></xsl:element></div></xsl:if><!-- geographic location --><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, &quot; &quot;)"/><xsl:variable name="lng" select="substring-after(georss:point, &quot; &quot;)"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">📍</a></span></xsl:when></xsl:choose><!-- entry date --><xsl:choose><xsl:when test="atom:updated"><div class="updated"><xsl:value-of select="atom:updated"/></div></xsl:when><xsl:when test="atom:published"><div class="published"><xsl:value-of select="atom:published"/></div></xsl:when><xsl:otherwise><div class="warning atom1 published"/></xsl:otherwise></xsl:choose><!-- /div --><!-- entry content --><!-- entry summary of GitLab Atom Syndication Feeds --><xsl:if test="atom:content or atom:summary"><div class="content"><xsl:choose><xsl:when test="atom:summary[contains(@type,&quot;text&quot;)]"><xsl:attribute name="type"><xsl:value-of select="atom:summary/@type"/></xsl:attribute><xsl:value-of select="atom:summary"/></xsl:when><xsl:when test="atom:summary[contains(@type,&quot;base64&quot;)]"><!-- TODO add xsl:template to handle inline media --></xsl:when><xsl:when test="atom:content[contains(@type,&quot;text&quot;)]"><xsl:attribute name="type"><xsl:value-of select="atom:content/@type"/></xsl:attribute><xsl:value-of select="atom:content"/></xsl:when><xsl:when test="atom:content[contains(@type,&quot;base64&quot;)]"><!-- TODO add xsl:template to handle inline media --></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="atom:summary and not(atom:summary=&quot;&quot;)"><xsl:value-of select="atom:summary" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="atom:content" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose></xsl:otherwise></xsl:choose></div></xsl:if><!-- entry enclosure --><xsl:if test="atom:link[contains(@rel,&quot;enclosure&quot;)]"><div class="enclosure" title="Right-click and Save link as…"><xsl:for-each select="atom:link[contains(@rel,&quot;enclosure&quot;)]"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@href"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:if test="@length &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each><xsl:for-each select="media:content"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:if test="@fileSize &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@fileSize"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div><!-- entry id --><xsl:if test="not(atom:id)"><div class="warning atom1 id"/></xsl:if></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><!-- extract filename from given url string --><xsl:template name="extract-filename"><xsl:param name="url"/><xsl:choose><xsl:when test="contains($url,&quot;/&quot;)"><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="substring-after($url,&quot;/&quot;)"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:value-of select="$url"/></xsl:otherwise></xsl:choose></xsl:template><!-- set page metadata --><xsl:template name="metadata"><xsl:param name="name"/><xsl:param name="content"/><xsl:if test="$content and not($content=&quot;&quot;)"><xsl:element name="meta"><xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute><xsl:attribute name="content"><xsl:value-of select="$content"/></xsl:attribute></xsl:element></xsl:if></xsl:template><!-- RSS 2.0 Syndication Format --><xsl:output media-type="application/rss+xml"/><xsl:template match="/rss"><!-- index right-to-left language codes --><xsl:variable name="rtl" select="channel/language[         contains(text(),&quot;ar&quot;) or contains(text(),&quot;fa&quot;) or contains(text(),&quot;he&quot;) or          contains(text(),&quot;ji&quot;) or contains(text(),&quot;ku&quot;) or contains(text(),&quot;ur&quot;) or          contains(text(),&quot;yi&quot;)]"/><html><head><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;description&quot;"/><xsl:with-param name="content" select="channel/description"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;generator&quot;"/><xsl:with-param name="content" select="&quot;syndication4humans https://sjehuda.github.io/&quot;"/></xsl:call-template><xsl:call-template name="metadata"><xsl:with-param name="name" select="&quot;mimetype&quot;"/><xsl:with-param name="content" select="&quot;application/rss+xml&quot;"/></xsl:call-template><title><xsl:choose><xsl:when test="channel/title and not(channel/title=&quot;&quot;)"><xsl:value-of select="channel/title"/></xsl:when><xsl:otherwise>Falkon Feed Viewer</xsl:otherwise></xsl:choose></title><!-- TODO media="print" --><link href="syndication.css" rel="stylesheet" type="text/css" media="screen"/><!-- whether language code is of direction right-to-left --><xsl:if test="$rtl"><link id="semitic" href="syndication-rtl.css" rel="stylesheet" type="text/css"/></xsl:if></head><body><div id="feed"><header><!-- feed title --><div id="title"><xsl:choose><xsl:when test="channel/title and not(channel/title=&quot;&quot;)"><xsl:attribute name="title"><xsl:value-of select="channel/title"/></xsl:attribute><xsl:value-of select="channel/title"/></xsl:when><xsl:otherwise><div class="empty"/></xsl:otherwise></xsl:choose></div><!-- feed subtitle --><xsl:choose><xsl:when test="channel/itunes:subtitle"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="channel/itunes:subtitle"/></xsl:attribute><xsl:value-of select="channel/itunes:subtitle"/></div></xsl:when><xsl:when test="channel/description"><div id="subtitle"><xsl:attribute name="title"><xsl:value-of select="channel/description"/></xsl:attribute><xsl:value-of select="channel/description"/></div></xsl:when></xsl:choose></header><section id="links"><a title="Click to get the latest updates and news" onclick="location.href = &quot;feed:&quot; + location.href"/><a title="Learn about syndication feed" onclick="document.getElementById(&quot;aboutfeed&quot;).classList.toggle(&quot;show&quot;);" class="popup"><span class="popuptext" id="aboutfeed"/></a><a href="https://falkon.org/get-reader/" title="Get a feed reader for desktop and mobile"/><a href="https://falkon.org/about-feeds/" title="Learn the benefits of using feeds for personal and corporates"/></section><xsl:choose><xsl:when test="channel/item"><div id="toc"><xsl:for-each select="channel/item"><xsl:choose><xsl:when test="itunes:subtitle"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></xsl:when><xsl:when test="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:text>#newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="title"/></xsl:element></xsl:when></xsl:choose></xsl:for-each></div></xsl:when></xsl:choose><section id="articles"><!-- feed entry --><xsl:choose><xsl:when test="channel/item"><xsl:for-each select="channel/item"><div class="entry"><!-- entry title --><xsl:choose><xsl:when test="itunes:subtitle"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="itunes:subtitle"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="itunes:subtitle"/></xsl:element></div></xsl:when><xsl:when test="title"><div class="title"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute><xsl:attribute name="id"><xsl:text>newspaper-oujs-</xsl:text><xsl:value-of select="position()"/></xsl:attribute><xsl:value-of select="title"/></xsl:element></div></xsl:when><xsl:otherwise><div class="warning rss2 title"/></xsl:otherwise></xsl:choose><!-- geographic location --><xsl:choose><xsl:when test="geo:lat and geo:long"><xsl:variable name="lat" select="geo:lat"/><xsl:variable name="lng" select="geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="geo:Point"><xsl:variable name="lat" select="geo:Point/geo:lat"/><xsl:variable name="lng" select="geo:Point/geo:long"/><span class="geolocation"><a href="geo:{$lat},{$lng}">📍</a></span></xsl:when><xsl:when test="georss:point"><xsl:variable name="lat" select="substring-before(georss:point, &quot; &quot;)"/><xsl:variable name="lng" select="substring-after(georss:point, &quot; &quot;)"/><xsl:variable name="name" select="georss:featurename"/><span class="geolocation"><a href="geo:{$lat},{$lng}" title="{$name}">📍</a></span></xsl:when></xsl:choose><!-- entry date --><xsl:if test="pubDate"><div class="published"><xsl:value-of select="pubDate"/></div></xsl:if><!-- /div --><!-- entry content --><xsl:choose><!-- complete text post --><xsl:when test="content:encoded"><div class="content"><xsl:value-of select="content:encoded" disable-output-escaping="yes"/></div></xsl:when><!-- description of post --><xsl:when test="description"><div class="content"><xsl:value-of select="description" disable-output-escaping="yes"/></div></xsl:when><!-- itunes text post --><xsl:when test="itunes:summary"><div class="content"><xsl:value-of select="itunes:summary" disable-output-escaping="yes"/></div></xsl:when><xsl:otherwise><div class="warning rss2 description"/></xsl:otherwise></xsl:choose><!-- entry enclosure --><xsl:if test="enclosure or media:content"><div class="enclosure" title="Right-click and Save link as…"><xsl:for-each select="enclosure"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="substring-before(@type,&quot;/&quot;)"/></xsl:attribute></xsl:element><xsl:if test="@length &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@length"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each><xsl:for-each select="media:content"><xsl:element name="span"><xsl:attribute name="icon"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute><xsl:attribute name="download"/><xsl:call-template name="extract-filename"><xsl:with-param name="url" select="@url"/></xsl:call-template></xsl:element><xsl:element name="span"><xsl:attribute name="class"><xsl:value-of select="@medium"/></xsl:attribute></xsl:element><xsl:if test="@fileSize &gt; 0"><xsl:call-template name="transform-filesize"><xsl:with-param name="length" select="@fileSize"/></xsl:call-template></xsl:if><xsl:element name="br"/></xsl:for-each></div></xsl:if></div></xsl:for-each></xsl:when><xsl:otherwise><div class="notice no-entry"/></xsl:otherwise></xsl:choose></section></div></body></html></xsl:template><!-- transform filesize from given length string --><xsl:template name="transform-filesize"><xsl:param name="length"/><!-- TODO consider xsl:decimal-format and xsl:number --><xsl:choose><!-- TODO consider removal of Byte --><xsl:when test="$length &lt; 2"><xsl:value-of select="$length"/> Byte </xsl:when><xsl:when test="floor($length div 1024) &lt; 1"><xsl:value-of select="$length"/> Bytes </xsl:when><xsl:when test="floor($length div (1024 * 1024)) &lt; 1"><xsl:value-of select="floor($length div 1024)"/>.<xsl:value-of select="substring($length mod 1024,0,2)"/> KiB </xsl:when><xsl:when test="floor($length div (1024 * 1024 * 1024)) &lt; 1"><xsl:value-of select="floor($length div (1024 * 1024))"/>.<xsl:value-of select="substring($length mod (1024 * 1024),0,2)"/> MiB </xsl:when><xsl:otherwise><!-- P2P links --><xsl:value-of select="floor($length div (1024 * 1024 * 1024))"/>.<xsl:value-of select="substring($length mod (1024 * 1024 * 1024),0,2)"/> GiB </xsl:otherwise></xsl:choose></xsl:template></xsl:stylesheet>';
  domParser = new DOMParser();
  xsltStylesheet = domParser.parseFromString(xslFile, "application/xml");
const errorNode = xsltStylesheet.querySelector('parsererror');
if (errorNode) {
  // parsing failed
  console.log("parsing failed")
} else {
  // parsing succeeded
  console.log("parsing succeeded")
}

DOMParser.parseFromString has been notoriously different between browsers...

xslFile = '<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet ...</xsl:stylesheet>';
  domParser = new DOMParser();
  xsltStylesheet = domParser.parseFromString(xslFile, "application/xml");
const errorNode = xsltStylesheet.querySelector('parsererror');
if (errorNode) {
  // parsing failed
  console.log("parsing failed")
} else {
  // parsing succeeded
  console.log("parsing succeeded")
}

I don't know how to handle this error:

Uncaught SyntaxError: redeclaration of const errorNode
debugger eval code:1
debugger eval code:1:1

[Learn More]

For record, I've tested against document.URI. Document is OK

xmlHTTPRequest = new XMLHttpRequest();
xmlHTTPRequest.open('GET', document.documentURI, false);
xmlHTTPRequest.send();
xmlHTTPRequest.getResponseHeader('Content-Type');
xmlFile = xmlHTTPRequest.responseText;
domParser = new DOMParser();
xmlDocument = domParser.parseFromString(xmlFile, 'text/xml');
const errorNode = xmlDocument.querySelector('parsererror');
if (errorNode) {
  // parsing failed
  console.log("parsing failed")
} else {
  // parsing succeeded
  console.log("parsing succeeded")
}


So I did, placing the exact address inside @include or @match. Same result.

I also executed the script from console.
It works with Falkon, but not with Fx.


Re: @Martii:

One other quick note...

How exactly please?
This script has to be inclusive.

Perhaps // @match *://*?


Are you sure that 181 is that line...

Certainly.
Clicking on Newspaper.user.js:181 highlights code xsltProcessor.importStylesheet(xsltStylesheet);
I've also changed null to undefined and also deleted all lines. Both didn't work and yield the same result.

Your XML appears to be validated properly

I always check that it works in the traditional way, adding a reference to the stylesheet inside a given XML.

The RSS feed appears at a very quick glance to be correct too...

We can always test against https://kodi.tv/rss.xml or any other feed that doesn't cause to download prompt to open.

DOMParser.parseFromString has been notoriously different between browsers (a.k.a finicky) over the years on how it handles Strings and might be throwing an error since you don't appear to be checking for that.

I'll take a look.


I've briefly skimmed over the script syntax and I don't see anything right away that would prevent it from working. Do you get any errors/warnings in Browser Console specific to the script?

Only when using Tampermonkey for Firefox. Greasemonkey for Firefox shows no errors.

Uncaught 
Exception { name: "", message: "", result: 2153775105, filename: "moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0", lineNumber: 181, columnNumber: 0, data: null, stack: "renderFeed@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:181:17\ncheckMediaType@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:138:15\nhttpGetAsync/xmlHTTPRequest.onreadystatechange@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:85:15\nEventHandlerNonNull*httpGetAsync@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:69:3\ntms_acd40735_0cb5_4484_bcb0_b1d674174df0$@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:249:13\nit@https://www.blacklistednews.com/rss.php:14:1075\nwindow[\"__p__13666865.141279189\"]/</<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:131\nwindow[\"__p__13666865.141279189\"]/<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:531\nwindow[\"__p__13666865.141279189\"]@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:251:6\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:1\nit@https://www.blacklistednews.com/rss.php:14:1075\nI[t]@https://www.blacklistednews.com/rss.php:4:485\nit@https://www.blacklistednews.com/rss.php:14:1075\ny@https://www.blacklistednews.com/rss.php:6:40\nsend@https://www.blacklistednews.com/rss.php:7:128\nV@https://www.blacklistednews.com/rss.php:3:307\nE_u/<@https://www.blacklistednews.com/rss.php:4:275\nE_u@https://www.blacklistednews.com/rss.php:4:330\ncreate/<@eval:64:45\ncreate@eval:65:178\nl@eval:6:96\nn@eval:5:325\nrun@eval:6:188\nTM_back/</</<@eval:67:49\nit@https://www.blacklistednews.com/rss.php:14:1075\nt@https://www.blacklistednews.com/rss.php:15:366\nTM_back/</<@eval:67:30\nTM_back/<@eval:67:59\nTM_back@eval:68:3\nwindow[\"__c__10191374.835477514\"]@eval:68:10\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@eval:1:1\n" }
​
columnNumber: 0
​
data: null
​
filename: "moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0"
​
lineNumber: 181
​
message: ""
​
name: ""
​
result: 2153775105
​
stack: "renderFeed@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:181:17\ncheckMediaType@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:138:15\nhttpGetAsync/xmlHTTPRequest.onreadystatechange@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:85:15\nEventHandlerNonNull*httpGetAsync@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:69:3\ntms_acd40735_0cb5_4484_bcb0_b1d674174df0$@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:249:13\nit@https://www.blacklistednews.com/rss.php:14:1075\nwindow[\"__p__13666865.141279189\"]/</<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:131\nwindow[\"__p__13666865.141279189\"]/<@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:531\nwindow[\"__p__13666865.141279189\"]@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:251:6\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@moz-extension://21fd3529-b958-4444-a848-78dc744a32b7/userscripts/Newspaper.user.js?id=acd40735-0cb5-4484-bcb0-b1d674174df0:1:1\nit@https://www.blacklistednews.com/rss.php:14:1075\nI[t]@https://www.blacklistednews.com/rss.php:4:485\nit@https://www.blacklistednews.com/rss.php:14:1075\ny@https://www.blacklistednews.com/rss.php:6:40\nsend@https://www.blacklistednews.com/rss.php:7:128\nV@https://www.blacklistednews.com/rss.php:3:307\nE_u/<@https://www.blacklistednews.com/rss.php:4:275\nE_u@https://www.blacklistednews.com/rss.php:4:330\ncreate/<@eval:64:45\ncreate@eval:65:178\nl@eval:6:96\nn@eval:5:325\nrun@eval:6:188\nTM_back/</</<@eval:67:49\nit@https://www.blacklistednews.com/rss.php:14:1075\nt@https://www.blacklistednews.com/rss.php:15:366\nTM_back/</<@eval:67:30\nTM_back/<@eval:67:59\nTM_back@eval:68:3\nwindow[\"__c__10191374.835477514\"]@eval:68:10\nit@https://www.blacklistednews.com/rss.php:14:1075\nset@https://www.blacklistednews.com/rss.php:3:400\n@eval:1:1\n"
​
<prototype>: ExceptionPrototype { toString: toString(), name: Getter, message: Getter, … }
​​
columnNumber: 
​​
data: 
​​
filename: 
​​
lineNumber: 
​​
message: 
​​
name: 
​​
result: 
​​
stack: 
​​
toString: function toString()
​​
Symbol(Symbol.toStringTag): "Exception"
​​
<get columnNumber()>: function columnNumber()
​​
<get data()>: function data()
​​
<get filename()>: function filename()
​​
<get lineNumber()>: function lineNumber()
​​
<get message()>: function message()
​​
<get name()>: function name()
​​
<get result()>: function result()
​​
<get stack()>: function stack()
​​
<set stack()>: function stack()
​​
<prototype>: Object { … }
Newspaper.user.js:181

It points to xsltProcessor.importStylesheet(xsltStylesheet);

Btw what version of Falkon are you using please.

falkon 22.04.0-1 (x86_64) - Arch Linux


Hello,

I'm using Falkon Browser which has it's own Greasemonkey extension.
I'm happily using Newspaper Native Feed Reader on Falkon.

Apparently, this script doesn't work with Firefox (tested against Greasemonkey and Tampermonkey).

However, since Firefox has dropped RSS (why, I don't know) we can still open files with PHP and XML extensions (in contrast .atom and .rss open download prompt since 2018), so trying against these feeds doesn't yield results.
https://kodi.tv/rss.xml
https://www.blacklistednews.com/rss.php

Please help!

It might has to do with these:
https://techdows.com/2018/10/mozilla-removes-rss-live-bookmarks-support-from-firefox-64.html
https://www.zdnet.com/article/end-nears-for-rss-firefox-64-to-drop-built-in-support-for-rss-atom-feeds-says-mozilla/
https://www.bleepingcomputer.com/news/software/mozilla-to-remove-support-for-built-in-feed-reader-from-firefox/
http://camendesign.com/blog/rss_is_dying (RSS lives on!)



Fixed. We reverse back the following changes

--- /scripts/sjehuda/Newspaper/source@1.0.2+e8feeb3
+++ /scripts/sjehuda/Newspaper/source
@@ -10,8 +10,8 @@
 // @include     * 
-// @version     1.0.2 
-// @run-at      document-start
+// @version     1.0.3 
+// @run-at      document-end
 // ==/UserScript==
 
 // NOTE
@@ -65,7 +65,7 @@
 function httpGetAsync(uri, callback) {
   var xmlHTTPRequest = new XMLHttpRequest();
   xmlHTTPRequest.onreadystatechange = function() { 
-    if (xmlHTTPRequest.readyState === 3) {
+    if (xmlHTTPRequest.readyState === 4) {
       xmlFile = xmlHTTPRequest.responseText;
       if (document.URL.startsWith('file:')) {
         mimeType = document.contentType;