Transform XML Files
CFS can transform XML files before attempting to parse them. XSL transformations are configured in the [XmlTransformation]
section of the CFS configuration file.
To run a single transformation, you can specify the settings in the [XmlTransformation]
section:
[XmlTransformation] ValidationSchema=schema.xsd TransformationStylesheet=transform.xslt
In this example, CFS uses the stylesheet transform.xslt
to transform any XML file that matches schema.xsd
.
If you are processing XML files that have more than one schema, you might want to configure several transformations. To do this, use the Sections
parameter to specify the names of sections that configure the transformations:
[XmlTransformation] Sections=XmlTransform1,XmlTransform2 [XmlTransform1] ValidationSchema=schema1.xsd TransformationStylesheet=transform1.xslt [XmlTransform2] TransformationStylesheet=transform2.xslt
In this example, any XML file that matches schema1.xsd
is transformed by transform1.xslt
. These files are then parsed. The parameter ValidationSchema
is not set in the section XmlTransform2
, so any files that do not match schema1.xsd
are transformed by transform2.xslt
.
You can configure as many different transformations as you require. If you set the parameter ValidationSchema
in every section and an XML file does not match any of the schemas, it is not transformed.