Applying XSL to an RSS feed
In this recipe, we will create a styled HTML file based on an existing RSS feed and XSL (stylesheet).
Getting ready
The files needed for this recipe are included in the downloadable book scripts from Packt. Once downloaded, copy the XML Files\RSS
folder to your local C:\
directory. This folder will have two files: one sample RSS feed (sample_rss.xml
) and one sample XSL file (rss_style.xsl
).
How to do it...
These are the steps for styling an RSS feed:
Open the PowerShell console application by going to Start | Accessories | Windows PowerShell | Windows PowerShell ISE.
Add the following script and run:
$xsl = "C:\XML Files\RSS\rss_style.xsl" $rss = "C:\XML Files\RSS\sample_rss.xml" $styled_rss = "C:\XML Files\RSS\sample_result.html" $xslt = New-Object System.Xml.Xsl.XslCompiledTransform $xslt.Load($xsl) $xslt.Transform($rss, $styled_rss) #load the resulting styled html #in Internet Explorer Set-Alias ie "$env:programfiles\Internet Explorer\iexplore.exe" ie $styled_rss...