Connected frontend and backend
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user