<xsl:transform  version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
				exclude-result-prefixes="xsl xs">
	<xsl:output method="xml"/>
	<!-- WSS_LIST_RSS_FIELDS.xsl by David Walker - www.davidlwalker.com and www.sharepointpowertoys.com -->
	<xsl:template match="rss/channel">
		<items>
			<xsl:apply-templates select="item">
			</xsl:apply-templates >
		</items>
	</xsl:template>

	<xsl:template match="title">
		<xsl:value-of select="text()"/>
	</xsl:template>

	<xsl:template match="item">
		<item>
			<title>
				<xsl:value-of select ="title"/>
			</title>
			<link>
				<xsl:value-of select ="link"/>
			</link>
			<xsl:call-template name="recurse">
				<xsl:with-param name="parse-string">
					<xsl:value-of select ="description"/>
				</xsl:with-param>
			</xsl:call-template>

		</item>
	</xsl:template>

	<xsl:template name="recurse">
		<xsl:param name="parse-string"></xsl:param>
		<xsl:if test="not($parse-string='')">
				<xsl:choose>
					<xsl:when test="contains($parse-string, ':&lt;/b&gt; ')">
						<xsl:variable name="field">
							<xsl:value-of select="substring-after(substring-before($parse-string, ':&lt;/b&gt; '),'&lt;div&gt;&lt;b&gt;')"/>
						</xsl:variable>
						<xsl:variable name="fieldName">
							<xsl:value-of select="translate($field,' ','')"/>
						</xsl:variable>
						<xsl:element name="{$fieldName}">
							<xsl:call-template name="getWSSDescriptionField">
								<xsl:with-param name="description" select="description"/>
								<xsl:with-param name="fieldName" select="$field"/>
							</xsl:call-template>
						</xsl:element>
					</xsl:when>
					<xsl:otherwise>
						<!-- //Not Needed
						<field>
						<xsl:value-of select="$parse-string"/>
						</field>
						-->
					</xsl:otherwise>
				</xsl:choose>
			<xsl:call-template name="recurse">
				<xsl:with-param name="parse-string">
					<xsl:value-of select="substring-after($parse-string, ':&lt;/b&gt; ')"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

	<xsl:template name="getWSSDescriptionField">
		<xsl:param name="description"/>
		<xsl:param name="fieldName"/>

		<xsl:variable name="before" select="concat($fieldName,':&lt;/b&gt; ')" />
		<xsl:variable name="after" select ="'&lt;/div&gt;'" />
		<xsl:variable name="htmlFieldStart" select ="'&lt;div class=ExternalClass'" />

		<xsl:variable name = "leftRemoved" >
			<xsl:value-of select="substring-after($description,$before)"/>
		</xsl:variable>
		<xsl:variable name = "results">
			<xsl:value-of disable-output-escaping="yes" select = "substring-before($leftRemoved,$after)" />
		</xsl:variable>

		<!-- HTML fields have extra <div>-->
		<xsl:choose>
			<xsl:when test="starts-with($results, $htmlFieldStart)">
				<xsl:value-of select = "substring-after($results,'&gt;')" />
			</xsl:when >
			<xsl:otherwise>
				<xsl:value-of select ="$results"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:transform>

WSS_LIST_RSS_FIELDS.xsl

Last edited Jul 7, 2008 at 12:18 AM by davidlwalker, version 2

Comments

No comments yet.