tags:

views:

21

answers:

1

I am trying to work with this RSS feed.

I would like to use XSL to keep only the first paragraph of the description field. I have read up on how to target only certain children of an XML structure, but I think because the paragraph tags in the RSS feed are added as &lt and &gt they don't seem to work when doing something like this:

<xsl:value-of select="description/p[position() = 1]" disable-output-escaping="yes"/>

Ideally I would like to select only the text between the paragraph tags and discard them completely.

Any help would really be appreciated.

A: 

Use this transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
 <xsl:output omit-xml-declaration="yes"/>

 <xsl:template match="/*/channel/item/description">
  <xsl:value-of select=
  "substring-before(substring-after(., '&lt;P&gt;'), '&lt;/P&gt;')
  "/>
  <xsl:text>&#xA;</xsl:text>
 </xsl:template>
</xsl:stylesheet>
Dimitre Novatchev
Perfect! - Thanks Dimitre. I hadn't considering doubling up substring function like that.
Matt Bunce