Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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 the Packt website. Once you've downloaded the files, 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 XSL file (rss_style.xsl).

How to do it...

These are the steps required for styling an RSS feed:

  1. Open PowerShell ISE as an administrator.

  2. Add the following script and run it:

    #replace these with the paths of the files in your system
    Set-Alias ie "$env:programfiles\Internet"
    
    #remove $rss variable if it already exists
    if ($rss)
    {
       Remove-Variable -Name "rss"
    }
    
    #replace these with the paths of the files in your system
    $xsl = "C:\DATA\RSS\rss_style.xsl"
    $rss = "C:\DATA\RSS\sample_rss.xml"
    $styled_rss = "C:\DATA\RSS\sample_result.html"
    
    $xslt = New-Object System.Xml.Xsl.XslCompiledTransform...