Subject: Re: [xsl] RSS feeds and disable-output-escaping="yes" From: Alex Milowski <alexml@xxxxxxxxxxxx> Date: Tue, 10 May 2005 07:28:23 -0700 |
Greetings, I have set up a Drupal sub-site and would like the RSS feed from the site to be displayed as a 'whats new' panel on our main page.
Easy little XSL script I thought. The RSS feed has all the html in the
'description' tag escaped. I have used disable-output-escaping="yes" to
display the html, but I really need to be able to manipulate some of the
tags - the img tags in particular - I'd like to either remove or reduce
the width of the images (it is mostly user documentation for the
WebOPAC).
Is there any way I can do this or do I need to pre-process the rss feed before I feed it into the XSL transformer thingy.
1. "unescape" the descriptions. 2. Transform the descriptions (via XSLT?). 3. Then transform the whole thing to HTML.
The 'subtree' step scopes the contains steps to occurrences of the 'description' element. For each of those, the text descendants will be parsed as XML and then have XSLT run on the resulting subtree. The XSLT in that step was inlined.
Now, many RSS feeds have incorrectly escaped content (e.g. & instead of &amp;). That means that the 'parse' step may fail. You can fix that by trapping the errors:
<p:trap> <p:parse> <p:on-error> <p:template> <xsl:copy-of select="/c:error-context/description"/> </p:template> </p:on-error> </p:trap>
<c:error-context> <c:error>...</c:error> ...original content... </c:error-context>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] RSS feeds and disable-out, Julian Reschke | Thread | Re: [xsl] RSS feeds and disable-out, David Carlisle |
Re: [xsl] Recognized Unicode charac, Geert Josten | Date | RE: [xsl] Multiple CDATA tags...aga, Aron Bock |
Month |