Added XQuery Tool and refactored tools-service #220

Merged
bema merged 30 commits from bema/func/xquery into master 2023-06-12 10:53:24 +02:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit 79b9a54334 - Show all commits

View File

@@ -135,6 +135,24 @@ function fillDefaultXSLT() {
} )
}
/**
* The `fillDefaultXQuery()` function fetches a default XQuery from the server and sets the value of the element with id "transformArea" to the fetched template.
*
* @function
* @name fillDefaultXQuery
* @kind function
* @returns {void}
*/
function fillDefaultXQuery() {
const serverAddress = window.location.protocol + "//" + window.location.hostname;
fetch(serverAddress + "/assets/samples/sampleXQuery.xquery")
.then( response => response.text() )
.then( (XQueryTemplate) => {
document.getElementById('transformArea').innerText = XQueryTemplate;
highlightSyntax("transformArea");
} )
}
/**
* It sets default content for the element an changes it's color to grey
*

View File

@@ -55,7 +55,7 @@
<div class="display-space-between">
<label for="transformArea"><b>Insert your XQuery:</b></label>
<div>
<button class="action-button active" id="defaultQueryButton" style="padding: 3px 10px;">Insert default query</button>
<button class="action-button active" id="defaultQueryButton" style="padding: 3px 10px;" onclick="fillDefaultXQuery();">Insert default XQuery</button>
</div>
</div>
<pre><code class="language-xml bordered-field textarea-300" id="transformArea" contenteditable="True"></code></pre>