XML - Transform
Declaration
<AMXMLTRANSFORM XSLTFILE="text" HTMLFILE="text" OVERWRITEFILE="YES/NO" SESSIONNAME="Text"><XSLTParameter Name="text" Value="text" /></AMXMLTRANSFORM>>
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.
Practical Usage
Often used to convert XML data into HTML documents for display as a web page.
Resource Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
File/Session |
|
|
|
|
Denotes where the XML data derives from. This is a visual mode parameter used only during design-time, therefore, contains no markup. The available options are:
|
Session |
Text |
Yes if Resource is set to Session |
XMLSession1 |
SESSIONNAME="myXMLSession" |
The name of an existing session in which to associate this activity with. As a safety measure, when a session is created, the XML file bound by that session is saved in memory and the original file is locked. Any modifications by subsequent XML steps are performed on a copy of the XML data saved to memory. Linking several activities to a single session eliminates redundancy. Additionally, a single task supports simultaneous execution of multiple sessions, improving overall efficiency. Use the XML - Save activity to output the in-memory representation of the XML session to a file or variable. To end the session, use the XML - End session activity. |
Create XML session from |
Text (options) |
Yes if Resource is set to File |
Existing File |
|
Specifies where the XML data should derive from to start the new session. The XML data will be saved into memory. Different parameters become active depending on which option is selected. The available options are:
|
File |
Text |
Yes if XML session derives from a new or existing file |
(Empty) |
FILE="c:\foldername\file.XML" |
The path and filename of the new or existing XML file. This parameter is active only if the Create XML session from parameter is set to Existing file or New file. |
Overwrite if file exists |
Yes/No |
Yes if XML session derives from a new file |
No |
OVERWRITEFILE="YES" |
If set to YES, specifies that if an XML file with the same name already exists at the specified location, it will be overwritten with the new file. If set to NO (default), the step fails if the file already exists. This parameter is active only if the Create XML session from parameter is set to New file. |
Root node name |
Text |
Yes if XML session derives from a new file |
(Empty) |
ROOTNODENAME="Automate" |
The root node name for new XML file. This parameter is active only if the Create XML session from parameter is set to New file. |
Root node value (optional) |
Text |
No |
(Empty) |
NEWVALUE="Value" |
The root node value for the new XML file. This parameter is active only if the Create XML session from parameter is set to New file. |
Default namespace prefix (optional) |
Text |
No |
(Empty) |
DEFAULTNSPREFIX="edi" |
The prefix of the default namespace for the new XML file. A namespace prefix is a text string assigned as an element name prefix to a namespace. When an element name is preceded by the prefix and a colon, then that element is in that assigned namespace. This parameter is active only if the Create XML session from parameter is set to New file. |
Default namespace URI (optional) |
Text |
No |
(Empty) |
DEFAULTNAMESPACE= "http://net.com/schema" |
The default namespace URI for the new XML file. An XML namespace is a collection of element type and attribute names that are uniquely identified by the name of the unique XML namespace of which they are a part. This parameter is active only if the Create XML session from parameter is set to New file. |
Text |
Text |
Yes if XML session derives from text |
(Empty) |
XMLTEXT="theText" |
The text that the XML data should originate from. This parameter is active only if the Start XML session from parameter is set to Text. |
Attribute Name |
Text |
No |
(Empty) |
Name="AttribName" |
The name portion of the attribute name value pair to insert. Use this parameter to insert attributes into the new node. To enter a new row of values select Click here to add new row... To delete an existing row, click the red "X". This parameter supports insertion of multiple attribute name value pairs. |
Attribute Value |
Text |
No |
(Empty) |
Value="AttribValue" |
The value portion of the attribute name value pair to insert. Use this parameter to insert attributes into the new node. To enter a new row of values select Click here to add new row... To delete an existing row, click the red "X". This parameter supports insertion of multiple attribute name value pairs. |
Transform Parameters
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. |
Enable document function |
Yes/No |
No |
No |
|
If set to YES, enables support for the XSLT document() function. Set to NO by default. |
Enable script |
Yes/No |
No |
No |
|
If set to YES, enables support for embedded script blocks. Set to NO by default. |
Parse DTD |
Yes/No |
No |
No |
|
If set to YES, DTD will be parsed. Within an XML document's <!DOCTYPE>, there can be aninternalsubset of the DTD, or an external DTD can be referenced. to fully comply with the XML 1.0 or 1.1 specification, DTD must be parsed. This parameter is set to NO by default. |
HTML File |
Text |
Yes |
(Empty) |
HTMLFILE="C:\Log\Output.html" |
The path and filename 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 an HTML file with a matching name already exists in the destination, it will be overwritten with the new file. If set to NO, the step will fail if the file already exists. |
XSLT Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
XSLT parameter name |
Text |
No |
(Empty) |
Name="Make" |
The XSLT parameter name to specify. To enter a new row of values select Click here to add new row... To delete an existing row, click the red "X". This parameter supports insertion of multiple XSLT name value pairs. NOTE: 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" />). |
XSLT parameter value |
Text |
No |
(Empty) |
Value="BMW" |
The XSLT parameter value to specify. To enter a new row of values select Click here to add new row... To delete an existing row, click the red "X". This parameter supports insertion of multiple XSLT name value pairs. NOTE: 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" />). |
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
Example
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description: This sample task demonstrates how transforms an XML file into HTML. It performs the following steps:
-
Starts an XML session
-
Transforms the XML file into HTML using an XSLT file.
-
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" />