mirror of
https://github.com/alexandrev/xslt-lab.git
synced 2026-09-13 08:43:16 +00:00
Support xsl:initial-template when no source XML is provided; drop "only" from copy
- Backend no longer defaults to <root/> as source document; when no XML parameter is detected, source is empty and setInitialContextNode is skipped, allowing Saxon to invoke xsl:initial-template automatically - Remove "The only free online XSLT" wording from meta descriptions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,7 +84,7 @@ public class SaxonDaemon {
|
||||
JsonObject req = GSON.fromJson(body, JsonObject.class);
|
||||
|
||||
String xslt = req.has("xslt") ? req.get("xslt").getAsString() : "";
|
||||
String source = req.has("source") ? req.get("source").getAsString() : "<root/>";
|
||||
String source = req.has("source") ? req.get("source").getAsString() : "";
|
||||
boolean trace = req.has("trace") && req.get("trace").getAsBoolean();
|
||||
|
||||
Map<String, String> params = jsonObjectToMap(req, "parameters");
|
||||
@@ -126,10 +126,12 @@ public class SaxonDaemon {
|
||||
Runner.attachTraceListener(proc, transformer, traceSink);
|
||||
}
|
||||
|
||||
// Source document
|
||||
XdmNode doc = proc.newDocumentBuilder()
|
||||
.build(new StreamSource(new StringReader(source)));
|
||||
transformer.setInitialContextNode(doc);
|
||||
// Source document — omit when empty so Saxon can invoke xsl:initial-template
|
||||
if (source != null && !source.isEmpty()) {
|
||||
XdmNode doc = proc.newDocumentBuilder()
|
||||
.build(new StreamSource(new StringReader(source)));
|
||||
transformer.setInitialContextNode(doc);
|
||||
}
|
||||
|
||||
// String parameters
|
||||
for (Map.Entry<String, String> e : params.entrySet()) {
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ func pickSourceXML(params map[string]string) (string, string) {
|
||||
return html.UnescapeString(strings.TrimSpace(val)), key
|
||||
}
|
||||
}
|
||||
return "<root/>", ""
|
||||
return "", ""
|
||||
}
|
||||
|
||||
func loadConfig(filename string) (*AppConfig, error) {
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@
|
||||
<title>XSLT Online — Free Editor, Tester & Validator | XSLT Playground</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="The only free online XSLT tool supporting XSLT 1.0, 2.0 and 3.0 via Saxon. Test, transform and validate XML instantly — no install, no signup."
|
||||
content="Free online XSLT tool supporting XSLT 1.0, 2.0 and 3.0 via Saxon. Test, transform and validate XML instantly — no install, no signup."
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
@@ -24,7 +24,7 @@
|
||||
<meta property="og:title" content="XSLT Online — Free Editor, Tester & Validator | XSLT Playground" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="The only free online XSLT tool supporting XSLT 1.0, 2.0 and 3.0 via Saxon. Transform and validate XML instantly in your browser. No install, no signup."
|
||||
content="Free online XSLT tool supporting XSLT 1.0, 2.0 and 3.0 via Saxon. Transform and validate XML instantly in your browser. No install, no signup."
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://xsltplayground.com/" />
|
||||
@@ -35,7 +35,7 @@
|
||||
<meta property="og:site_name" content="XSLT Playground" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="XSLT Online — Free Editor, Tester & Validator" />
|
||||
<meta name="twitter:description" content="The only free online XSLT tool supporting XSLT 1.0, 2.0 and 3.0 via Saxon. No install, no signup." />
|
||||
<meta name="twitter:description" content="Free online XSLT tool supporting XSLT 1.0, 2.0 and 3.0 via Saxon. No install, no signup." />
|
||||
<meta name="twitter:image" content="https://xsltplayground.com/og-image.png" />
|
||||
<link rel="canonical" href="https://xsltplayground.com/" />
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>XSLT 3.0 Online Tester — Free XSLT 3.0 Editor & Transformer | XSLT Playground</title>
|
||||
<meta name="description" content="Test XSLT 3.0 online for free. Full Saxon HE support for maps, arrays, streaming, higher-order functions and JSON. The only free online XSLT 3.0 tool. No install." />
|
||||
<meta name="description" content="Test XSLT 3.0 online for free. Full Saxon HE support for maps, arrays, streaming, higher-order functions and JSON. No install." />
|
||||
<link rel="canonical" href="https://xsltplayground.com/xslt-3-0/" />
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<meta property="og:title" content="XSLT 3.0 Online Tester — Free Editor & Transformer" />
|
||||
<meta property="og:description" content="Test XSLT 3.0 online with full Saxon HE support. Maps, arrays, streaming, higher-order functions, JSON. The only free online XSLT 3.0 tool." />
|
||||
<meta property="og:description" content="Test XSLT 3.0 online with full Saxon HE support. Maps, arrays, streaming, higher-order functions, JSON." />
|
||||
<meta property="og:url" content="https://xsltplayground.com/xslt-3-0/" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content="https://xsltplayground.com/og-image.png" />
|
||||
|
||||
Reference in New Issue
Block a user