Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding processing instruction #140

Open
davidjamesstone opened this issue Feb 11, 2021 · 3 comments
Open

Adding processing instruction #140

davidjamesstone opened this issue Feb 11, 2021 · 3 comments

Comments

@davidjamesstone
Copy link

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

@paul-uz
Copy link

paul-uz commented Feb 18, 2021

Ths package leverages https://github.com/nashwaan/xml-js to generate the XML, so you'd need to start there.

@davidjamesstone
Copy link
Author

@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.

@slorber
Copy link

slorber commented Aug 24, 2023

Agree, this would be nice to have this ability.

We want to add xml-stylesheet our RSS feeds for Docusaurus (facebook/docusaurus#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: {}
};
CleanShot 2023-08-24 at 16 53 17@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants