feed
feed copied to clipboard
Adding processing instruction
I'd like to add a processing instruction to the xml, specifically a stylesheet:
<?xml-stylesheet type="text/xsl" href="./rss-style.xsl"?>
I've had a good look around the code but I can't a way of doing it - anyone have any ideas how to do this (other than post-process the string)
Many thanks
Ths package leverages https://github.com/nashwaan/xml-js to generate the XML, so you'd need to start there.
@paul-uz I believe https://github.com/nashwaan/xml-js already supports this via the "_instruction" key. This lib would need to expose that. I'm happy to issue a PR if I can work it out and it's something you think would be worth adding.
Agree, this would be nice to have this ability.
We want to add xml-stylesheet our RSS feeds for Docusaurus (https://github.com/facebook/docusaurus/issues/9197)
See also: https://darekkay.com/blog/rss-styling/
I tweaked this lib code and this seems to do the job:
var base = {
_declaration: { _attributes: { version: "1.0", encoding: "utf-8" } },
_instruction: { "xml-stylesheet": 'href="/rss.xsl" type="text/xsl"' },
rss: {}
};