I have an XML file:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='file:///C:/Program%20Files/Application/log_format.xsl'?>
<!DOCTYPE log [<!ENTITY data SYSTEM 'data/20130408.dat'>]>
<log xmlns="runtime:log">&data;</log>
The xsl file transforms it into HTML. I can't open the file in IE just fine and view the expected results. I would like to via a PowerShell script convert this in plain HTML. How would I go about that?
This blog entry has a code snippet that should work. It uses the System.Xml.Xsl.XslCompiledTransform
.NET class to do the XSL transformation. The rest is just for getting the input and displaying the output.
This was originally a comment, but I guess I'll make it an answer so it's easier for other people who are searching for a solution.
The PowerShell Community Extensions has a Convert-Xml
that will do an XSL transform on the XML. If the resulting file isn't valid HTML then you need to work on the XSL file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With