Hello I would like to replace an a href link that is provided in the RSS below with my own link. The link that I am looking to replace is defined in the <description> tag within the RSS. Im guessing I need to use some sort of function in combination with regex.
I am able to create a regex to find and replace the a href link very easily; however, using regex in combination with a find and replace in XSL i am extremly novice.
I am wanting to replace the <description> a href:
With this a href:
XML snippet:
My XSL snippet:
Please any help would be great!
I am able to create a regex to find and replace the a href link very easily; however, using regex in combination with a find and replace in XSL i am extremly novice.
I am wanting to replace the <description> a href:
Code:
a href='http://www.kyte.tv/ch/39174-flocam/185592-live-mobile-show'
Code:
a href='javascript:void(kyteplayer.setURI('{$URIVal}'))'
Code:
<item> <title>New Show: Live Mobile Show</title> <link>http://www.kyte.tv/ch/39174-flocam/185592-live-mobile-show</link> <guid>http://www.kyte.tv/ch/39174-flocam/185592-live-mobile-show</guid> <description><a href='http://www.kyte.tv/ch/39174-flocam/185592-live-mobile-show'><img src='http://media08.kyte.tv/store/005/08/crr/0808/02/23/689407-0-47639mobile_689407_120_90-tom-5000.jpg?aid=21808&h=44fade2ef70a4df7e890f5f77c87f5d9' title='Live Mobile Show' width='120' height='90' alt='Live Mobile Show' border='0'/></a><br>produced by tenofquad.</description> <pubDate>Sat, 02 Aug 2008 23:18:20 +0000</pubDate> <media:content url="http://www.kyte.tv/flash.swf?appKey=MarbachViewerEmbedded&uri=channels/39174/185592&layoutMode=default" fileSize="30" type="application/x-shockwave-flash" height="425" width="425" duration="1"/> <enclosure url="http://www.kyte.tv/flash.swf?appKey=MarbachViewerEmbedded&uri=channels/39174/185592&layoutMode=default" length="30" type="application/x-shockwave-flash"/> </item>
Code:
<xsl:template match="item">
<xsl:variable name="item_link" select="link"/>
<xsl:variable name="item_enclosure" select="enclosure/@url"/>
<xsl:variable name="item_title" select="description"/>
<xsl:variable name="item_media" select="media"/>
<xsl:variable name="afterURI">
<xsl:value-of select = "substring-after($item_enclosure, '&uri=')" />
</xsl:variable>
<xsl:variable name="URIVal">
<xsl:choose>
<xsl:when test="contains($afterURI, '&')">
<xsl:value-of select="substring-before($afterURI, '&')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$afterURI"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div class="subHead" style="width:500px;">
<a href="javascript:void(kyteplayer.setURI('{$URIVal}'))"><xsl:value-of select="title" disable-output-escaping="yes"/></a></div>
<div style="width:500px;">
<xsl:value-of select="description" disable-output-escaping="yes"/><br/></div>
(<xsl:value-of select="pubDate"/>)<br/> <hr/>
</xsl:template>
Comment