Need Runway Feed Viewer xslt code but not the whole runway project.
I was wondering if there was a way to install just the feed viewer xslt rather than the whole project. Or if there is a place where I can grab the code for the feed viewer.
<xsl:variablename="feed"select="/macro/feedUrl"/> <!-- cache for 30 minutes (1.800 seconds) --> <xsl:variablename="cacheRate"select="number(1800)"/>
<xsl:templatematch="/">
<!-- start writing XSLT --> <xsl:choose> <xsl:whentest="$feed != ''"> <xsl:variablename="feedContent"select="umbraco.library:GetXmlDocumentByUrl($feed, number($cacheRate))"/> <xsl:choose> <xsl:whentest="$feedContent != 'error'"> <xsl:call-templatename="renderFeed"> <xsl:with-paramname="feedContent"select="$feedContent"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <p> <strong>Feed Viewer Macro Error: Error fetching feed</strong><br/> The feed '<xsl:value-ofselect="$feed"/>' could not be loaded. Verify that the feed url exists and that you have an active internet connection </p> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <p> <strong>Feed Viewer Macro Error: No feed chosen</strong><br/> Please make sure to add a value in the "Feed Url" parameter </p> </xsl:otherwise> </xsl:choose> </xsl:template>
<!-- start writing XSLT --> <xsl:choose> <xsl:when test="$feed != ''"> <xsl:variable name="feedContent" select="umbraco.library:GetXmlDocumentByUrl($feed)"/> <xsl:choose> <xsl:when test="$feedContent != 'error'"> <xsl:call-template name="renderFeed"> <xsl:with-param name="feedContent" select="$feedContent"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <p> <strong>Feed Viewer Macro Error: Error fetching feed</strong><br /> The feed '<xsl:value-of select="$feed"/>' could not be loaded. Verify that the feed url exists and that you have an active internet connection </p> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <p> <strong>Feed Viewer Macro Error: No feed chosen</strong><br /> Please make sure to add a value in the "Feed Url" parameter </p> </xsl:otherwise> </xsl:choose> </xsl:template>
Need Runway Feed Viewer xslt code but not the whole runway project.
I was wondering if there was a way to install just the feed viewer xslt rather than the whole project. Or if there is a place where I can grab the code for the feed viewer.
Never Mind I Found The Code. But here it is just in case someone else needs it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="numberOfItems">
<xsl:choose>
<xsl:when test="/macro/numberOfItems != ''">
<xsl:value-of select="/macro/numberOfItems"/>
</xsl:when>
<xsl:otherwise>10</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="excerptLength">
<xsl:choose>
<xsl:when test="string(/macro/excerptLength) != ''">
<xsl:value-of select="/macro/excerptLength"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="feed" select="/macro/feedUrl"/>
<!-- cache for 30 minutes (1.800 seconds) -->
<xsl:variable name="cacheRate" select="number(1800)"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:choose>
<xsl:when test="$feed != ''">
<xsl:variable name="feedContent" select="umbraco.library:GetXmlDocumentByUrl($feed, number($cacheRate))"/>
<xsl:choose>
<xsl:when test="$feedContent != 'error'">
<xsl:call-template name="renderFeed">
<xsl:with-param name="feedContent" select="$feedContent"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<p>
<strong>Feed Viewer Macro Error: Error fetching feed</strong><br />
The feed '<xsl:value-of select="$feed"/>' could not be loaded. Verify that the feed url exists and that you have an
active internet connection
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<p>
<strong>Feed Viewer Macro Error: No feed chosen</strong><br />
Please make sure to add a value in the "Feed Url" parameter
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="renderFeed">
<xsl:param name="feedContent"/>
<xsl:if test="count($feedContent//item) > 0">
<ul class="feedList">
<xsl:for-each select="$feedContent//item">
<xsl:if test="position() <= $numberOfItems">
<li>
<small><xsl:value-of select="umbraco.library:LongDate(pubDate)"/></small>
<h4>
<a href="{link}">
<xsl:value-of select="substring(title, 10)" disable-output-escaping="yes"/>
</a>
</h4>
<xsl:choose>
<xsl:when test="string($excerptLength) != '0'">
<p>
<xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(description), number($excerptLength), '...')" disable-output-escaping="yes"/>
</p>
</xsl:when>
<xsl:otherwise>
<!-- <xsl:value-of select="description" disable-output-escaping="yes"/> -->
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:if>
</xsl:for-each>
<li class="last"><xsl:text disable-output-escaping="yes">&</xsl:text>nbsp;</li>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi i need some help, and question
instead of using parameters in xsl
i would like to use document properties to select rss feed
so i can change it easily threw the content section.
I hope this is possible
Greets
David
1. Select the node by node type or by nodeid
http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid-(1)
2. Get the property you want to use
You can also pass parameters to a macro:
http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters
It might be worth your while digging through the Wiki as there is a lot of useful info on there.
Hope this helps.
not exactly what i mean i guess
this is my xslt
i changed number of items and feed url, so it would grab content out of document property, but it doesn't work.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="numberOfItems">
<xsl:choose>
<xsl:when test="data [@alias = 'numberOfItems']">
<xsl:value-of select="data [@alias = 'numberOfItems']" />
</xsl:when>
<xsl:otherwise>10</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="feed" select="data [@alias = 'url']"/>
<!-- cache for 30 minutes (1.800 seconds) -->
<xsl:variable name="cacheRate" select="number(1800)"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:choose>
<xsl:when test="$feed != ''">
<xsl:variable name="feedContent" select="umbraco.library:GetXmlDocumentByUrl($feed)"/>
<xsl:choose>
<xsl:when test="$feedContent != 'error'">
<xsl:call-template name="renderFeed">
<xsl:with-param name="feedContent" select="$feedContent"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<p>
<strong>Feed Viewer Macro Error: Error fetching feed</strong><br />
The feed '<xsl:value-of select="$feed"/>' could not be loaded. Verify that the feed url exists and that you have an
active internet connection
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<p>
<strong>Feed Viewer Macro Error: No feed chosen</strong><br />
Please make sure to add a value in the "Feed Url" parameter
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="renderFeed">
<xsl:param name="feedContent"/>
<xsl:if test="count($feedContent//item) > 0">
<ul class="feedList">
<xsl:for-each select="$feedContent//item">
<xsl:if test="position() <= $numberOfItems">
<li>
<a href="{link}"><xsl:value-of select="title"/></a><br></br>
<small><xsl:value-of select="umbraco.library:LongDate(pubDate)"/></small>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
is working on a reply...