Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/quality-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
52 changes: 52 additions & 0 deletions xslt-conversion/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export function getDescription() {
return {
description: "Xslt Transformation",
input: [
{
id: "template",
displayName: "XSLT Template",
description: "Path to the XSLT template file.",
type: "InputResource",
required: true,
},
{
id: "xml",
displayName: "XML File",
description: "Path to the XML file.",
type: "InputResource",
required: true,
},
{
id: "result",
displayName: "Result File",
description: "Path to the result file.",
type: "OutputResource",
required: true,
},
],
output: [],
} as const satisfies ScriptDescription;
}

export async function execute(context: Context): Promise<Output> {
const templatePath = context.parameters.template as string;
const xmlPath = context.parameters.xml as string;
const resultPath = context.parameters.result as string;

console.log(`Reading XSLT template from: ${templatePath}`);
const templateFile = context.getFile(templatePath);
const templateContent = await templateFile.read();

console.log(`Reading XML file from: ${xmlPath}`);
const xmlFile = context.getFile(xmlPath);
const xmlContent = await xmlFile.read();

console.log("Applying XSLT transformation.");
const transformedContent = runtime.xmlUtils.applyTemplate(xmlContent, templateContent);

console.log(`Writing result to: ${resultPath}`);
const resultFile = context.getFile(resultPath);
await resultFile.write(transformedContent);

console.log("Transformation completed successfully.");
}
8 changes: 8 additions & 0 deletions xslt-conversion/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "xslt-conversion",
"displayName": "XSLT conversion",
"description": "Converts a XSLT template and an XML file into a single file.",
"fromVersion": "24.10.1.1",
"toVersion": null,
"private": true
}