XML - Transform

Declaration

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

See Also

XML - Create Node | XML - Create Session | XML - Dataset to XML | XML - Delete Node | XML - Edit Node | XML - End Session | XML - Evaluate Xpath | XML - Export | XML - Import | XML - Node to Dataset | XML - Read Node | XML - Save | XML - Sign | XML - Validate | XML - Verify

Transform XML

Declaration

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

See Also

XML - Create Node | XML - Create Session | XML - Dataset to XML | XML - Delete Node | XML - Edit Node | XML - End Session | XML - Evaluate Xpath | XML - Export | XML - Import | XML - Node to Dataset | XML - Read Node | XML - Save | XML - Sign | XML - Validate | XML - Verify

Description

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.

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

Practical Usage

Often used to convert XML data into HTML documents for display as a web page.

Parameters

General Properties

Property

Type

Req'd

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

Req'd

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.

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: This sample task demonstrates how AutoMate 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" />

 

↑ Top of Page