Skip to content

Slashdot Removing Extraneous HTML from Description

Marvin Frederickson edited this page Feb 24, 2014 · 4 revisions

http://rss.slashdot.org/Slashdot/slashdot

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:fn="http://concerto.functions" 
   exclude-result-prefixes="fn">
<xsl:output method="html"/>
  <xsl:template match="/">
    <xsl:apply-templates select="//item"/>
  </xsl:template>

  <xsl:template match="item">
    <content-item>
      <h1><xsl:value-of select="title"/></h1>
      <xsl:value-of disable-output-escaping="yes" 
         select="fn:replace(description, '&amp;lt;p&amp;gt;&amp;lt;div class=&quot;share_submission&quot;.+', '&lt;/description&gt;')"/>
    </content-item>
  </xsl:template>
</xsl:stylesheet>
Clone this wiki locally