Reply to Re: syndicate fragments of RSS feed?

Your name:

Reply:


Posted by Jared Zimmerman on 09/08/06 07:12

Thanks, i don't know the first thing about XML where does this go and
what do i need to change in it to put it in play?


Andy Dingley wrote:
> Jared Zimmerman wrote:
>
> > Thanks, i don't mind learning, i was just hoping that it was a little
> > more simple, oh well
>
> Try this as a crude XSLT starter
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>
>
> <xsl:output method="html"
> omit-xml-declaration = "yes"
> standalone = "yes"
> doctype-public = "-//W3C//DTD HTML 4.01 Strict//EN"
> doctype-system = "http://www.w3.org/TR/html4/strict.dtd"
> cdata-section-elements = "script"
> indent = "yes"
> media-type = "text/html" />
>
>
>
> <xsl:template name="embedded-br-to-text" >
> <xsl:param name="input" select="/.." />
>
> <xsl:variable name="cdr" select="substring-after ($input,
> '&lt;br&gt;')" />
>
> <xsl:choose>
> <xsl:when test="$cdr" >
> <xsl:value-of select="substring-before ($input, '&lt;br&gt;')"
> />
> <xsl:text>
> </xsl:text>
> <xsl:call-template name="embedded-br-to-text" >
> <xsl:with-param name="input" ><xsl:value-of select="$cdr"
> /></xsl:with-param>
> </xsl:call-template>
> </xsl:when>
>
> <xsl:otherwise><xsl:value-of select="$input" /></xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
>
>
> <xsl:template name="one-item" >
> <xsl:param name="rss-item" select="/.." />
>
> <pre><xsl:value-of select="title" />
> <xsl:text> </xsl:text>
> <xsl:value-of select="pubDate" />
> <xsl:text>
> </xsl:text>
> <xsl:call-template name="embedded-br-to-text" >
> <xsl:with-param name="input" ><xsl:value-of
> select="substring-after(substring-after(string(description),
> '&lt;/a&gt;'), '&lt;/a&gt;')" /></xsl:with-param>
> </xsl:call-template></pre>
> </xsl:template>
>
>
> <xsl:template match="/">
> <html><title>Dodgeball</title><body>
>
> <xsl:for-each select="//item" >
> <xsl:sort select="pubDate" />
>
> <xsl:if test="position() = 1" >
> <xsl:call-template name="one-item" >
> <xsl:with-param name="rss-item" select="." />
> </xsl:call-template>
> </xsl:if>
> </xsl:for-each>
>
> </body></html>
> </xsl:template>
>
>
>
> </xsl:stylesheet>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация