XSL Transform XML Files

From IronPython Cookbook

From Eddy Young.

This example transforms XML files with an XSL file.

It uses the XslCompiledTransform class, from the System.Xml.Xsl namespace in the System.Xml assembly.

import clr
clr.AddReference("System.Xml")
from System.Xml.Xsl import XslCompiledTransform
xsl = XslCompiledTransform()
xsl.Load("C:\Temp\transform.xsl")
xsl.Transform("C:\Temp\input.xml", "C:\Temp\output.xml")


Back to Contents.

TOOLBOX
LANGUAGES