Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #235146

Re: generate a rss.xml from a bunch of HTML files

From davidson <davidson@freevolt.org>
Newsgroups linux.debian.user
Subject Re: generate a rss.xml from a bunch of HTML files
Date 2021-05-13 00:10 +0200
Message-ID <Ce5df-2HL-1@gated-at.bofh.it> (permalink)
References <CcOo9-3Cd-1@gated-at.bofh.it> <CcZ0d-2B8-5@gated-at.bofh.it> <CdeVj-4w5-1@gated-at.bofh.it> <CdfRn-5ba-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 10 May 2021 Emanuel Berg wrote:
>>> ...and this somewhat more complex-looking one...
>>>
>>>  "W3C RSS 1.0 News Feed Creation How-To"
>>>  https://www.w3.org/2001/10/glance/doc/howto
>>
>> Great, but stops on <figure> and <figurecaption>,

Elsewhere in the thread you seem to have moved on from XSLT to more
promising options, but I'll make a few comments here anyways.

I suspect that those specific tags are not a primary cause of
difficulty.

I could be mistaken, of course. But I am unable to replicate this
without more information about the input document.

I wonder whether the input document is XML. (No unclosed tags, etc.)

>> these are HTML5 tags:
>>
>>   http://html5doctor.com/the-figure-figcaption-elements/
>>
>> so either we must change the XSLT rules to make use of for
>> example the caption at least, _or_ we must either make
>> a rule or tell the tool to ignore them, if such an option
>> exists...
>
> Here is the Makefile [last] only one problem, the XSLT file or
> xsltproc tool (?) doesn't seem to transform the HTML into RSS,
> really, output is basically a text file with no markup whatsoever
> except for the first line which is
>
>  <?xml version="1.0" encoding="utf-8"?>

TLDR: What you describe will happen when none of an XSLT stylesheet's
template rules match anything in the input.

XSLT is template-based, a little bit like sed or awk, but instead of
processing records (lines) in a text file it processes the nodes of an
XML tree.

When a node matches no template in your stylesheet, then *built-in*
template rules are applied:

   * The built-in template rule for the "document node" (at top of the
   tree), is to apply templates to that node's children.

   * The built-in template rule for any element is the same as for the
     document node -- apply templates to the children of that element.

   * And, when we reach the leaves of the tree, the built-in template
   rule for text nodes is to copy the text to the result tree.

As a consequence, applying an XSLT stylesheet to a document that
matches none of the templates in the stylesheet results in output that
looks identical to the output you would get by applying a trivial
stylesheet containing no template rules at all!

It's a little like how the output of

  $ sed '' somefile

is indistinguishable from

  $ cat somefile

> Maybe I do something wrong?

I lack fluency in make/Makefile, and I have not dug into the weeds of
that stylesheet at https://www.w3.org/2001/10/glance/doc/howto .

However, when you call xsltproc it looks to me like you not are
supplying any of the four parameters that the stylesheet html2rss.xsl
expects:

  <xsl:param name = "Base" />
  <xsl:param name = "Channel" />
  <xsl:param name = "xmlfile" />
  <xsl:param name = "xslfile" />
  <xsl:param name = "Page" />

You might supply them like so

  $ xsltproc -o Overview.rss
             --stringparam xmldata "$webpage" \
             --stringparam xlsfile html2rss.xsl \
             --stringparam Base "$(dirname "$webpage")" \
             --stringparam Page "$(dirname "$webpage")" \
             --stringparam Channel Overview.rss \
             html2rss.xsl \
             "$webpage"

> name = tree-house
>
> src = ${name}.html
>
> srcpp = ${name}-pp.html
>
> trans = html2rss.xsl
>
> dst = ${name}.rss
>
> opts = --html
>
> all: ${dst}
>
> ${srcpp}: ${src}
> 	sed -e 's/<\/*fig\(ure\|caption\)>//g' $< > $@
>
> ${dst}: ${srcpp}
> 	xsltproc -o $@ ${opts} ${trans} $<

-- 
Ce qui est important est rarement urgent
et ce qui est urgent est rarement important
-- Dwight David Eisenhower

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-09 12:00 +0200
  Re: generate a rss.xml from a bunch of HTML files davidson <davidson@freevolt.org> - 2021-05-09 23:20 +0200
    Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-10 02:00 +0200
    Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-10 16:20 +0200
      Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-10 17:20 +0200
        Re: generate a rss.xml from a bunch of HTML files davidson <davidson@freevolt.org> - 2021-05-13 00:10 +0200
    Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-11 00:40 +0200
      Re: generate a rss.xml from a bunch of HTML files David Wright <deblis@lionunicorn.co.uk> - 2021-05-11 02:30 +0200
        Re: generate a rss.xml from a bunch of HTML files The Wanderer <wanderer@fastmail.fm> - 2021-05-11 02:40 +0200
          Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-11 03:10 +0200
            Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-11 03:40 +0200
        Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-11 02:50 +0200
        Re: generate a rss.xml from a bunch of HTML files Andrei POPESCU <andreimpopescu@gmail.com> - 2021-05-11 08:10 +0200
          Re: generate a rss.xml from a bunch of HTML files David Wright <deblis@lionunicorn.co.uk> - 2021-05-11 17:20 +0200
            Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-12 03:20 +0200
              Re: generate a rss.xml from a bunch of HTML files The Wanderer <wanderer@fastmail.fm> - 2021-05-12 12:10 +0200
                Re: generate a rss.xml from a bunch of HTML files Greg Wooledge <greg@wooledge.org> - 2021-05-12 13:40 +0200
                Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-12 13:50 +0200
                Re: generate a rss.xml from a bunch of HTML files Curt <curty@free.fr> - 2021-05-12 19:10 +0200
              Re: generate a rss.xml from a bunch of HTML files Emanuel Berg <moasenwood@zoho.eu> - 2021-05-12 14:20 +0200
      Re: generate a rss.xml from a bunch of HTML files Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2021-05-11 14:20 +0200

csiph-web