From 399cd35b2b53530d9a81d5b34ff689f6b2f80d87 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 28 May 2025 13:14:32 -0700 Subject: [PATCH] Don't return "undefined" when no XPath match --- plugins/template-function-xml/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/template-function-xml/src/index.ts b/plugins/template-function-xml/src/index.ts index fdb32b4a..ed87c3a8 100755 --- a/plugins/template-function-xml/src/index.ts +++ b/plugins/template-function-xml/src/index.ts @@ -14,8 +14,9 @@ export const plugin: PluginDefinition = { try { const doc = new DOMParser().parseFromString(String(args.values.input), 'text/xml'); let result = xpath.select(String(args.values.query), doc, false); + console.log("RESULT", result); if (Array.isArray(result)) { - return String(result.map(c => String(c.firstChild))[0]); + return String(result.map(c => String(c.firstChild))[0] ?? ''); } else if (result instanceof Node) { return String(result.firstChild); } else {