Please could you add this to MoinMoinQuestions -- ReimarBauer 2005-12-29 03:42:39
I'm struggling to understand what this XSLT does - can anyone elaborate?
Thanks! -- JackBates 2005-12-29 03:25:24
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="/PrettyPrintXslt" type="text/xml"?>
<xsl:stylesheet version="1.0"
xmlns="http://purl.org/rss/1.0/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<xsl:output method="html" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/rdf-channel">
<!-- xsl:copy-of select="document(@url)/rdf:RDF"/ --> <xsl:apply-templates select="document(@url)/rdf:RDF">
<xsl:with-param name="url" select="@url"/> <xsl:with-param name="page" select="@page"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="/rss-channel">
<xsl:apply-templates select="document(@url)/rss/channel">
<xsl:with-param name="url" select="@url"/> <xsl:with-param name="page" select="@page"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="rdf:RDF">
<xsl:param name="url"/> <xsl:param name="page"/> <b>This is the
<a target="_{$page}" href="{$url}"><xsl:value-of select="channel/title"/></a> RDF channel. Click <a href="{$page}?action=refresh&arena=xslt&key={$page}">here</a> to load the current data.</b>
<br/><br/>
<h2><xsl:value-of select="channel/title"/></h2> <xsl:apply-templates select="image"/> <p><xsl:value-of select="channel/description"/></p> <dl><xsl:apply-templates select="item"/></dl>
</xsl:template>
<xsl:template match="rss/channel">
<xsl:param name="url"/> <xsl:param name="page"/> <b>This is the
<a target="_{$page}" href="{$url}"><xsl:value-of select="title"/></a> RSS channel. Click <a href="{$page}?action=refresh&arena=xslt&key={$page}">here</a> to load the current data.</b>
<br/><br/>
<h2><xsl:value-of select="title"/></h2> <xsl:apply-templates select="image"/> <p><xsl:value-of select="copyright"/></p> <dl><xsl:apply-templates select="item"/></dl>
</xsl:template>
<xsl:template match="image">
<a target="_{$page}" href="{link}"><img align="right" alt="{title}" src="{url}">
<xsl:if test="width">
<xsl:attribute name="width"><xsl:value-of select="width"/></xsl:attribute>
</xsl:if> <xsl:if test="height">
<xsl:attribute name="height"><xsl:value-of select="height"/></xsl:attribute>
</xsl:if>
</img></a>
</xsl:template>
<xsl:template match="item">
<dt><a target="_{$page}" href="{link}"><xsl:value-of select="title"/></a></dt> <dd><xsl:value-of select="description"/></dd>
</xsl:template>
</xsl:stylesheet>