Project

rss_sliml

0.0
No commit activity in last 3 years
No release in over 3 years
Generates an RSS XML stylesheet using a kind of Slim template
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.9, >= 0.9.1
 Project Readme

Generating an RSS XML stylesheet using the RSS_sliml gem

require 'rss_sliml'

rsss = RssSliml.new 
rsss.to_xslt

Output:

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.1'>
  <xsl:output method='html' encoding='utf-8' indent='yes'/>
  <xsl:template match='/'>
    <html>
      <head>
        <title>
          <xsl:value-of select='/rss/channel/title'/>
        </title>
      </head>
      <xsl:apply-templates select='rss/channel'/>
    </html>
  </xsl:template>
  <xsl:template match='channel'>
    <body>
      <div>
        <xsl:apply-templates select='item'/>
      </div>
    </body>
  </xsl:template>
  <xsl:template match='item'>
    <div>
  <ul>
    <li>
      <a href='{link}'><xsl:value-of select="title"/></a>
      <div>
        <xsl:value-of select="description"/>
      </div>
    </li>
  </ul>
</div>
  </xsl:template>
</xsl:stylesheet>
puts rsss.to_sliml
div
  ul
    li
      a {href: '{link}'} $title
      div
        $description

Note: A Sliml template can optionally be passed into initialization.

Resources

rss_sliml rss sliml xslt