Transform XML

Transforms an XML file into HTML using an XSLT (Extensible Stylesheet Language Transformation) file. You can also provide the XSLT parameter which will be replaced by its value dynamically. XSLT is an XML-based language used for the transformation of XML documents into other XML documents. The original document is not changed; rather, a new document is created based on the content of an existing one. The new document can be output to HTML or plain text. Often used to convert XML data into HTML documents for display as a web page.

AWE's XML actions require a basic understanding of XML and related terms, such as XPath, DTD and XSLT.

Declaration

<AMXMLTRANSFORM XSLTFILE="text" HTMLFILE="text" OVERWRITEFILE="YES/NO" SESSIONNAME="Text"><XSLTParameter Name="text" Value="text" /></AMXMLTRANSFORM>>

Example

This example demonstrates how AWE transforms an XML file into HTML. It performs the following steps:

  1. Starts an XML session

  2. Transforms the XML file into HTML using an XSLT file.

  3. Ends the XML session.

<AMXMLSTARTSESSION XMLDOCUMENTFROM="ExistingFile" FILE="C:\Tutorials\XML Data\XSLT Files\order.xml" SESSIONNAME="One" />

<AMXMLTRANSFORM XSLTFILE="C:\Tutorials\XML Data\XSLT Files\order.xsl" HTMLFILE="C:\Tutorials\XML Data\XSLT Files\Order.html" OVERWRITEFILE="YES" SESSIONNAME="One"><XSLTParameter Name="discount" Value="10th May 2008" /></AMXMLTRANSFORM>

<AMXMLENDSESSION SESSIONNAME="One" />

See Also: Create XML Node, Delete XML Node, End XML Session, Evaluate Xpath Expression, Extract XML Fragment, Merge XML Files, Output XML, Read XML Node, Sign XML Document, Validate XML File, Verify XML Document, XML Node to Dataset

General Tab

Property

Type

Required

Default

Markup

Description

XSLT File

Text

Yes

(Empty)

XSLTFILE="C:\Log\Auto.xsl"

The path and file name of XSLT file that resides on the local system which will be used to transform the specified XML file.

HTML File

Text

Yes

(Empty)

HTMLFILE="C:\Log\Output.html"

The path and file name on the local system in which to output the HTML file. If the file does not exist, it will be created at runtime.

Overwrite if File Exists

Yes/No

No

No

OVERWRITEFILE="YES"

If set to YES, specifies that if the HTML file already exists, it will be overwritten with the new file. If set to NO, the step will fail if the file already exists.

Session Name

Text

No

(Empty)

SESSIONNAME="FirstXMLSession"

The session name created by a previous Start XML Session step that this action should identify with. This allows several in-memory XML documents to be active simultaneously within the same task.

XSLT Parameter Tab

(Optional) If the XSLT file has parameters that can be dynamically replaced in the HTML file during transformation, you can specify them using these properties. This also adds a new node parameter into the AML code. (Example: <Parameter Name="Make" Value="BMW" />).

Property

Type

Required

Default

Markup

Description

Parameter Name

Text

No

(Empty)

Name="Make"

The path and file name of XSLT file that resides on the local system which will be used to transform the specified XML file.

Use the following buttons in visual mode if needed:

  • Move Up - Move the parameter name/value up one line.

  • Move Down - Move the parameter name/value down one line.

  • Add - Add a parameter name/value to the list.

  • Remove - Remove an existing parameter name/value from the list.

Parameter Value

Text

No

(Empty)

Value="BMW"

The path and file name on the local system in which to output the HTML file. If the file does not exist, it will be created at runtime.

Use the following buttons in visual mode if needed:

  • Move Up - Move the parameter name/value up one line.

  • Move Down - Move the parameter name/value down one line.

  • Add - Add a parameter name/value to the list.

  • Remove - Remove an existing parameter name/value from the list.