Data Factory > file-transformation-xslt β
TL;DR;
This task transforms XML files using the XSLT transformation language.
Name:
Max execution time: 120 mins
Examples: Product-Live/data-factory-job-collection
TIP
XSLT, defined within the W3C XSL recommendation, is a functional type XML transformation language. In particular, it allows you to transform an XML document into another format, such as PDF or HTML, to be displayed as a web page.
Target β
Transform one or more files via an XLST style sheet.
Example of use in a job β
- Transform a taxonomy in the client's format to our format
1. FTP Get Get the last file that ends with -table.xml
2. XSLT Transform to Product-Live Format
3. Import Table Import table1
2
3
2
3
Inputs and Outputs β
Example of using FILE mode
json
{
"name": "file-validation-xsd",
"taskReferenceName": "b",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"mode": "FILE",
"file": "${a.output.file}",
"xsd": "file://assets/file.xsd",
"xsdVersion": "1.0",
"failOnError": true
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
Example of using params parameters
json
{
"name": "file-transformation-xslt",
"taskReferenceName": "transform_xslt",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"mode": "FILE",
"file": "${previous_taskReferenceName.output.file}",
"xslt": "file://assets/transform.xslt",
"params": [
{
"name": "color",
"select": "red"
},
{
"name": "settings",
"select": "file://assets/settings.xml"
},
{
"name": "items",
"select": "${previous_taskReferenceName.output.file}"
},
{
"name": "language",
"select": "${workflow.input.language}"
}
],
"fileName": "result.xml"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Inputs β
| Property | Description |
|---|---|
mode | Mandatory β Enum - FILE, FILES, REQUESTFILE: The file input is usedFILES we apply the transformation on each of the files present in the property filesREQUEST we apply the transformation on each of the files described in the file request |
output | Only took into account if mode = FILE - Enum - FILE, STRINGIndicates the type of output to generate. FILE: The result of the transformation is a single fileSTRING: The result of the transformation is a string |
xslt | Mandatory β File The xslt file to apply |
file | Required if mode = FILE - FileThe file to transform |
files | Mandatory if mode = FILES - Array of FileFiles to transform |
request | Mandatory if mode = REQUEST - FileReferences the list of files to transform (see more details below) |
fileName | Required - String The name of the file(s) to generate. In the case of the FILES mode, the files are named as follows: [file name]-1[.extension] , [file name]-2[.extension], ... |
params | Object (see below) The parameters to pass to the XSLT during its execution |
params[].name | Required - String The name of the parameter |
params[].select | Mandatory - String or File In the case of a character string, it must be encapsulated by quotation marks ( ') (For more information)A file can also be passed as a parameter, in this case just use the reference to a file included in the job definition file://assets/file.xml, or the reference to the result of a previous task ${workflow.input.input_key}. |
Outputs β
| Property | Description |
|---|---|
allFilesTransformed | Enum - YES, NOIf all files could be transformed without error: YES else NO |
file | File If mode FILE and output != STRING: The result of the transformation of the file referenced in the entry fileIf mode FILES or REQUEST: The result of the first transformation mentioned in files or request |
files | Array of File present on all modes The result of the transformations in success. The order of the files is preserved (vs. the order of the files in files and request). |
listing | File An XML file that lists the generated documents (See more details below) |
result | String If mode = FILE and output = STRING: The result of the transformation of the file referenced in the entry file |
Input request document details β
xml
<Xslt>
<File>
<Url>https://app.product-live.com/files-data-factory/d05a74cf11788d8f3ae9bf0e0e028dde66f0c83005c5e0d1211b0069945c0c11</Url>
<File-Name>products-1.xml</File-Name>
</File>
<File>
<Url>https://app.product-live.com/files-data-factory/d05a74cf11788d8f3ae9bf0e0e028dde66f0c83005c5e0d1211b0069945c0c10/Url>
<File-Name>products-2.xml</File-Name>
</File>
</Xslt>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
| XPath | Description | Occurrence |
|---|---|---|
Xslt | Root | 1 |
File | For each file to transform | 0..* |
Url | The URL of the file, this can be a file from a previous job, a file included in the job definition or a public URL | 1 |
File-Name | The name of the output file. | 1 |
Output listing document details β
xml
<Files>
<File>
<Url>https://app.product-live.com/files-data-factory/d05a74cf11788d8f3ae9bf0e0e028dde66f0c83005c5e0d1211b0069945c0c11</Url>
<File-Name>products-1.xml</File-Name>
</File>
<File>
<Url>https://app.product-live.com/files-data-factory/fb26911d77fe9a9dc44b111eef5b5db7ca2019c8038445662f29b20c54cb6f29</Url>
<File-Name>products-2.csv</File-Name>
</File>
</Files>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
| XPath | Description | Occurrence |
|---|---|---|
Files | Root | 1 |
File | For each file | 0..* |
Url | File URL | 1 |
File-Name | The file name | 1 |
Functional limitations and recommendations β
| Item | Description | Limit | Recommendation |
|---|---|---|---|
| Number of files | 20 | ||
| Maximum size for a file | 600Mo |
Known Limitations β
- The maximum memory occupation authorized for a transformation is 8 GB. If a transformation does not run to completion in production, but does run on your workstation, your transformation is likely to exceed this limit.
- In addition, the maximum duration for a transformation task is 2 hours, regardless of the number of files to be processed.