Subject: Re: [xsl] XSL Transformation Question From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 20 Feb 2004 19:30:00 +0000 |
Hi Eric, > I have a rss feed I am trying to transform, but it will not read the > img and a tags from within the description of each item. The rss > feed can be found at http://www.cssvault.com/gallery.xml. What a strange RSS feed. It uses a mix of the classic (and bad) design wherein the HTML content of the <description> element is nested within a CDATA section (effectively escaping the HTML tags), and unescaped <a> and <img> elements. Weird. Anyway, the problem is that in the template for <item> elements, you're using the wrong path when trying to select the <img> and <a> elements: the <img> and <a> elements are within the <description> element, so you need to step through the <description> element to reach them. Try: <xsl:template match="item"> <li> <div class="itemTitle"> <a href="{link}" title="{title}"> <xsl:value-of select="title" /> </a> </div> <div class="itemDescription"> <xsl:apply-templates select="description/img" /> <xsl:apply-templates select="description/a" /> <xsl:value-of select="description" /> </div> </li> </xsl:template> By the way, you'll need to change the paths that you use within the templates for the <img> and <a> elements as well -- you want to point to the src and href *attributes*, not child elements, so you need "@src" and "@href" rather than "src" and "href". Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL Transformation Question, Eric Fleming | Thread | RE: [xsl] XSL Transformation Questi, Eric Fleming |
Re: [xsl] empty fo-block in table c, David Tolpin | Date | Re: [xsl] Request for design tips: , Wendell Piez |
Month |