Copy link to clipboard
Copied
I'm having trouble with an XSL Fragment on a page on my website. I am just trying to feed the most recent five entries from my blog to a page on the website and present them in descending order. The web page is at the following link:
http://localhost/sites/newclues/blog.asp
The asp code is as follows:
<%
var mm_xsl = new MM_XSLTransform();
mm_xsl.setXML("http://www.skilfulminds.com/feed/");
mm_xsl.setXSL("headlines.xsl");
Response.write (mm_xsl.Transform());
%>
The XML Tranform seemed to work correctly at first, except it didn't display in descending order. However, as I add to the blog the feed displayed is not updating either.
Can anyone offer insight into what I'm doing wrong.
The XSL Fragment code is below.
___________________________________________________________
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="http://www.skilfulminds.com/feed/" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<xsl:output method="html" encoding="utf-8"/>
<xsl:param name="ItemsPerPage" select="5" />
<xsl:template match="/">
<xsl:for-each select="rss/channel/item[position() <= $ItemsPerPage]">
<xsl:sort select="pubDate" order="descending" />
<p><a href="{link}" target="_blank"><xsl:value-of select="title"/></a><br />
by
<xsl:value-of select="dc:creator"/></p>
<p><em>Description</em></p>
<p><xsl:value-of select="description" disable-output-escaping="yes"/> </p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks in advance,
Larry Irons
Copy link to clipboard
Copied
I haven't used XSL Transformations with ASP, but the following XSLT Fragment should do what you want:
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="http://www.skilfulminds.com/feed/" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="/">
<xsl:for-each select="rss/channel/item">
<xsl:if test="position() <= 5">
<p><a href="{rss/channel/item/link}"><xsl:value-of select="title"/></a> by <xsl:value-of select="dc:creator"/></p>
<p><strong>Description:</strong> <xsl:value-of select="description" disable-output-escaping="yes"/></p>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>