diff --git a/src/Suin/RSSWriter/Feed.php b/src/Suin/RSSWriter/Feed.php
index e805049..649308d 100644
--- a/src/Suin/RSSWriter/Feed.php
+++ b/src/Suin/RSSWriter/Feed.php
@@ -13,6 +13,23 @@ class Feed implements FeedInterface
/** @var ChannelInterface[] */
protected $channels = [];
+ protected $feedStyles = [];
+
+ /**
+ * Add Style sheet
+ * @param string $style_url
+ * @param string $media (defaults to 'screen')
+ * @return $this
+ */
+ public function addStyle($style_url, $media = 'screen'){
+ if( !empty($style_url) ){
+ $this->feedStyles[] = [ $style_url, $media ];
+ }
+
+ return $this;
+ }
+
+
/**
* Add channel
* @param ChannelInterface $channel
@@ -30,15 +47,28 @@ public function addChannel(ChannelInterface $channel)
*/
public function render()
{
- $xml = new SimpleXMLElement('', LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
- foreach ($this->channels as $channel) {
+ $xml = new SimpleXMLElement("",
+ LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
+
+
+ foreach ($this->channels as $channel) {
$toDom = dom_import_simplexml($xml);
$fromDom = dom_import_simplexml($channel->asXML());
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
}
$dom = new DOMDocument('1.0', 'UTF-8');
+
+ if( count($this->feedStyles) > 0 ){
+ foreach( $this->feedStyles as $info ){
+ $url = $info[0];
+ $media = $info[1];
+ $xslt = $dom->createProcessingInstruction('xml-stylesheet', "type=\"text/css\" media=\"{$media}\" href=\"{$url}\" ");
+ $dom->appendChild($xslt);
+ }
+ }
+
$dom->appendChild($dom->importNode(dom_import_simplexml($xml), true));
$dom->formatOutput = true;
return $dom->saveXML();
diff --git a/src/Suin/RSSWriter/FeedInterface.php b/src/Suin/RSSWriter/FeedInterface.php
index afaf518..d5f69ca 100644
--- a/src/Suin/RSSWriter/FeedInterface.php
+++ b/src/Suin/RSSWriter/FeedInterface.php
@@ -11,10 +11,18 @@ interface FeedInterface
/**
* Add channel
* @param ChannelInterface $channel
- * @return $thisJ
+ * @return $this
*/
public function addChannel(ChannelInterface $channel);
+ /**
+ * Add Style sheet
+ * @param string $style_url
+ * @param string $media (defaults to 'screen')
+ * @return $this
+ */
+ public function addStyle($style_url, $media);
+
/**
* Render XML
* @return string