Prev | Next |
XSL Transforms
Enterprise Architect provides facilities for modeling and executing XSL Transformations, which you use to convert input documents into xml or other types of document using XSL stylesheets. These facilities include:
- Custom editing of .xml and .xsl files
- XML document validation
- Stylesheet debugging
You can model a transformation using either file system files or model documents (Artifacts, where the file contents are stored in the model and can thus be shared by users of that model), on a custom XML Transform diagram. On this diagram you can create xml documents and stylesheets, link them to a transformation (Activity) and then execute or debug the transformation. The progress and success/failure of the transformation is shown on the 'XSLT' tab of the System Output window. If you want to capture and review the output, you can optionally direct it via your model to an output file.
Create the XML Transform Diagram
Step |
Action |
See also |
---|---|---|
1 |
In the Project Browser, right-click on the appropriate Package and select the 'Add Diagram' option. |
|
2 |
In the 'New Diagram' dialog, type an appropriate diagram name in the 'Name' field (if necessary) and click on 'Extended' in the 'Select From' list and 'XML Transform' in the 'Diagram Types' list. Click on the . The new diagram opens, with the Diagram Toolbox showing the 'XML Transformation' page. |
Add New Diagrams XML Transformation Toolbox |
Artifact Elements in the XML Transformation Toolbox
Artifact |
Description |
---|---|
XML Transform |
The model reference for the transformation, providing inputs and optional outputs. Used to run or debug the transformation. Inputs: XML File, XSLT Outputs: Output Artifact (Optional) |
XSLT |
Identifies the stylesheet to execute. Inputs: N/A Outputs: N/A |
XML File |
Identifies the input document to transform. Inputs: N/A Outputs: N/A |
XSD |
Identifies the schema that can be used, optionally, to automatically perform XML validation on the output document. Inputs: Output Artifact, XML File, (or optional both) Outputs: N/A |
Output Artifact |
Use this Artifact to define the output of an XSLT operation. The Artifact provides the file path to use when output is created by the transform. To select or name the output file, double-click on the Artifact to display its properties and enter the file path under the 'Files' tab. To make use of the Artifact, draw a trace connector to it from the transform element. |
Manually Validate documents
Using Enterprise Architect, you can perform XML validation both of documents to be transformed and of XSLT stylesheets.
To run the validation, right-click in the xml document or stylesheet in the XSL Debugger and select 'XML Validation'. A prompt displays to confirm if you are validating against a document type definition or an XML Schema.
- For a document type definition, simply click on the ; the validation proceeds
- For an XML schema, select the appropriate radio button to identify if the validation grammar is defined within the document or elsewhere; if elsewhere, enter the namespace and URL or file path for the grammar
If errors are found during a debugging run, they will be output to the Debugger window (press to display this window).
If errors are found during a normal validation run, they will be output to the 'XSL' tab of the System Output window (press if this window does not display automatically). To locate the error in the document, double-click on the error message.
XSLT Processor and Version
The XSL Processor used in these features is built from the Apache Xalan Project (C++ version 1.11)