diff --git a/Frontend/assets/samples/XSLTTemplate.xslt b/Frontend/assets/samples/XSLTTemplate.xslt new file mode 100644 index 0000000..3ce05e2 --- /dev/null +++ b/Frontend/assets/samples/XSLTTemplate.xslt @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Frontend/assets/scripts/tools/scripts.js b/Frontend/assets/scripts/tools/scripts.js index db2c22c..683948a 100644 --- a/Frontend/assets/scripts/tools/scripts.js +++ b/Frontend/assets/scripts/tools/scripts.js @@ -84,6 +84,24 @@ function fillDefaultXML(element) { } } + +/** + * The `fillDefaultXSLT()` function fetches a default XSLT template from the server and sets the value of the element with id "transformArea" to the fetched template. + * + * @function + * @name fillDefaultXSLT + * @kind function + * @returns {void} + */ +function fillDefaultXSLT() { + const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086"; + fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt") + .then( response => response.text() ) + .then( (XSTLTemplate) => { + document.getElementById('transformArea').value = XSTLTemplate; + } ) +} + /** * It sets default content for the element an changes it's color to grey * diff --git a/Frontend/tools/xslt.html b/Frontend/tools/xslt.html index 674a7cc..50d3d94 100644 --- a/Frontend/tools/xslt.html +++ b/Frontend/tools/xslt.html @@ -25,7 +25,7 @@ libXML - 1.0 + 1.0 2.0 3.0 3.1 @@ -51,7 +51,14 @@ onfocus="clearDefaultContent(this, 'Insert XML here');"> - Insert your XSLT: + + Insert your XSLT: + + Insert default XSLT + + + function processTooltip() { - + if (getProcessor() == "xalan" || getProcessor() == "libxml") { document.getElementById("tooltipFunctionInfo").innerText = "XSLT 1.0 functions"; document.getElementById("processorTooltipInfo").innerText = "Supports XSLT 1.0"; @@ -1158,9 +1165,9 @@ var triggerList = document.getElementsByClassName("collapseTrigger"); for (i = 0; i < triggerList.length; i++) { - + triggerList[i].addEventListener("click", function () { - + var collapsible = this.parentElement; var collapsibleData = this.nextElementSibling; if (collapsibleData.style.maxHeight > "0px") { @@ -1197,7 +1204,7 @@ //Handle clicks in whole form and set info in tooltip setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here'); setDefaultContent(document.getElementById("transformArea"), 'Insert XSLT here'); - + // refreshTooltip(); processTooltip(); tool.addEventListener('click', event => {