RE: RE: [xsl] RSS 2.0 to RSS 1.0 XSLT problem in Luminis 3.3

Subject: RE: RE: [xsl] RSS 2.0 to RSS 1.0 XSLT problem in Luminis 3.3
From: "Huditsch, Roman \(LNG-VIE\)" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Thu, 13 Jul 2006 09:08:47 +0200
Hi Seth,

Thanks for the source files. I just managed to get a first shot of the
stylesheet done.
All elements in the "dc", "sy" and "admin" prefixed namespaces are
copied as they are.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns="http://purl.org/rss/1.0/";
xmlns:dc="http://purl.org/dc/elements/1.1/";
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/";
xmlns:admin="http://webns.net/mvcb/";>
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="rss">
		<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
			<xsl:apply-templates select="channel"/>
			<xsl:apply-templates select="channel/image"/>
			<xsl:apply-templates select="channel/item"/>
			<xsl:apply-templates
select="channel/textinput"/>
		</rdf:RDF>
	</xsl:template>
	<xsl:template match="channel">
		<channel rdf:about="{link}">
			<xsl:apply-templates select="title | description
| link"/>
			<xsl:copy-of select="dc:* | sy:* | admin:*"/>
			<xsl:apply-templates select="image"
mode="channel"/>
			<items>
				<rdf:Seq>
					<xsl:for-each select="item">
						<rdf:li>
							<xsl:attribute
name="rdf:resource">

<xsl:value-of select="link"/>
							</xsl:attribute>
						</rdf:li>
					</xsl:for-each>
				</rdf:Seq>
			</items>
			<textinput>
				<xsl:value-of select="textinput"/>
			</textinput>
		</channel>
	</xsl:template>
	<xsl:template match="channel/image">
		<image>
			<xsl:attribute name="rdf:about">
				<xsl:value-of select="url"/>
			</xsl:attribute>
			<xsl:apply-templates select="title"/>
			<xsl:apply-templates select="link"/>
			<url>
				<xsl:value-of select="image/url"/>
			</url>
		</image>
	</xsl:template>
	<xsl:template match="channel/image" mode="channel">
		<image rdf:resource="{image/url}"/>
	</xsl:template>
	<xsl:template match="channel/item">
		<item>
			<xsl:attribute name="rdf:about">
				<xsl:value-of select="link"/>
			</xsl:attribute>
			<xsl:apply-templates select="title"/>
			<xsl:apply-templates select="link"/>
			<xsl:apply-templates select="description"/>
			<xsl:copy-of select="dc:* | sy:* | admin:*"/>
		</item>
	</xsl:template>
	<xsl:template match="channel/textinput">
		<textinput>
			<xsl:attribute name="rdf:about">
				<xsl:value-of select="url"/>
			</xsl:attribute>
			<xsl:apply-templates select="title"/>
			<xsl:apply-templates select="description"/>
			<xsl:apply-templates select="name"/>
			<xsl:apply-templates select="link"/>
		</textinput>
	</xsl:template>
	<xsl:template match="title | description | link | name">
		<xsl:element name="{local-name()}"
namespace="http://purl.org/rss/1.0/";>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet>



Just try it out :)

best regards,
Roman

Current Thread