共用方式為


XslTransformation task

Transforms an XML input by using an XSLT or compiled XSLT and outputs to an output device or a file.

Parameters

The following table describes the parameters of the XslTransformation task.

Parameter Description
OutputPaths Required ITaskItem[] parameter.

Specifies the output files for the XML transformation.
Parameters Optional String parameter.

Specifies the parameters to the XSLT Input document. Provide the raw XML that holds each parameter as <Parameter Name="" Value="" Namespace="" />.
XmlContent Optional String parameter.

Specifies the XML input as a string.
XmlInputPaths Optional ITaskItem[] parameter.

Specifies the XML input files.
XslCompiledDllPath Optional ITaskItem parameter.

Specifies the compiled XSLT.
XslContent Optional String parameter.

Specifies the XSLT input as a string.
XslInputPath Optional ITaskItem parameter.

Specifies the XSLT input file.

Remarks

In addition to having the parameters that are listed in the table, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension base class.

Example

In the following example, an XSL transform file transform.xslt is used to modify the xml file $(XmlInputFileName). The transformed XML is written to $(IntermediateOutputPath)output.xml. The XSL transform takes $(Parameter1) as an input parameter.

    <XslTransformation XslInputPath="transform.xslt"
                       XmlInputPaths="$(XmlInputFileName)"
                       OutputPaths="$(IntermediateOutputPath)output.xml"
                       Parameters="&lt;Parameter Name='Parameter1' Value='$(Parameter1)'/&gt;"/>

See also